:root {
    --primary: #0e7490;
    --primary-dark: #0b5b73;
    --primary-light: #e3f4f8;
    --ink: #0f172a;
    --bg: #f4f7f9;
    --surface: #ffffff;
    --surface-alt: #f8fafc;
    --border: #e4e9ee;
    --text: #1e293b;
    --muted: #64748b;
    --danger: #dc2626;
    --danger-dark: #b91c1c;
    --danger-light: #fdeceb;
    --success: #15803d;
    --success-light: #e8f6ee;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06);
    --shadow-md: 0 4px 16px rgba(15, 23, 42, .07), 0 1px 3px rgba(15, 23, 42, .05);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: "Inter", "Segoe UI", Calibri, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

.mono { font-variant-numeric: tabular-nums; letter-spacing: .01em; }

/* ---------- Topbar ---------- */

.topbar {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: #fff;
    padding: 0 28px;
    height: 62px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 0;
    z-index: 20;
}

.topbar-brand {
    display: flex;
    align-items: center;
    gap: 11px;
    color: #fff;
    text-decoration: none;
}

.topbar-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 9px;
    background: rgba(255, 255, 255, .16);
}

.topbar-brand strong {
    display: block;
    font-size: 14.5px;
    font-weight: 700;
    letter-spacing: .02em;
}

.topbar-brand small {
    display: block;
    font-size: 11.5px;
    font-weight: 500;
    color: rgba(255, 255, 255, .78);
}

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

.topbar-username {
    font-size: 13.5px;
    font-weight: 600;
    color: rgba(255, 255, 255, .95);
}

.topbar-link {
    color: rgba(255, 255, 255, .82);
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 500;
    transition: color .15s;
}

.topbar-link:hover { color: #fff; }

/* ---------- Layout ---------- */

.container {
    max-width: 1120px;
    margin: 28px auto;
    padding: 0 20px 64px;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 26px 28px;
    margin-bottom: 22px;
    box-shadow: var(--shadow-sm);
}

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

.page-header h2 {
    margin: 0;
    font-size: 19px;
    font-weight: 700;
    letter-spacing: -.01em;
}

.eyebrow {
    display: block;
    font-size: 11.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--muted);
    margin-bottom: 3px;
}

.section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    font-weight: 700;
    margin: 28px 0 4px;
    color: var(--ink);
}

.section-title .icon { color: var(--primary); }

/* ---------- Stat cards ---------- */

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

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 20px;
    display: flex;
    align-items: center;
    gap: 14px;
    box-shadow: var(--shadow-sm);
}

.stat-icon {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    background: var(--primary-light);
    color: var(--primary-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon .icon { width: 20px; height: 20px; }

.stat-value {
    font-size: 21px;
    font-weight: 800;
    letter-spacing: -.01em;
    color: var(--ink);
    line-height: 1.15;
}

.stat-label {
    font-size: 12.5px;
    color: var(--muted);
    font-weight: 500;
    margin-top: 1px;
}

/* ---------- Buttons ---------- */

.icon { display: inline-block; vertical-align: -3px; }

.btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--primary);
    background: var(--primary);
    color: #fff;
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: background .15s, border-color .15s, transform .1s;
}

.btn:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn:active { transform: translateY(1px); }
.btn.block { width: 100%; justify-content: center; padding: 11px 16px; }

.btn.secondary {
    background: var(--surface);
    color: var(--text);
    border-color: var(--border);
}
.btn.secondary:hover { background: var(--surface-alt); border-color: #cbd5e1; }

.btn.danger {
    background: var(--danger);
    border-color: var(--danger);
}
.btn.danger:hover { background: var(--danger-dark); border-color: var(--danger-dark); }

.btn.small { padding: 6px 12px; font-size: 12.5px; }

.btn-row { display: flex; gap: 9px; flex-wrap: wrap; align-items: center; }
.btn-row form { margin: 0; }

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--muted);
    cursor: pointer;
    text-decoration: none;
    transition: background .15s, color .15s, border-color .15s;
}
.icon-btn:hover { background: var(--primary-light); color: var(--primary-dark); border-color: var(--primary-light); }
.icon-btn.danger:hover { background: var(--danger-light); color: var(--danger-dark); border-color: var(--danger-light); }

/* ---------- Tables ---------- */

.table-scroll { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }

th, td {
    text-align: left;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}

th {
    color: var(--muted);
    font-weight: 600;
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: .05em;
}

tbody tr { transition: background .1s; }
tbody tr:hover { background: var(--surface-alt); }
tbody tr:last-child td { border-bottom: none; }

