:root {
    --blue: #0a84d6;
    --blue-dark: #075b94;
    --orange: #ff7a00;
    --dark: #0b1724;
    --dark2: #101f30;
    --text: #172331;
    --muted: #687789;
    --border: #dfe6ed;
    --bg: #f5f8fb;
    --white: #ffffff;
    --green: #159447;
    --red: #d92d20;
    --yellow: #d99000;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family:
        Inter,
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
}

a {
    color: inherit;
    text-decoration: none;
}

.topbar {
    min-height: 72px;
    padding: 12px 5%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--white);
    border-bottom: 1px solid var(--border);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-logo {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    background: linear-gradient(
        135deg,
        var(--blue),
        var(--orange)
    );
    color: white;
    display: grid;
    place-items: center;
    font-weight: 900;
    font-size: 22px;
}

.brand strong {
    display: block;
    font-size: 15px;
    letter-spacing: .4px;
}

.brand span {
    display: block;
    font-size: 10px;
    color: var(--muted);
    letter-spacing: 1.5px;
    margin-top: 2px;
}

.top-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.btn {
    border: 0;
    border-radius: 9px;
    padding: 11px 17px;
    cursor: pointer;
    font-weight: 700;
    display: inline-block;
    transition: .2s;
}

.btn:hover {
    transform: translateY(-1px);
}

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

.btn-primary:hover {
    background: var(--blue-dark);
}

.btn-outline {
    background: white;
    color: var(--blue-dark);
    border: 1px solid var(--border);
}

.btn-large {
    padding: 14px 22px;
}

.btn-small {
    padding: 8px 12px;
    font-size: 13px;
}

.full {
    width: 100%;
}

.hero {
    min-height: 580px;
    padding: 90px 8%;
    display: grid;
    grid-template-columns: 1.4fr .8fr;
    gap: 70px;
    align-items: center;
    background:
        radial-gradient(
            circle at 80% 20%,
            rgba(10,132,214,.14),
            transparent 30%
        ),
        linear-gradient(
            135deg,
            #f8fbff,
            #eef6fc
        );
}

.eyebrow {
    color: var(--orange);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 1.7px;
    margin-bottom: 10px;
}

.hero h1 {
    max-width: 800px;
    font-size: clamp(42px, 6vw, 76px);
    line-height: .98;
    margin: 0 0 24px;
    letter-spacing: -3px;
}

.hero h1 span {
    color: var(--blue);
}

.hero p {
    max-width: 700px;
    font-size: 19px;
    line-height: 1.7;
    color: var(--muted);
}

.hero-buttons {
    display: flex;
    gap: 12px;
    margin-top: 30px;
    flex-wrap: wrap;
}

.hero-card {
    background: var(--dark);
    color: white;
    padding: 32px;
    border-radius: 22px;
    box-shadow: 0 25px 70px rgba(0,0,0,.16);
}

.status-dot {
    width: 12px;
    height: 12px;
    background: #28c76f;
    border-radius: 50%;
    display: inline-block;
    box-shadow: 0 0 0 7px rgba(40,199,111,.12);
    margin-bottom: 22px;
}

.hero-card-title {
    font-size: 13px;
    color: #9eb3c6;
    letter-spacing: 1.5px;
}

.hero-card-status {
    font-size: 28px;
    font-weight: 800;
    margin-top: 6px;
}

.mini-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 30px;
}

.mini-grid div {
    background: rgba(255,255,255,.07);
    border-radius: 12px;
    padding: 15px;
}

.mini-grid strong,
.mini-grid span {
    display: block;
}

.mini-grid span {
    color: #9eb3c6;
    font-size: 12px;
    margin-top: 4px;
}

.section {
    padding: 80px 8%;
}

.section-heading h2 {
    font-size: 38px;
    margin: 0 0 35px;
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
}

.feature-card {
    background: white;
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 25px;
}

.feature-number {
    color: var(--orange);
    font-size: 13px;
    font-weight: 800;
}

.feature-card h3 {
    margin-bottom: 10px;
}

.feature-card p {
    color: var(--muted);
    line-height: 1.6;
}

.dark-section {
    background: var(--dark);
    color: white;
}

.category-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
}

.category-grid div {
    background: rgba(255,255,255,.06);
    border: 1px solid rgba(255,255,255,.1);
    padding: 20px;
    border-radius: 12px;
}

footer {
    background: #07111c;
    color: white;
    padding: 25px 8%;
    display: flex;
    justify-content: space-between;
    gap: 20px;
    color: #9eb3c6;
}

footer strong {
    display: block;
    color: white;
}

footer span {
    display: block;
    font-size: 12px;
    margin-top: 5px;
}

