* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    background: #f5f6f8;
    color: #1f2933;
}

a {
    color: #1f4db6;
    text-decoration: none;
}

.app-shell {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 240px;
    background: #0f172a;
    color: #e2e8f0;
    padding: 20px 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    transition: width 0.2s ease;
    align-items: stretch;
    position: sticky;
    top: 0;
    height: 100vh;
    align-self: flex-start;
    overflow-y: auto;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: flex-start;
}

.sidebar-toggle {
    background: #1e293b;
    color: #e2e8f0;
    border: none;
    border-radius: 8px;
    padding: 8px 10px;
    cursor: pointer;
    font-weight: 700;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 10px;
    color: #e2e8f0;
    font-weight: 600;
    transition: background 0.15s ease;
    justify-content: flex-start;
}

.sidebar-nav a:hover {
    background: #1e293b;
}

.sidebar-footer {
    margin-top: auto;
}

.sidebar-footer .link-button {
    background: #1e293b;
    color: #e2e8f0;
    border: none;
    border-radius: 10px;
    padding: 10px 12px;
    width: 100%;
    text-align: left;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
}

.logout-icon {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: #0f172a;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #e2e8f0;
    flex-shrink: 0;
}

.logout-icon svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    stroke-width: 1.8;
    fill: none;
}

.logout-label {
    white-space: nowrap;
}

.app-title {
    font-weight: 700;
    font-size: 16px;
    color: #e2e8f0;
}

.app-content {
    padding: 24px;
    flex: 1;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
}

.stat-card,
.card,
.form-card,
.table-card {
    background: #fff;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
}

.stat-label {
    color: #6b7280;
    font-size: 13px;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
}

.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 12px;
}

.filter-bar a {
    padding: 10px 14px;
    border-radius: 999px;
    background: #e5eaf3;
    color: #111827;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    border: 1px solid transparent;
    transition: all 0.15s ease;
}

.filter-bar a.active {
    background: #1f4db6;
    color: #fff;
    border-color: #1f4db6;
    box-shadow: 0 10px 20px rgba(31, 77, 182, 0.2);
}

.filter-panel {
    display: flex;
    align-items: flex-end;
    gap: 16px;
    padding: 12px 16px;
    margin-bottom: 18px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}

.filter-input {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    background: #f8fafc;
    border: 1px solid #d9dde3;
    border-radius: 12px;
    padding: 0 12px;
    color: #0f172a;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
    height: 42px;
}

.filter-input svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    stroke-width: 1.6;
    fill: none;
    color: #6b7280;
}

.filter-panel input,
.filter-panel select {
    background: transparent;
    border: none;
    color: #0f172a;
    padding: 0;
    height: 100%;
    box-shadow: none;
}

.filter-input input {
    flex: 1;
    width: 100%;
}

.filter-panel input::placeholder {
    color: #9ca3af;
}

.filter-panel select {
    background: #f8fafc;
    border: 1px solid #d9dde3;
    border-radius: 10px;
    padding: 10px 12px;
    width: auto;
    min-width: 140px;
    height: 42px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.filter-input:focus-within,
.filter-panel select:focus {
    border-color: #1f4db6;
    box-shadow: 0 0 0 3px rgba(31, 77, 182, 0.12);
    background: #eef2ff;
}

.filter-panel input:focus {
    outline: none;
}

.filter-select {
    display: flex;
    flex-direction: column;
    gap: 8px;
    color: #1f2937;
    align-self: flex-end;
}

.filter-select label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.filter-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 8px;
    align-self: flex-end;
}

.filter-actions .primary {
    height: 42px;
    display: inline-flex;
    align-items: center;
}

.filter-actions .ghost {
    height: 42px;
    display: inline-flex;
    align-items: center;
}

.ghost {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 12px;
    border-radius: 10px;
    color: #1f2937;
    border: 1px solid #d9dde3;
    background: #f8fafc;
    text-decoration: none;
    font-weight: 600;
    transition: border-color 0.15s ease, background 0.15s ease, transform 0.1s ease;
    height: 42px;
}

.ghost:hover {
    border-color: #cbd5e1;
    background: #eef2f7;
}

.ghost:active,
.primary:active {
    transform: translateY(1px);
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.badge-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 22px;
    padding: 0 8px;
    background: #0f172a;
    color: #fff;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 12px 8px;
    border-bottom: 1px solid #e5e7eb;
    text-align: left;
}

.form label {
    display: block;
    margin-bottom: 12px;
    font-weight: 600;
}

