@import url("https://fonts.cdnfonts.com/css/janna-lt");

:root {
    --saqr-navy: #1f4f8f;
    --saqr-navy-2: #17467f;
    --saqr-blue: #159bd7;
    --saqr-teal: #35c9c5;
    --saqr-cyan: #23bfd0;
    --saqr-orange: #f47b20;
    --saqr-red: #dc2626;
    --saqr-gray: #7c8da8;
    --saqr-bg: #f3f6fd;
    --saqr-border: #dfe8f4;
    --saqr-text: #1e3561;
    --saqr-muted: #72829f;
    --saqr-soft-blue: #eaf7ff;
    --saqr-soft-teal: #e7fbfa;
}

* {
    letter-spacing: 0;
}

body {
    background: var(--saqr-bg);
    color: var(--saqr-text);
    font-family: "Janna LT", "Janna", "Janna LT Regular", "Cairo", "Segoe UI", Tahoma, Arial, sans-serif;
    min-height: 100vh;
}

a {
    text-decoration: none;
}

.auth-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 0.9fr 1.1fr;
    background: linear-gradient(180deg, #ffffff 0%, #f3f6fd 100%);
}

.auth-panel {
    background: linear-gradient(135deg, #ffffff 0%, #e9f7ff 48%, #e9fbfa 100%);
    color: var(--saqr-navy);
    padding: 48px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 42px;
    border-left: 4px solid var(--saqr-teal);
}

.auth-card {
    align-self: center;
    width: min(440px, calc(100% - 32px));
    background: #fff;
    border: 1px solid var(--saqr-border);
    border-radius: 8px;
    box-shadow: 0 18px 42px rgba(31, 79, 143, 0.12);
    padding: 32px;
}

.auth-panel .text-info {
    color: var(--saqr-blue) !important;
}

.auth-panel .text-white-50 {
    color: rgba(30, 53, 97, 0.7) !important;
}

.auth-main {
    display: flex;
    min-height: 100vh;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 18px;
    padding: 32px 16px;
}

.auth-credit,
.app-footer {
    color: var(--saqr-muted);
    font-size: 0.86rem;
    text-align: center;
}

.auth-hero-identity {
    text-align: center;
    display: grid;
    justify-items: center;
    gap: 10px;
}

.brand-mark {
    display: inline-grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--saqr-teal), #0ea5e9);
    color: #fff;
    font-weight: 800;
}

.auth-logo {
    width: 68px;
    height: 68px;
    object-fit: contain;
    border-radius: 12px;
    background: #fff;
    border: 1px solid rgba(31, 79, 143, 0.12);
    box-shadow: 0 12px 28px rgba(31, 79, 143, 0.12);
    padding: 6px;
}

.auth-hero-identity .auth-logo-large {
    width: 190px;
    height: 190px;
    margin-bottom: 18px;
    border-radius: 22px;
    padding: 12px;
}

.auth-hero-identity .brand-mark.auth-logo-large {
    font-size: 4.5rem;
}

.auth-hero-subtitle {
    color: var(--saqr-blue);
    font-size: 1.2rem;
    font-weight: 800;
    margin-top: -8px;
}

.app-logo {
    width: 48px;
    height: 48px;
    object-fit: contain;
    border-radius: 10px;
    background: #fff;
    border: 1px solid rgba(31, 79, 143, 0.12);
    box-shadow: 0 10px 24px rgba(31, 79, 143, 0.1);
    padding: 5px;
    flex: 0 0 auto;
}

.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 280px 1fr;
}

.side-nav {
    background: #ffffff;
    color: var(--saqr-navy);
    padding: 22px 18px;
    position: sticky;
    top: 0;
    min-height: 100vh;
    border-left: 1px solid var(--saqr-border);
    box-shadow: -8px 0 24px rgba(31, 79, 143, 0.05);
}

.side-nav .nav-link {
    color: var(--saqr-navy);
    border-radius: 8px;
    padding: 11px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 4px;
}