.empty-state {
    text-align: center;
    padding: 56px 20px;
    color: var(--muted);
}
.empty-state .icon { width: 40px; height: 40px; color: #cbd5e1; margin-bottom: 10px; }
.empty-state p { margin: 0; font-size: 14px; }

.search-bar { margin-bottom: 18px; position: relative; max-width: 360px; }
.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted);
    display: flex;
}
.search-bar input {
    width: 100%;
    padding: 10px 12px 10px 38px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    font-family: inherit;
    background: var(--surface-alt);
    transition: border-color .15s, background .15s;
}
.search-bar input:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--surface);
}

/* ---------- Forms ---------- */

form .form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px 20px;
}

.field { margin-bottom: 4px; }
.field.full { grid-column: 1 / -1; }

.field label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
    color: #334155;
}

.field .hint { font-weight: 400; color: var(--muted); font-size: 12px; }

.field input[type=text],
.field input[type=number],
.field input[type=date],
.field input[type=password],
.field select,
.field textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    font-family: inherit;
    background: var(--surface);
    transition: border-color .15s, box-shadow .15s;
}

.field input:focus, .field textarea:focus, .field select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.field textarea { resize: vertical; min-height: 84px; }

fieldset {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 20px 20px;
    margin: 0 0 18px;
}

legend {
    font-weight: 700;
    padding: 0 8px;
    color: var(--primary-dark);
    font-size: 12.5px;
    text-transform: uppercase;
    letter-spacing: .05em;
}

.file-drop {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    border: 1.5px dashed #cbd5e1;
    border-radius: var(--radius-sm);
    padding: 26px 18px;
    text-align: center;
    color: var(--muted);
    font-size: 13.5px;
    cursor: pointer;
    background: var(--surface-alt);
    transition: border-color .15s, background .15s;
}
.file-drop:hover { border-color: var(--primary); background: var(--primary-light); }
.file-drop .icon { width: 26px; height: 26px; color: var(--primary); margin-bottom: 4px; }
.file-drop span:first-of-type { font-weight: 600; color: var(--text); }
.file-drop input { display: none; }

.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
    margin-top: 12px;
}

.photo-grid .thumb {
    position: relative;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: #fff;
}

.photo-grid .thumb img {
    width: 100%;
    height: 112px;
    object-fit: cover;
    display: block;
}

.photo-grid .thumb .remove-form {
    position: absolute;
    top: 5px;
    right: 5px;
    margin: 0;
}

.photo-grid .thumb .remove {
    background: rgba(15, 23, 42, .55);
    backdrop-filter: blur(2px);
    color: #fff;
    border: none;
    border-radius: 6px;
    width: 24px;
    height: 24px;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    transition: background .15s;
}
.photo-grid .thumb .remove:hover { background: var(--danger); }

.badge {
    display: inline-block;
    background: var(--primary-light);
    color: var(--primary-dark);
    border-radius: 20px;
    padding: 3px 11px;
    font-size: 12px;
    font-weight: 700;
}

.form-actions {
    margin-top: 22px;
    display: flex;
    gap: 10px;
}

.alert {
    padding: 12px 15px;
    border-radius: var(--radius-sm);
    margin-bottom: 18px;
    font-size: 13.5px;
    font-weight: 500;
}
.alert.success { background: var(--success-light); color: var(--success); border: 1px solid #bfe6cd; }
.alert.error { background: var(--danger-light); color: var(--danger-dark); border: 1px solid #f6c9c5; }

.muted { color: var(--muted); }
.text-right { text-align: right; }

/* ---------- Auth pages ---------- */

.auth-body {
    background: radial-gradient(circle at top left, #0e7490 0%, #0b3a4a 55%, #071c26 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.auth-wrap { width: 100%; max-width: 400px; }

.auth-card {
    background: var(--surface);
    border-radius: 16px;
    padding: 34px 32px 30px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, .3);
}

.auth-brand {
    display: flex;
    align-items: center;
    gap: 11px;
    margin-bottom: 22px;
}

.auth-brand-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: var(--primary-light);
    color: var(--primary-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.auth-brand strong { display: block; font-size: 14.5px; font-weight: 800; color: var(--ink); }
.auth-brand span { display: block; font-size: 12px; color: var(--muted); font-weight: 500; }

.auth-card h1 { font-size: 20px; margin: 0 0 6px; letter-spacing: -.01em; }
.auth-sub { color: var(--muted); font-size: 13.5px; margin: 0 0 22px; }

.auth-card form .field { margin-bottom: 16px; }