input,
textarea,
select {
    width: 100%;
    padding: 12px;
    margin-top: 6px;
    border-radius: 8px;
    border: 1px solid #cbd5e1;
    background: #fff;
    font-size: 14px;
    min-width: 140px;
}

.primary,
.danger {
    display: inline-block;
    padding: 10px 16px;
    border-radius: 8px;
    border: none;
    font-weight: 600;
    cursor: pointer;
}

.primary {
    background: #1f4db6;
    color: #fff;
    transition: background 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
    box-shadow: 0 10px 20px rgba(31, 77, 182, 0.22);
}

.danger {
    background: #dc2626;
    color: #fff;
}

.primary:hover {
    background: #2f5ed4;
    box-shadow: 0 12px 22px rgba(31, 77, 182, 0.3);
}

.auth-card .primary {
    border-radius: 12px;
    padding: 12px 18px;
    font-weight: 700;
    height: 46px;
}

.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
}

.alert.success {
    background: #dcfce7;
    color: #166534;
}

.alert.error {
    background: #fee2e2;
    color: #991b1b;
}

.ticket-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: 2fr 1fr;
    align-items: stretch;
}

.ticket-meta dt {
    font-weight: 700;
    margin-top: 12px;
}

.ticket-meta dd {
    margin: 4px 0 0 0;
    color: #4b5563;
}

.reply {
    border-top: 1px solid #e5e7eb;
    padding-top: 12px;
    margin-top: 12px;
}

.reply-meta {
    display: flex;
    gap: 12px;
    font-size: 13px;
    color: #6b7280;
}

.badge {
    background: #e0e7ff;
    color: #3730a3;
    padding: 2px 8px;
    border-radius: 999px;
    font-weight: 600;
}

.status-pill {
    background: #0ea5e9;
    color: #fff;
    padding: 4px 10px;
    border-radius: 999px;
    font-weight: 700;
    font-size: 12px;
}

.auth-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: #f5f6f8;
}

.auth-card {
    background: #fff;
    padding: 42px 46px;
    border-radius: 16px;
    width: 420px;
    max-width: 90vw;
    box-shadow: 0 18px 38px rgba(31, 77, 182, 0.12), 0 10px 24px rgba(15, 23, 42, 0.08);
}

.auth-card h1 {
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 32px;
    text-align: center;
}

.auth-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
}

.auth-logo {
    width: 96px;
    height: 96px;
    object-fit: contain;
}

.auth-subtitle {
    font-weight: 700;
    color: #1f2937;
    font-size: 25px;
    letter-spacing: 0.01em;
    text-align: center;
}

.auth-remember {
    display: flex;
    flex-direction: row;
    gap: 8px;
    align-items: center;
    margin-top: 4px;
}

.auth-heading {
    font-weight: 800;
}

.auth-subheading {
    text-align: center;
    margin: 0 0 24px;
    color: #4b5563;
    font-size: 15px;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.input-label {
    font-weight: 700;
    color: #111827;
    margin-bottom: 6px;
}

.input-group {
    display: flex;
    align-items: center;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.input-icon {
    width: 46px;
    height: 46px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.03);
    color: #6b7280;
    border-right: 1px solid #cbd5e1;
}

.input-icon svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    stroke-width: 1.6;
    fill: none;
}

.input-group input {
    border: none;
    padding: 12px 14px;
    background: transparent;
    box-shadow: none;
    flex: 1;
    margin: 0;
    min-width: 0;
    border-radius: 0;
}

.input-group input:focus {
    outline: none;
}

.input-group:focus-within {
    border-color: #1f4db6;
    box-shadow: 0 0 0 3px rgba(31, 77, 182, 0.12);
}

.auth-card input[type="text"],
.auth-card input[type="password"] {
    background: #fff;
    border: 1px solid #cbd5e1;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.auth-card .input-group input[type="text"],
.auth-card .input-group input[type="password"] {
    border: none;
    background: transparent;
    box-shadow: none;
}

.auth-submit {
    width: 100%;
    justify-content: center;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-top: 4px;
}

.auth-remember {
    justify-content: flex-start;
    margin-top: 0;
}

.auth-remember input {
    margin-right: 8px;
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-icon svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
}

.checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
}

.checkbox input {
    width: 18px;
    height: 18px;
    margin: 0;
    padding: 0;
    min-width: 0;
    flex: 0 0 auto;
}

.checkbox-inline {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 0;
    justify-content: flex-start;
}

.checkbox-row {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    margin-top: 6px;
}

.checkbox-inline input {
    width: 18px;
    height: 18px;
    margin: 0;
    padding: 0;
    min-width: 0;
    flex: 0 0 auto;
}

