:root {
    --bg: #f1f5f9;
    --surface: #ffffff;
    --border: #e2e8f0;
    --text: #0f172a;
    --muted: #64748b;
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --sidebar-bg: #0f172a;
    --sidebar-text: #cbd5e1;
    --sidebar-active: #1e293b;
    --radius: 10px;
    --shadow: 0 1px 3px rgba(15, 23, 42, 0.08), 0 1px 2px rgba(15, 23, 42, 0.04);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    font-size: 14px;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

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

.sidebar {
    width: 260px;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.sidebar-brand {
    padding: 20px 22px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-brand h1 {
    font-size: 17px;
    font-weight: 700;
    color: #fff;
    letter-spacing: -0.01em;
}

.sidebar-brand p {
    font-size: 12px;
    color: #94a3b8;
    margin-top: 2px;
}

.sidebar-nav {
    padding: 16px 12px;
    flex: 1;
}

.nav-section {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #64748b;
    padding: 12px 12px 6px;
    font-weight: 600;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    color: var(--sidebar-text);
    font-weight: 500;
    margin-bottom: 4px;
    transition: background 0.15s, color 0.15s;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.07);
    color: #fff;
    text-decoration: none;
}

.nav-link.active {
    background: var(--primary);
    color: #fff;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.user-pill {
    margin-bottom: 12px;
}

.user-pill .name {
    color: #fff;
    font-weight: 600;
    font-size: 13px;
}

.user-pill .meta {
    color: #94a3b8;
    font-size: 12px;
}

.main-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 14px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.topbar h2 {
    font-size: 18px;
    font-weight: 700;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* Bell Notifications */
.notif-wrap {
    position: relative;
}

.notif-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.notif-btn:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
}

.notif-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 19px;
    height: 19px;
    padding: 0 5px;
    border-radius: 999px;
    background: #ef4444;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
}

.notif-dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    width: 340px;
    max-width: calc(100vw - 32px);
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 14px 32px rgba(15, 23, 42, 0.16);
    z-index: 1000;
    overflow: hidden;
}

.notif-dropdown.open {
    display: block;
}

.notif-head {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 13.5px;
    background: #f8fafc;
}

.notif-list {
    max-height: 340px;
    overflow-y: auto;
}

.notif-item {
    display: block;
    padding: 11px 16px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    transition: background 0.12s;
}

.notif-item:hover {
    background: #f8fafc;
    text-decoration: none;
}

.notif-item:last-child {
    border-bottom: none;
}

.notif-item-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 4px;
}

.notif-time {
    font-size: 11px;
    color: var(--muted);
}

.notif-item-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 2px;
}

.notif-item-meta {
    font-size: 11.5px;
    color: var(--muted);
}

.notif-empty {
    padding: 24px 16px;
    text-align: center;
    color: var(--muted);
    font-size: 13px;
}

.notif-foot {
    padding: 10px 16px;
    border-top: 1px solid var(--border);
    text-align: center;
    background: #f8fafc;
    font-size: 12.5px;
    font-weight: 600;
}

.content {
    padding: 24px 28px 40px;
    max-width: 1280px;
    width: 100%;
}

