:root {
    --c-bg: #f3f6f8;
    --c-surface: #ffffff;
    --c-border: #dde4ea;
    --c-text: #1f2d3a;
    --c-muted: #6b7c8b;
    --c-primary: #1b6b7a;
    --c-primary-dark: #124e5a;
    --c-sidebar: #12303a;
    --c-sidebar-text: #c6d7de;
    --c-danger-bg: #fdecec;
    --c-danger: #a32a2a;
    --radius: 8px;
    --sidebar-w: 260px;
    --shadow: 0 1px 3px rgba(18, 48, 58, .08);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
    font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    background: var(--c-bg);
    color: var(--c-text);
}
h1, h2, h3 { line-height: 1.25; margin: 0; }

/* Layout */
.app { display: flex; min-height: 100vh; }
.sidebar {
    width: var(--sidebar-w); flex: 0 0 var(--sidebar-w);
    background: var(--c-sidebar); color: var(--c-sidebar-text);
    display: flex; flex-direction: column;
    position: sticky; top: 0; height: 100vh;
}
.sidebar__brand { display: flex; align-items: center; gap: .6rem; padding: 1.25rem 1.25rem 1rem; color: #fff; font-size: 1.2rem; font-weight: 600; }
.brand-mark { color: #5fc1d1; font-size: 1.5rem; }
.brand-name small { font-weight: 400; opacity: .7; }
.sidebar__nav { flex: 1; padding: .5rem 0; overflow-y: auto; }
.sidebar__nav ul { list-style: none; margin: 0; padding: 0; }
.sidebar__nav a {
    display: flex; align-items: center; gap: .75rem;
    padding: .8rem 1.25rem; color: inherit; text-decoration: none;
    border-left: 3px solid transparent;
}
.sidebar__nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.sidebar__nav a.is-active { background: rgba(95, 193, 209, .14); color: #fff; border-left-color: #5fc1d1; }
.nav-icon { width: 1.4rem; text-align: center; opacity: .85; }
.sidebar__footer { padding: 1rem 1.25rem; font-size: .8rem; opacity: .6; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
    display: flex; align-items: center; gap: 1rem;
    padding: .75rem 1.5rem; background: var(--c-surface);
    border-bottom: 1px solid var(--c-border); position: sticky; top: 0; z-index: 10;
}
.topbar__title { font-size: 1.15rem; flex: 1; }
.topbar__toggle { display: none; background: none; border: 0; font-size: 1.5rem; cursor: pointer; color: var(--c-text); }
.topbar__user { display: flex; align-items: center; gap: .75rem; }
.topbar__user form { margin: 0; }
.user-chip { display: flex; align-items: center; gap: .6rem; }
.user-avatar {
    width: 36px; height: 36px; border-radius: 50%;
    background: var(--c-primary); color: #fff;
    display: grid; place-items: center; font-weight: 600;
}
.user-meta { display: flex; flex-direction: column; line-height: 1.2; }
.user-meta small { color: var(--c-muted); }
.content { flex: 1; padding: 1.5rem; display: grid; gap: 1.5rem; align-content: start; }
.footer { padding: 1rem 1.5rem; color: var(--c-muted); font-size: .85rem; border-top: 1px solid var(--c-border); }

/* Cards & metrics */
.card { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius); padding: 1.25rem; box-shadow: var(--shadow); }
.card__title { font-size: 1.1rem; margin-bottom: .5rem; }
.grid-metrics { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.metric__label { font-size: .85rem; font-weight: 600; color: var(--c-muted); text-transform: uppercase; letter-spacing: .03em; }
.metric__value { font-size: 1.8rem; font-weight: 700; margin: .35rem 0 .1rem; color: var(--c-primary-dark); }
.metric__hint { margin: 0; font-size: .85rem; color: var(--c-muted); }
.empty-state p { color: var(--c-muted); }

/* Buttons & forms */
.btn {
    display: inline-block; padding: .6rem 1.1rem; border: 1px solid var(--c-primary);
    background: var(--c-primary); color: #fff; border-radius: 6px;
    font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
}
.btn:hover { background: var(--c-primary-dark); }
.btn--ghost { background: transparent; color: var(--c-primary); }
.btn--ghost:hover { background: rgba(27, 107, 122, .08); }
.btn--block { width: 100%; }
.field { margin-bottom: 1rem; }
.field label { display: block; margin-bottom: .3rem; font-weight: 600; font-size: .9rem; }
.field input {
    width: 100%; padding: .65rem .75rem; border: 1px solid var(--c-border);
    border-radius: 6px; font: inherit; background: #fff;
}
.field input:focus { outline: 2px solid rgba(27, 107, 122, .35); border-color: var(--c-primary); }
.alert { padding: .75rem 1rem; border-radius: 6px; margin-bottom: 1rem; font-size: .9rem; }
.alert--ok { background: #e8f5ee; color: #1d6b3f; border: 1px solid #b9e0c9; }
.alert--error { background: var(--c-danger-bg); color: var(--c-danger); border: 1px solid #f3c5c5; }

/* Login */
.login-body { display: grid; place-items: center; min-height: 100vh; padding: 1rem;
    background: linear-gradient(135deg, #12303a 0%, #1b6b7a 100%); }
.login-card { width: 100%; max-width: 400px; background: #fff; padding: 2rem; border-radius: 12px; box-shadow: 0 10px 40px rgba(0, 0, 0, .25); }
.login-brand { text-align: center; margin-bottom: 1.5rem; }
.login-brand .brand-mark { font-size: 2.2rem; }
.login-brand h1 { font-size: 1.6rem; }
.login-brand h1 small { font-weight: 400; color: var(--c-muted); }
.login-brand p { color: var(--c-muted); margin: .25rem 0 0; }

/* Modal */
.modal[hidden] { display: none; }
.modal { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 1rem; }
.modal__backdrop { position: absolute; inset: 0; background: rgba(18, 48, 58, .55); }
.modal__dialog { position: relative; background: #fff; border-radius: 10px; width: 100%; max-width: 520px; max-height: 90vh; overflow: auto; box-shadow: 0 20px 50px rgba(0, 0, 0, .3); }
.modal__header { display: flex; justify-content: space-between; align-items: center; padding: 1rem 1.25rem; border-bottom: 1px solid var(--c-border); }
.modal__header h2 { font-size: 1.1rem; }
.modal__close { background: none; border: 0; font-size: 1.6rem; line-height: 1; cursor: pointer; color: var(--c-muted); }
.modal__body { padding: 1.25rem; }

/* Responsive */
@media (max-width: 860px) {
    .sidebar { position: fixed; left: 0; top: 0; z-index: 50; transform: translateX(-100%); transition: transform .2s; }
    .sidebar.is-open { transform: none; }
    .topbar__toggle { display: block; }
    .user-meta { display: none; }
    .content { padding: 1rem; }
}