.checkbox-inline__label {
    font-weight: 600;
    color: #1f2937;
}

/* Align checkbox + button on the same row in forms */
.form-footer {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 10px;
}

.form-footer .primary {
    margin-left: auto;
}

@media (max-width: 640px) {
    .checkbox-inline {
        width: 100%;
    }

    .form-footer {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .form-footer .primary {
        margin-left: 0;
        width: 100%;
        text-align: center;
    }
}

.hint {
    margin: 12px 0;
    color: #6b7280;
    font-size: 13px;
}

.muted {
    color: #6b7280;
    font-size: 13px;
}

.pagination {
    margin-top: 20px;
}

.pager-shell {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px 16px;
    background: #fff;
    padding: 14px 16px;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
}

.pager-info {
    color: #4b5563;
    font-size: 13px;
    font-weight: 600;
}

.pager-nav {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.pager-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 12px;
    border-radius: 10px;
    background: #eef2ff;
    color: #1f2937;
    border: 1px solid #cbd5e1;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.15s ease;
}

.pager-btn:hover {
    background: #e0e7ff;
    border-color: #b6c2d3;
}

.pager-btn.disabled {
    color: #94a3b8;
    background: #f8fafc;
    border-color: #e2e8f0;
    cursor: not-allowed;
    box-shadow: none;
}

.pager-pages {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.pager-page {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: #1f2937;
    border: 1px solid #d4d9e6;
    background: #fff;
    text-decoration: none;
    box-shadow: 0 4px 10px rgba(15, 23, 42, 0.05);
    transition: all 0.15s ease;
}

.pager-page:hover {
    border-color: #1f4db6;
    color: #1f4db6;
}

.pager-page.is-active {
    background: #1f4db6;
    color: #fff;
    border-color: #1f4db6;
    box-shadow: 0 8px 18px rgba(31, 77, 182, 0.25);
}

.pager-ellipsis {
    color: #94a3b8;
    font-weight: 700;
    padding: 0 4px;
}

@media (max-width: 640px) {
    .filter-panel {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-actions {
        width: 100%;
        justify-content: flex-end;
    }

    .pager-shell {
        justify-content: center;
        text-align: center;
    }

    .pager-info {
        width: 100%;
    }

    .pager-nav {
        width: 100%;
        justify-content: center;
    }
}

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

.input-stack {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.input-stack input {
    width: 120px;
}

.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
    margin-bottom: 12px;
}

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


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

.app-logo-link {
    display: inline-flex;
    align-items: center;
}

.app-logo {
    width: 36px;
    height: 36px;
    object-fit: contain;
}

.nav-label {
    white-space: nowrap;
}

.nav-icon {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: #1e293b;
    color: #e2e8f0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.nav-icon svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    stroke-width: 1.8;
    fill: none;
}

.sidebar-collapsed .sidebar {
    width: 72px;
}

.sidebar-collapsed .app-title,
.sidebar-collapsed .nav-label,
.sidebar-collapsed .sidebar-footer .logout-label {
    display: none;
}

.sidebar-collapsed .app-logo-link {
    display: none;
}

.sidebar-collapsed .sidebar-nav {
    align-items: center;
}

.sidebar-collapsed .sidebar-footer {
    display: flex;
    justify-content: center;
}

.sidebar-collapsed .sidebar-footer .link-button {
    width: 44px;
    height: 44px;
    padding: 0;
    justify-content: center;
    text-align: center;
}

@media (max-width: 900px) {
    .sidebar {
        position: fixed;
        z-index: 20;
        height: 100vh;
        left: 0;
        top: 0;
        transform: translateX(0);
        width: 240px;
    }

    .sidebar-collapsed .sidebar {
        transform: translateX(-100%);
    }

    /* Fixed Mobile Toggle Button - Always visible when sidebar is collapsed */
    /* Fixed Mobile Toggle Button - Always visible when sidebar is collapsed */
    .sidebar-toggle.mobile-visible {
        position: fixed;
        top: 15px;
        left: 15px;
        z-index: 9999;
        display: none;
        background: #1f4db6;
        color: white;
        padding: 12px 16px;
        border-radius: 8px;
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
        border: 2px solid #fff;
        cursor: pointer;
        font-size: 24px;
        line-height: 1;
    }

    /* Force display when collapsed */
    .sidebar-collapsed .sidebar-toggle.mobile-visible {
        display: block !important;
    }

    .app-content {
        padding: 20px;
        margin-left: 0;
        margin-top: 40px;
        /* Space for the toggle button */
    }
}