/* Announcement Banners */
.banner-stack {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.announcement-banner {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    padding: 14px 18px;
    border-radius: var(--radius);
    border-left: 4px solid;
    box-shadow: var(--shadow);
}

.announcement-banner.type-info {
    background: #eff6ff;
    border-color: #2563eb;
    color: #1e3a8a;
}

.announcement-banner.type-success {
    background: #ecfdf5;
    border-color: #10b981;
    color: #065f46;
}

.announcement-banner.type-warning {
    background: #fffbeb;
    border-color: #f59e0b;
    color: #92400e;
}

.announcement-banner.type-danger {
    background: #fef2f2;
    border-color: #ef4444;
    color: #991b1b;
}

.announcement-banner .banner-title {
    font-weight: 700;
    font-size: 14px;
    margin-bottom: 3px;
}

.announcement-banner .banner-msg {
    font-size: 13px;
    white-space: pre-line;
}

.banner-close {
    background: transparent;
    border: none;
    color: inherit;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    opacity: 0.65;
    padding: 2px 6px;
}
.banner-close:hover { opacity: 1; }

/* Flash Alerts */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 18px;
    font-size: 13.5px;
    border: 1px solid transparent;
}
.alert-success { background: #ecfdf5; color: #065f46; border-color: #a7f3d0; }
.alert-danger  { background: #fef2f2; color: #991b1b; border-color: #fecaca; }
.alert-warning { background: #fffbeb; color: #92400e; border-color: #fde68a; }
.alert-info    { background: #eff6ff; color: #1e40af; border-color: #bfdbfe; }

/* Cards & Grid */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.card-header h3 {
    font-size: 15px;
    font-weight: 700;
}

.card-body {
    padding: 20px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(175px, 1fr));
    gap: 14px;
    margin-bottom: 22px;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 18px;
    box-shadow: var(--shadow);
    display: block;
    color: var(--text);
    transition: transform 0.12s, border-color 0.12s;
}

.stat-card:hover {
    transform: translateY(-2px);
    border-color: var(--primary);
    text-decoration: none;
}

.stat-label {
    font-size: 12px;
    color: var(--muted);
    font-weight: 600;
    margin-bottom: 6px;
}

.stat-value {
    font-size: 26px;
    font-weight: 800;
    line-height: 1.1;
}

.stat-sub {
    font-size: 11.5px;
    color: var(--muted);
    margin-top: 6px;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 600;
    white-space: nowrap;
}
.badge-blue    { background: #dbeafe; color: #1d4ed8; }
.badge-slate   { background: #e2e8f0; color: #334155; }
.badge-indigo  { background: #e0e7ff; color: #4338ca; }
.badge-amber   { background: #fef3c7; color: #b45309; }
.badge-red     { background: #fee2e2; color: #b91c1c; }
.badge-emerald { background: #d1fae5; color: #047857; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 8px;
    border: 1px solid transparent;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: #fff; color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: #f8fafc; }
.btn-danger { background: #dc2626; color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-success { background: #059669; color: #fff; }
.btn-success:hover { background: #047857; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-block { width: 100%; }

/* Tables */
.table-wrap { overflow-x: auto; }
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}
th, td {
    padding: 11px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}
th {
    background: #f8fafc;
    font-weight: 600;
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
tbody tr:hover { background: #f8fafc; }

/* Forms */
.form-group { margin-bottom: 16px; }
.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    font-size: 13px;
}
.form-control {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    background: #fff;
}
.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}
.form-hint {
    font-size: 12px;
    color: var(--muted);
    margin-top: 4px;
}
.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

.filter-bar {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}
.filter-bar .form-control { width: auto; min-width: 190px; }

/* Detail & Timeline */
.detail-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
}
.meta-list {
    display: grid;
    grid-template-columns: 160px 1fr;
    gap: 10px 16px;
    font-size: 13.5px;
}
.meta-list dt { color: var(--muted); font-weight: 600; }

.timeline { list-style: none; }
.timeline li {
    position: relative;
    padding-left: 20px;
    padding-bottom: 16px;
    border-left: 2px solid var(--border);
}
.timeline li:last-child { border-left-color: transparent; padding-bottom: 0; }
.timeline li::before {
    content: "";
    position: absolute;
    left: -6px;
    top: 4px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--primary);
}
.timeline-time { font-size: 11.5px; color: var(--muted); }

/* Auth Page */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 100%);
}
.auth-card {
    width: 100%;
    max-width: 420px;
    background: #fff;
    border-radius: 14px;
    padding: 32px;
    box-shadow: 0 20px 40px rgba(15, 23, 42, 0.28);
}
.auth-header { text-align: center; margin-bottom: 24px; }
.auth-header h1 { font-size: 22px; font-weight: 800; color: var(--text); }
.auth-header p { font-size: 13px; color: var(--muted); margin-top: 4px; }

.inline-form { display: inline; }
.empty-state {
    text-align: center;
    padding: 36px 20px;
    color: var(--muted);
}

@media (max-width: 900px) {
    .app-shell { flex-direction: column; }
    .sidebar { width: 100%; }
    .detail-grid { grid-template-columns: 1fr; }
    .content { padding: 18px; }
}