.side-nav .nav-link.active,
.side-nav .nav-link:hover {
    background: linear-gradient(90deg, var(--saqr-soft-teal), var(--saqr-soft-blue));
    color: var(--saqr-navy);
    box-shadow: inset -4px 0 0 var(--saqr-teal);
}

.side-nav .nav-section {
    font-size: 0.72rem;
    color: var(--saqr-muted);
    margin: 24px 12px 8px;
}

.main-area {
    min-width: 0;
    display: flex;
    min-height: 100vh;
    flex-direction: column;
}

.topbar {
    background: rgba(255, 255, 255, 0.96);
    border-bottom: 1px solid var(--saqr-border);
    backdrop-filter: blur(12px);
    position: sticky;
    top: 0;
    z-index: 20;
}

.page-wrap {
    padding: 24px;
    flex: 1;
}

.app-footer {
    padding: 12px 24px 18px;
}

.section-title {
    font-size: 1.15rem;
    font-weight: 800;
    margin: 0;
}

.muted {
    color: var(--saqr-muted);
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(138px, 1fr));
    gap: 12px;
}

.kpi-card,
.panel,
.table-panel,
.incident-header,
.timeline-card {
    background: #fff;
    border: 1px solid var(--saqr-border);
    border-radius: 8px;
    box-shadow: 0 12px 28px rgba(31, 79, 143, 0.07);
}

.kpi-card {
    padding: 16px;
    min-height: 112px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    border-bottom: 4px solid var(--saqr-teal);
}

.kpi-card .icon-box {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    display: inline-grid;
    place-items: center;
    background: var(--saqr-soft-teal);
    color: var(--saqr-teal);
}

.kpi-value {
    font-size: 1.75rem;
    font-weight: 900;
    line-height: 1;
    color: var(--saqr-navy);
}

.panel {
    padding: 18px;
    border-top: 4px solid var(--saqr-teal);
}

.table-panel {
    overflow: hidden;
}

.table > :not(caption) > * > * {
    padding: 0.9rem 0.85rem;
}

.badge-soft {
    border-radius: 999px;
    padding: 0.42rem 0.65rem;
    font-weight: 700;
    white-space: nowrap;
}

