* {
    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;
}

.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;
}

.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: 16px;
}

.filter-bar a {
    padding: 6px 12px;
    border-radius: 999px;
    background: #e2e8f0;
    color: #1f2933;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.filter-bar a.active {
    background: #1f4db6;
    color: #fff;
}

.badge-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 6px;
    background: #0f172a;
    color: #fff;
    border-radius: 999px;
    font-size: 11px;
    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: 10px;
    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;
}

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

.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;
}

.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;
}

.auth-card {
    background: #fff;
    padding: 32px;
    border-radius: 12px;
    width: 360px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
}

.auth-card h1 {
    margin-top: 0;
}

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

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

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

.pagination {
    margin-top: 16px;
}

@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 .link-button {
    display: none;
}

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

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

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

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

    .app-content {
        padding: 20px;
    }
}