.portal-container {
    max-width: 1250px;
    margin: auto;
    padding: 45px 20px 80px;
}

.portal-header,
.dashboard-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 25px;
}

.portal-header h1,
.dashboard-top h1 {
    margin: 0;
    font-size: 36px;
}

.portal-header p {
    color: var(--muted);
}

.online-badge {
    background: white;
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 9px 13px;
    font-size: 12px;
    font-weight: 700;
}

.online-badge span {
    width: 8px;
    height: 8px;
    background: var(--green);
    border-radius: 50%;
    display: inline-block;
    margin-right: 5px;
}

.panel {
    background: white;
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 25px;
    margin-bottom: 22px;
}

.login-panel {
    max-width: 500px;
    margin: 60px auto;
}

.panel h2 {
    margin-top: 0;
}

label {
    display: block;
    font-size: 13px;
    font-weight: 700;
    margin: 15px 0 7px;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid #cfd9e3;
    border-radius: 9px;
    padding: 12px;
    font: inherit;
    outline: none;
    background: white;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(10,132,214,.1);
}

textarea {
    min-height: 110px;
    resize: vertical;
}

.panel .btn {
    margin-top: 18px;
}

.message {
    margin-top: 14px;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 13px;
}

.message:empty {
    display: none;
}

.message.success {
    background: #e9f8ef;
    color: #08752f;
}

.message.error {
    background: #fff0ef;
    color: #b42318;
}

.notice {
    margin-top: 10px;
    padding: 10px;
    background: #eef7ff;
    color: #075b94;
    border-radius: 8px;
    font-size: 13px;
}

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

.hidden {
    display: none !important;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 12px;
    margin-bottom: 22px;
}

.stat-card {
    background: white;
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 18px;
}

.stat-card span {
    color: var(--muted);
    font-size: 12px;
}

.stat-card strong {
    display: block;
    font-size: 28px;
    margin-top: 7px;
}

.panel-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
}

.filter-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr auto;
    gap: 10px;
    margin-bottom: 20px;
}

.filter-row .btn {
    margin-top: 0;
}

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

.ticket-card {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 17px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

.ticket-card strong,
.ticket-subject {
    display: block;
}

.ticket-subject {
    color: var(--muted);
    margin-top: 5px;
}

.ticket-meta {
    display: flex;
    gap: 7px;
    flex-wrap: wrap;
}

.badge {
    display: inline-block;
    padding: 5px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 800;
    background: #edf1f5;
}

.priority-critical {
    background: #ffe1df;
    color: #a30d05;
}

.priority-high {
    background: #fff0d7;
    color: #8c5900;
}

.priority-medium {
    background: #e9f4ff;
    color: #075b94;
}

.priority-low {
    background: #edf5ee;
    color: #287335;
}

.status-new {
    background: #e9f4ff;
    color: #075b94;
}

.status-assigned {
    background: #fff0d7;
    color: #8c5900;
}

.status-in_progress {
    background: #efeaff;
    color: #6546b8;
}

.status-resolved {
    background: #e7f8ed;
    color: #147a3c;
}

.status-closed {
    background: #edf0f3;
    color: #4c5965;
}

.status-reopened {
    background: #ffe7e5;
    color: #a30d05;
}

.empty {
    padding: 30px;
    text-align: center;
    color: var(--muted);
    border: 1px dashed var(--border);
    border-radius: 12px;
}

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

th,
td {
    padding: 13px 10px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

th {
    font-size: 11px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .7px;
}

td strong,
td small {
    display: block;
}

td small {
    color: var(--muted);
    margin-top: 4px;
}

@media(max-width:1000px) {
    .hero {
        grid-template-columns: 1fr;
    }

    .feature-grid {
        grid-template-columns: 1fr 1fr;
    }

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

    .stats-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media(max-width:650px) {

    .topbar {
        padding: 12px 18px;
    }

    .top-actions {
        display: none;
    }

    .hero {
        padding: 55px 20px;
    }

    .hero h1 {
        font-size: 43px;
        letter-spacing: -2px;
    }

    .section {
        padding: 55px 20px;
    }

    .feature-grid,
    .category-grid,
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .portal-container {
        padding: 25px 14px 60px;
    }

    .portal-header,
    .dashboard-top {
        align-items: flex-start;
        flex-direction: column;
    }

    .filter-row {
        grid-template-columns: 1fr;
    }

    .ticket-card {
        align-items: flex-start;
        flex-direction: column;
    }

    footer {
        flex-direction: column;
    }
}


/* =========================================================
   NOC TICKET DETAIL CONSOLE
   ========================================================= */

body.modal-open {
    overflow: hidden;
}

.ticket-row {
    cursor: pointer;
}

.ticket-row:hover {
    background: #f8fafc;
}

.ticket-row:focus {
    outline: 2px solid #0A84D6;
    outline-offset: -2px;
}

.ticket-row td {
    transition: background 0.15s ease;
}

.ticket-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
}

.ticket-modal.hidden {
    display: none !important;
}

.ticket-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.62);
    backdrop-filter: blur(3px);
}