.badge-positive { background: #dffaf8; color: #0f827e; }
.badge-neutral { background: #e7f5ff; color: #1f4f8f; }
.badge-negative { background: #fee2e2; color: #b91c1c; }
.badge-low { background: #dffaf8; color: #0f827e; }
.badge-medium { background: #fef3c7; color: #92400e; }
.badge-urgent { background: #ffedd5; color: #c2410c; }
.badge-critical { background: #fee2e2; color: #b91c1c; }
.badge-closed { background: #edf3fa; color: #52637d; }

.sla-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border-radius: 999px;
    padding: 0.42rem 0.65rem;
    font-size: 0.85rem;
    font-weight: 800;
}

.sla-green { background: #dffaf8; color: #0f827e; }
.sla-yellow { background: #fef3c7; color: #92400e; }
.sla-red { background: #fee2e2; color: #b91c1c; }
.sla-gray { background: #edf3fa; color: #52637d; }
.sla-blue { background: #e7f5ff; color: #1f4f8f; }

.feed-list {
    display: grid;
    gap: 10px;
}

.feed-item {
    border: 1px solid var(--saqr-border);
    border-radius: 8px;
    padding: 12px;
    background: #ffffff;
}

.twitter-alert {
    border-right: 4px solid var(--saqr-blue);
}

.twitter-alert.watch {
    border-right-color: var(--saqr-teal);
}

.twitter-alert.important {
    border-right-color: var(--saqr-orange);
}

.twitter-alert.critical {
    border-right-color: var(--saqr-red);
    background: #fff8f8;
}

.matched-keyword {
    background: #fff3b0;
    color: var(--saqr-navy);
    border-radius: 6px;
    padding: 0 4px;
    font-weight: 900;
}

.query-code {
    display: block;
    white-space: pre-wrap;
    direction: ltr;
    text-align: left;
    color: var(--saqr-navy);
    background: #f6fbff;
    border: 1px solid var(--saqr-border);
    border-radius: 8px;
    padding: 10px;
    line-height: 1.8;
}

.query-details summary {
    cursor: pointer;
    list-style: none;
}

.query-details summary::-webkit-details-marker {
    display: none;
}

.keyword-list {
    display: grid;
    gap: 12px;
}

.keyword-card {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 16px;
    align-items: start;
    background: #fff;
    border: 1px solid var(--saqr-border);
    border-radius: 8px;
    box-shadow: 0 12px 28px rgba(31, 79, 143, 0.06);
    padding: 16px;
}

.keyword-title {
    color: var(--saqr-navy);
    font-size: 1.05rem;
}

.keyword-edit {
    min-width: 120px;
}

.keyword-edit summary {
    cursor: pointer;
    list-style: none;
}

.keyword-edit summary::-webkit-details-marker {
    display: none;
}

.keyword-edit[open] {
    grid-column: 1 / -1;
}

.keyword-edit-form {
    padding-top: 12px;
    border-top: 1px solid var(--saqr-border);
}

.classification-form {
    min-width: 180px;
}

.copy-link-btn {
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--saqr-blue);
    font-weight: 700;
}

.operations-strip {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 10px;
}

.operation-chip {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 58px;
    padding: 12px 14px;
    border: 1px solid var(--saqr-border);
    border-radius: 8px;
    background: #fff;
    color: var(--saqr-navy);
    box-shadow: 0 12px 28px rgba(31, 79, 143, 0.06);
}

.operation-chip strong {
    display: inline-grid;
    place-items: center;
    min-width: 32px;
    height: 32px;
    border-radius: 999px;
    background: var(--saqr-soft-blue);
    color: var(--saqr-navy);
}

.operation-chip.active {
    border-color: var(--saqr-teal);
    background: var(--saqr-soft-teal);
}

.operation-chip.active strong {
    background: var(--saqr-teal);
    color: #fff;
}

.operation-chip.danger strong {
    background: #fee2e2;
    color: #b91c1c;
}

.operation-chip.danger.active {
    border-color: var(--saqr-red);
    background: #fff8f8;
}

.operation-chip.danger.active strong {
    background: var(--saqr-red);
    color: #fff;
}

.auto-refresh-notice {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 14px 16px;
    border: 1px solid rgba(53, 201, 197, 0.35);
    border-radius: 8px;
    background: linear-gradient(135deg, #ffffff 0%, #effdff 55%, #ecfffb 100%);
    box-shadow: 0 14px 32px rgba(31, 79, 143, 0.07);
}

.auto-refresh-pulse {
    width: 12px;
    height: 12px;
    border-radius: 999px;
    background: var(--saqr-teal);
    box-shadow: 0 0 0 0 rgba(53, 201, 197, 0.44);
    animation: saqr-pulse 1.8s infinite;
    flex: 0 0 auto;
}

@keyframes saqr-pulse {
    70% {
        box-shadow: 0 0 0 10px rgba(53, 201, 197, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(53, 201, 197, 0);
    }
}

.executive-live-hero {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 18px;
    align-items: center;
    padding: 24px;
    border: 1px solid var(--saqr-border);
    border-radius: 8px;
    background: linear-gradient(135deg, #ffffff 0%, #e9f7ff 52%, #e8fbfa 100%);
    border-bottom: 4px solid var(--saqr-teal);
    box-shadow: 0 16px 36px rgba(31, 79, 143, 0.08);
}

.executive-live-logo {
    width: 74px;
    height: 74px;
    object-fit: contain;
    border-radius: 14px;
    background: #fff;
    padding: 6px;
    border: 1px solid rgba(31, 79, 143, 0.12);
}

.executive-live-copy h1 {
    margin: 0;
    color: var(--saqr-navy);
    font-size: 1.7rem;
    font-weight: 900;
}

.executive-live-copy p {
    margin: 4px 0 0;
    color: var(--saqr-muted);
}

.executive-live-status {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.executive-live-status span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--saqr-navy);
    background: #fff;
    border: 1px solid var(--saqr-border);
    border-radius: 999px;
    padding: 7px 10px;
    font-weight: 700;
}

.executive-score {
    min-width: 170px;
    text-align: center;
    background: #fff;
    border: 1px solid var(--saqr-border);
    border-radius: 8px;
    padding: 14px;
}

.executive-score span,
.executive-score small {
    display: block;
    color: var(--saqr-muted);
}

.executive-score strong {
    display: block;
    color: var(--saqr-navy);
    font-size: 3rem;
    line-height: 1;
    font-weight: 900;
}

.executive-kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(140px, 1fr));
    gap: 12px;
}

.executive-kpi {
    background: #fff;
    border: 1px solid var(--saqr-border);
    border-radius: 8px;
    border-bottom: 4px solid var(--saqr-teal);
    box-shadow: 0 12px 28px rgba(31, 79, 143, 0.06);
    padding: 14px;
}

.executive-kpi.danger {
    border-bottom-color: var(--saqr-red);
}

.executive-kpi span,
.executive-kpi small {
    display: block;
    color: var(--saqr-muted);
}

.executive-kpi strong {
    display: block;
    color: var(--saqr-navy);
    font-size: 2rem;
    line-height: 1.1;
    font-weight: 900;
    margin: 8px 0 2px;
}

.executive-live-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.3fr) minmax(320px, 0.7fr);
    gap: 14px;
}

.executive-panel {
    min-height: 280px;
}

.executive-feed-panel {
    grid-row: span 2;
}

.executive-chart-panel {
    grid-column: 1 / -1;
}

.executive-feed {
    max-height: 690px;
    overflow: auto;
    padding-left: 4px;
}

.executive-rank-list,
.executive-category-list {
    display: grid;
    gap: 10px;
}

.executive-rank-row,
.executive-category-row {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border: 1px solid var(--saqr-border);
    border-radius: 8px;
    background: #fff;
}

.executive-rank-row span {
    display: inline-grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 999px;
    background: var(--saqr-soft-teal);
    color: var(--saqr-navy);
    font-weight: 900;
}

.executive-rank-row em,
.executive-category-row em {
    color: var(--saqr-muted);
    font-style: normal;
    font-weight: 800;
}

.executive-category-row {
    grid-template-columns: 100px 1fr auto;
}

.executive-category-bar {
    height: 10px;
    overflow: hidden;
    border-radius: 999px;
    background: #eef5fb;
}

.executive-category-bar span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--saqr-blue), var(--saqr-teal));
}

.install-pwa-btn,
.notify-toggle-btn {
    display: none;
}

.install-pwa-btn.is-ready,
.notify-toggle-btn.is-ready {
    display: inline-flex;
}

.priority-strip {
    width: 4px;
    border-radius: 6px;
    background: var(--saqr-blue);
}

.priority-strip.critical { background: var(--saqr-red); }
.priority-strip.urgent { background: var(--saqr-orange); }
.priority-strip.medium { background: var(--saqr-orange); }
.priority-strip.low { background: var(--saqr-teal); }

.incident-header {
    padding: 20px;
}

.meta-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(150px, 1fr));
    gap: 12px;
}

.meta-item {
    border: 1px solid var(--saqr-border);
    border-radius: 8px;
    padding: 12px;
    background: #fbfdff;
}

.timeline {
    position: relative;
    display: grid;
    gap: 12px;
}

.timeline-card {
    padding: 14px;
    border-right: 4px solid var(--saqr-blue);
}

.form-control,
.form-select {
    border-radius: 8px;
    border-color: #d6e2ef;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--saqr-teal);
    box-shadow: 0 0 0 0.2rem rgba(53, 201, 197, 0.18);
}

.btn {
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    font-weight: 700;
}

.btn-primary {
    background: var(--saqr-blue);
    border-color: var(--saqr-blue);
}

.btn-primary:hover {
    background: #0f87c4;
    border-color: #0f87c4;
}

.btn-teal {
    background: var(--saqr-teal);
    border-color: var(--saqr-teal);
    color: #fff;
}

.btn-teal:hover {
    background: #22b7b3;
    border-color: #22b7b3;
    color: #fff;
}

.mobile-nav {
    display: none;
}

.chart-box {
    min-height: 300px;
}

.executive-ribbon {
    background: linear-gradient(135deg, #ffffff, #e7f5ff 45%, #e7fbfa);
    color: var(--saqr-navy);
    border-radius: 8px;
    padding: 18px;
    border: 1px solid var(--saqr-border);
    border-bottom: 4px solid var(--saqr-teal);
}

.executive-ribbon .text-white-50 {
    color: var(--saqr-muted) !important;
}

@media (max-width: 1180px) {
    .meta-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .auth-shell {
        grid-template-columns: 1fr;
    }

    .auth-panel {
        min-height: 230px;
        padding: 28px;
        gap: 24px;
    }

    .auth-hero-identity .auth-logo-large {
        width: 132px;
        height: 132px;
        margin-bottom: 8px;
    }

    .app-shell {
        display: block;
    }

    .side-nav {
        display: none;
    }

    .mobile-nav {
        display: block;
    }

    .page-wrap {
        padding: 12px;
    }

    .kpi-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .operations-strip,
    .meta-grid {
        grid-template-columns: 1fr;
    }

    .auto-refresh-notice {
        align-items: flex-start;
        flex-direction: column;
    }

    .executive-live-hero,
    .executive-live-grid {
        grid-template-columns: 1fr;
    }

    .executive-kpi-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .executive-score {
        min-width: 0;
    }

    .executive-live-copy .d-flex {
        align-items: flex-start !important;
    }

    .executive-live-logo {
        width: 58px;
        height: 58px;
    }

    .executive-live-copy h1 {
        font-size: 1.18rem;
    }

    .executive-category-row {
        grid-template-columns: 1fr auto;
    }

    .executive-category-bar {
        grid-column: 1 / -1;
    }

    .topbar > .d-flex {
        align-items: flex-start !important;
        flex-direction: column;
        gap: 12px;
        padding: 12px !important;
    }

    .topbar .badge-soft {
        max-width: 100%;
        white-space: normal;
    }

    .kpi-card {
        min-height: 96px;
        padding: 12px;
    }

    .kpi-value {
        font-size: 1.45rem;
    }

    .panel {
        padding: 14px;
    }

    .section-title {
        font-size: 1rem;
    }

    .table-responsive {
        border: 0;
        overflow: visible;
    }

    .table-panel {
        background: transparent;
        border: 0;
        box-shadow: none;
        overflow: visible;
    }

    .table-panel table,
    .table-panel thead,
    .table-panel tbody,
    .table-panel th,
    .table-panel td,
    .table-panel tr {
        display: block;
        width: 100%;
    }

    .table-panel thead {
        display: none;
    }

    .table-panel tbody {
        display: grid;
        gap: 12px;
    }

    .table-panel tbody tr {
        background: #fff;
        border: 1px solid var(--saqr-border);
        border-radius: 8px;
        box-shadow: 0 10px 22px rgba(31, 79, 143, 0.07);
        padding: 12px;
    }

    .table-panel td {
        border: 0;
        padding: 8px 0;
        text-align: right !important;
        min-width: 0 !important;
    }

    .table-panel td::before {
        content: attr(data-label);
        display: block;
        margin-bottom: 4px;
        color: var(--saqr-muted);
        font-size: 0.78rem;
        font-weight: 800;
    }

    .classification-form {
        min-width: 0;
    }

    .table-panel .d-flex {
        justify-content: flex-start !important;
    }

    .keyword-card {
        grid-template-columns: 1fr;
    }

    .keyword-edit {
        min-width: 0;
    }

    .keyword-edit summary {
        width: 100%;
        justify-content: center;
    }
}
