/* ── Reset & Base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 14px;
    background: #f0f2f5;
    color: #1a1a2e;
}

/* ── Layout ───────────────────────────────────────────────────────────────── */
.layout {
    display: flex;
    min-height: 100vh;
}

.content {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
}

/* ── Sidebar ──────────────────────────────────────────────────────────────── */
.sidebar {
    width: 220px;
    background: #1a1a2e;
    color: #e0e0e0;
    display: flex;
    flex-direction: column;
    padding: 1.5rem 0;
    flex-shrink: 0;
}

.sidebar .logo {
    font-size: 1.1rem;
    font-weight: 700;
    padding: 0 1.25rem 1.5rem;
    color: #fff;
    border-bottom: 1px solid #2d2d4e;
}

.sidebar ul {
    list-style: none;
    margin-top: 1rem;
}

.sidebar ul li a {
    display: block;
    padding: 0.65rem 1.25rem;
    color: #c0c0d8;
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
    border-radius: 0 6px 6px 0;
    margin-right: 0.5rem;
}

.sidebar ul li a:hover {
    background: #2d2d4e;
    color: #fff;
}

/* ── Headings ─────────────────────────────────────────────────────────────── */
h1 { font-size: 1.6rem; margin-bottom: 1.25rem; color: #1a1a2e; }
h2 { font-size: 1.2rem; margin: 1.5rem 0 0.75rem; color: #2d2d4e; }

/* ── Stats Row ────────────────────────────────────────────────────────────── */
.stats-row {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 2rem;
}

.stat-card {
    background: #fff;
    border-radius: 10px;
    padding: 1.25rem 1.75rem;
    min-width: 140px;
    box-shadow: 0 2px 8px rgba(0,0,0,.07);
    text-align: center;
}

.stat-card h3 {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: #888;
    margin-bottom: 0.5rem;
}

.stat-num {
    font-size: 2rem;
    font-weight: 700;
    color: #1a1a2e;
}

/* ── Table ────────────────────────────────────────────────────────────────── */
.table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,.07);
}

.table th {
    background: #f7f8fa;
    padding: 0.75rem 1rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #666;
    border-bottom: 1px solid #eee;
}

.table td {
    padding: 0.7rem 1rem;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: middle;
}

.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: #fafbff; }

/* ── Badges ───────────────────────────────────────────────────────────────── */
.badge {
    display: inline-block;
    padding: 0.2em 0.65em;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-warning  { background: #fff3cd; color: #856404; }
.badge-info     { background: #cff4fc; color: #055160; }
.badge-success  { background: #d1e7dd; color: #0a3622; }

/* ── Buttons ──────────────────────────────────────────────────────────────── */
button, .btn-primary, .btn-success, .btn-danger, .btn-secondary {
    display: inline-block;
    padding: 0.45rem 1rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    transition: opacity 0.15s;
    margin-right: 0.4rem;
}

button:hover { opacity: 0.85; }

.btn-primary   { background: #4361ee; color: #fff; }
.btn-success   { background: #2dc653; color: #fff; }
.btn-danger    { background: #e63946; color: #fff; }
.btn-secondary { background: #6c757d; color: #fff; }

.btn-group { display: flex; gap: 0.5rem; margin-top: 0.75rem; flex-wrap: wrap; }

/* ── Forms ────────────────────────────────────────────────────────────────── */
.form-group {
    margin-bottom: 0.85rem;
}

.form-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: #555;
    margin-bottom: 0.3rem;
}

.form-control {
    padding: 0.45rem 0.75rem;
    border: 1px solid #d0d5dd;
    border-radius: 6px;
    font-size: 0.875rem;
    width: 100%;
    max-width: 400px;
    outline: none;
    transition: border-color 0.15s;
}

.form-control:focus { border-color: #4361ee; }

.inline-form {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.inline-form .form-control { width: auto; }

/* ── Filters ──────────────────────────────────────────────────────────────── */
.filters {
    margin-bottom: 1rem;
}

.filters select {
    padding: 0.4rem 0.75rem;
    border: 1px solid #d0d5dd;
    border-radius: 6px;
    font-size: 0.875rem;
    background: #fff;
}

/* ── Ticket Details ───────────────────────────────────────────────────────── */
.ticket-details {
    background: #fff;
    border-radius: 10px;
    padding: 1.25rem 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,.07);
    margin-bottom: 1.5rem;
    display: grid;
    grid-template-columns: 160px 1fr;
    gap: 0.5rem 1rem;
}

.ticket-details dt {
    font-weight: 600;
    color: #666;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    padding-top: 0.2rem;
}

.ticket-details dd { color: #1a1a2e; }

/* ── Messages ─────────────────────────────────────────────────────────────── */
.success {
    margin-top: 0.75rem;
    padding: 0.6rem 1rem;
    background: #d1e7dd;
    color: #0a3622;
    border-radius: 6px;
    font-size: 0.875rem;
}

.error {
    margin-top: 0.5rem;
    padding: 0.6rem 1rem;
    background: #f8d7da;
    color: #842029;
    border-radius: 6px;
    font-size: 0.875rem;
}

/* ── Login Page ───────────────────────────────────────────────────────────── */
.login-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: #f0f2f5;
}

.login-card {
    background: #fff;
    border-radius: 12px;
    padding: 2.5rem 2rem;
    width: 360px;
    box-shadow: 0 4px 24px rgba(0,0,0,.1);
}

.login-card h2 {
    margin-bottom: 1.5rem;
    font-size: 1.3rem;
    text-align: center;
}

.login-card .form-control { max-width: 100%; }
.login-card .btn-primary  { width: 100%; margin-top: 0.5rem; padding: 0.6rem; }

/* ── Links ────────────────────────────────────────────────────────────────── */
a { color: #4361ee; text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Scrollbar ────────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #ccc; border-radius: 3px; }

/* ── Error banner ─────────────────────────────────────────────────────────── */
.alert-error {
    background: #fff0f0;
    border: 1px solid #f5c2c2;
    border-left: 4px solid #e53935;
    border-radius: 6px;
    padding: 0.85rem 1.1rem;
    margin-bottom: 1.25rem;
    color: #7b1a1a;
    line-height: 1.6;
}
.alert-error strong { color: #c62828; }
.alert-error small  { color: #a04040; font-size: 0.82rem; }