.ticket-modal-dialog {
    position: relative;
    z-index: 2;
    width: min(1180px, calc(100% - 32px));
    max-height: calc(100vh - 32px);
    margin: 16px auto;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 24px 80px rgba(15, 23, 42, 0.28);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.ticket-modal-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 18px 24px;
    border-bottom: 1px solid #e2e8f0;
    background: #ffffff;
}

.ticket-modal-topbar h2 {
    margin: 0;
    font-size: 20px;
}

.ticket-modal-body {
    overflow-y: auto;
    padding: 24px;
    background: #f8fafc;
}

.ticket-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 20px;
}

.ticket-detail-header h2 {
    margin: 4px 0 6px;
    font-size: 28px;
}

.ticket-detail-subject {
    margin: 0;
    color: #64748b;
}

.ticket-detail-badges {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.ticket-detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

.ticket-detail-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
}

.ticket-detail-card h3 {
    margin: 0 0 16px;
    font-size: 17px;
}

.detail-row {
    display: grid;
    grid-template-columns: 140px minmax(0, 1fr);
    gap: 12px;
    padding: 9px 0;
    border-bottom: 1px solid #f1f5f9;
}

.detail-row:last-child {
    border-bottom: 0;
}

.detail-row span {
    color: #64748b;
    font-size: 13px;
}

.detail-row strong {
    color: #1e293b;
    font-size: 14px;
    overflow-wrap: anywhere;
}

.ticket-control-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 16px;
}

.ticket-control-grid label,
.reply-type label {
    display: block;
    margin-bottom: 6px;
    color: #475569;
    font-size: 13px;
    font-weight: 600;
}

.ticket-control-grid select,
.reply-type select,
.reply-box textarea {
    width: 100%;
    box-sizing: border-box;
}

.ticket-control-grid select,
.reply-type select {
    min-height: 42px;
    padding: 9px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: #ffffff;
}

.section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.conversation {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.conversation-message {
    border-radius: 10px;
    padding: 13px 15px;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
}

.customer-message {
    border-left: 4px solid #0A84D6;
}

.staff-message {
    border-left: 4px solid #16a34a;
}

.internal-message {
    border-left: 4px solid #f59e0b;
    background: #fffbeb;
}

.conversation-meta {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 7px;
    font-size: 12px;
    color: #64748b;
}

.conversation-meta strong {
    color: #334155;
}

.conversation-body {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    color: #1e293b;
    line-height: 1.55;
}

.reply-box {
    border-top: 1px solid #e2e8f0;
    padding-top: 18px;
}

.reply-type {
    max-width: 260px;
    margin-bottom: 10px;
}

.reply-box textarea {
    min-height: 110px;
    resize: vertical;
    padding: 12px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font: inherit;
}

.reply-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 10px;
}

.inline-message {
    font-size: 13px;
    color: #64748b;
}

.success-text {
    color: #15803d;
}

.error-text {
    color: #dc2626;
}

.attachment-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.attachment-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    padding: 11px 13px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
}

.attachment-item small {
    color: #64748b;
    white-space: nowrap;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.history-item {
    display: flex;
    justify-content: space-between;
    gap: 15px;
    padding: 11px 13px;
    border-left: 3px solid #cbd5e1;
    background: #f8fafc;
}

.history-item strong,
.history-item small {
    display: block;
}

.history-item small {
    margin-top: 4px;
    color: #64748b;
}

.history-item > span {
    color: #64748b;
    font-size: 12px;
    white-space: nowrap;
}

.ticket-loading {
    padding: 60px 20px;
    text-align: center;
    color: #64748b;
}

@media (max-width: 800px) {

    .ticket-modal-dialog {
        width: 100%;
        max-height: 100vh;
        margin: 0;
        border-radius: 0;
    }

    .ticket-detail-grid,
    .ticket-control-grid {
        grid-template-columns: 1fr;
    }

    .ticket-detail-header {
        flex-direction: column;
    }

    .detail-row {
        grid-template-columns: 1fr;
        gap: 4px;
    }

    .ticket-modal-body {
        padding: 15px;
    }

    .attachment-item,
    .history-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .reply-actions {
        flex-direction: column;
        align-items: stretch;
    }
}
