@import url('https://fonts.googleapis.com/css2?family=Source+Sans+3:wght@400;500;600;700;800&display=swap');

:root {
    --bg: #f3f5f8;
    --panel: #ffffff;
    --ink: #1c2430;
    --muted: #7b8494;
    --line: #e8edf3;
    --green: #16a34a;
    --green-2: #22c55e;
    --green-soft: #e8f8ee;
    --gold: var(--green);
    --gold-2: var(--green-2);
    --navy: #163024;
    --ok: #16a34a;
    --err: #dc4c3f;
    --in: #16a34a;
    --out: #f59e0b;
    --shadow: 0 10px 30px rgba(28, 36, 48, 0.06);
}

* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: "Source Sans 3", "Noto Sans", "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--ink);
}

a { color: inherit; }
img { max-width: 100%; }

.admin-body { min-height: 100vh; }

.auth-body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    padding: 24px 16px;
    background: linear-gradient(180deg, #f3f5f8, #e8f8ee);
}

.auth-card {
    width: min(460px, calc(100% - 32px));
    background: var(--panel);
    border-radius: 28px;
    padding: 32px;
    box-shadow: var(--shadow);
}
.auth-card form .btn { width: 100%; margin-top: 8px; }
.auth-card form .check { margin-bottom: 18px; }

.brand, .side-brand {
    display: flex;
    gap: 10px;
    align-items: center;
}

.side-brand {
    margin-bottom: 28px;
    flex-direction: column;
    align-items: flex-start;
}
.brand { margin-bottom: 22px; }
.brand-auth {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 8px;
}

.brand-logo-link { display: block; width: 100%; }
.brand-logo {
    display: block;
    width: auto;
    height: auto;
    max-width: 100%;
}
.brand-logo-sidebar { width: 100%; }
.brand-logo-auth { width: min(320px, 100%); }

.brand-mark, .mark {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    background: linear-gradient(160deg, var(--green-2), var(--green));
    color: #fff;
    font-weight: 800;
}

.side-brand strong, .brand strong { display: block; font-size: 18px; }
.side-brand small, .brand small, .muted, .table-meta { color: var(--muted); }
.side-brand small, .brand-auth small {
    display: block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
[hidden] { display: none !important; }

.app {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 18px;
    padding: 18px;
}

.sidebar {
    background: var(--panel);
    color: var(--ink);
    padding: 22px 16px;
    display: flex;
    flex-direction: column;
    border-radius: 28px;
    box-shadow: var(--shadow);
}

.nav-label {
    margin: 18px 12px 8px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #9aa3b2;
}

.nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: #5b6573;
    padding: 11px 12px;
    border-radius: 14px;
    margin-bottom: 4px;
    font-weight: 600;
}

.nav svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex: 0 0 18px;
}

.nav a.active, .nav a:hover {
    background: var(--green-soft);
    color: var(--green);
}

.shell {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 18px;
    min-height: calc(100vh - 36px);
}

.topbar {
    background: var(--panel);
    border-radius: 24px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    box-shadow: var(--shadow);
}

.top-search {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    background: #f5f7fa;
    border-radius: 16px;
    padding: 0 14px;
}

.top-search svg {
    width: 18px;
    height: 18px;
    stroke: #8b93a1;
    fill: none;
    stroke-width: 1.8;
}

.top-search input {
    border: 0;
    background: transparent;
    margin: 0;
    padding: 12px 0;
}

.top-search input:focus { outline: none; }
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.top-user {
    display: flex;
    align-items: center;
    gap: 10px;
    white-space: nowrap;
}

.top-user strong, .top-user small { display: block; }
.top-user small { color: var(--muted); font-size: 12px; }

.avatar-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--green-soft);
    color: var(--green);
    font-weight: 800;
    font-size: 13px;
}

.content { padding: 6px 4px 20px; }
.page-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 22px;
}

h1, h2, h3 { margin: 0 0 8px; font-weight: 800; }
h1 { font-size: 32px; letter-spacing: -0.03em; }
h2 { font-size: 20px; }

.cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 22px;
}

.card, .panel, table, form.box {
    background: var(--panel);
    border: 0;
    border-radius: 24px;
    box-shadow: var(--shadow);
}

.card, .panel, form.box { padding: 20px; }
.card {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: start;
}
.card strong { font-size: 32px; display: block; letter-spacing: -0.04em; }
.card span { color: var(--muted); font-size: 13px; font-weight: 600; grid-column: 1; }
.card-icon {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    background: var(--green-soft);
    color: var(--green);
    grid-column: 2;
    grid-row: 1 / span 2;
}
.card-icon svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.table-wrap {
    overflow: auto;
    background: var(--panel);
    border-radius: 24px;
    box-shadow: var(--shadow);
}
table { width: 100%; border-collapse: collapse; overflow: hidden; box-shadow: none; }
th, td { padding: 14px 16px; text-align: left; border-bottom: 1px solid var(--line); font-size: 14px; }
th { color: var(--muted); font-weight: 700; background: #f8fafc; }

.btn, button.btn, input[type="submit"] {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 0;
    border-radius: 14px;
    padding: 10px 14px;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
}

.btn-primary { background: var(--green); color: #fff; }
.btn-ghost { background: #f3f5f8; color: var(--ink); }
.btn-danger { background: #fdecea; color: var(--err); }

label { display: block; margin-bottom: 14px; font-weight: 600; }
label small { display: block; font-weight: 500; margin-top: 4px; }
input, select, textarea {
    width: 100%;
    margin-top: 6px;
    padding: 11px 12px;
    border-radius: 14px;
    border: 1px solid var(--line);
    font: inherit;
    background: #fff;
}

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.filters > * { min-width: 140px; flex: 1; }
.punches-filters .check { min-width: auto; flex: 0 0 auto; }
.punches-filters .btn { flex: 0 0 auto; }
.pager {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-top: 16px;
    flex-wrap: wrap;
}
.check { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.check input { width: auto; margin: 0; }

.alert { padding: 12px 14px; border-radius: 16px; }
.alert.success { background: var(--green-soft); color: var(--ok); }
.alert.error { background: #fdecea; color: var(--err); }
.alert.warn { background: #fff7e8; color: #9a5b12; }

.ergani-queue { margin-bottom: 20px; }
.ergani-queue-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 0;
    border-top: 1px solid var(--line);
    flex-wrap: wrap;
}
.ergani-queue-row:first-of-type { border-top: 0; }
.ergani-retry-form {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}
.ergani-retry-form select { min-width: 220px; }
.activity-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
}

.badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
}
.badge.in { background: var(--green-soft); color: var(--in); }
.badge.out { background: #fff7e8; color: var(--out); }
.badge.break { background: #e7f0fb; color: #265b9b; }
.badge.off { background: #eef1f4; color: #666; }

code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.92em; background: #f3f5f8; padding: 1px 5px; border-radius: 6px; }

.who { display: flex; align-items: center; gap: 10px; }
.who .dot {
    width: 10px; height: 10px; border-radius: 50%; background: var(--in);
}

.activity-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.cal-weekdays, .cal {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 8px;
}
.cal-weekdays { margin-bottom: 8px; color: var(--muted); font-size: 13px; font-weight: 700; text-align: center; }
.cal-day {
    min-height: 128px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 8px;
    box-shadow: none;
}
.cal-day.empty { background: transparent; border-color: transparent; }
.cal-day.today { outline: 2px solid var(--green); }
.cal-day header { font-weight: 800; margin-bottom: 6px; }
.cal-chip { font-size: 11px; border-radius: 8px; padding: 4px 6px; margin-bottom: 4px; line-height: 1.3; }
.cal-chip.real { background: var(--green-soft); color: var(--in); }
.cal-chip.local { background: #e7f0fb; color: #265b9b; }
.cal-chip.planned { background: #f4efe4; color: #7a6230; }

.sync-overlay {
    position: fixed;
    inset: 0;
    background: rgba(28, 36, 48, 0.35);
    display: grid;
    place-items: center;
    z-index: 40;
    padding: 20px;
}
.sync-overlay[hidden] { display: none; }
.sync-box {
    width: min(440px, 100%);
    background: var(--panel);
    border-radius: 24px;
    padding: 22px;
    box-shadow: var(--shadow);
}
.sync-title { margin: 0 0 12px; font-weight: 800; }
.sync-track {
    height: 12px;
    background: #eef3ee;
    border-radius: 999px;
    overflow: hidden;
}
.sync-bar {
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, var(--green), var(--green-2));
    transition: width 0.25s ease;
}
body.syncing { overflow: hidden; }
.btn[disabled] { opacity: 0.6; cursor: wait; }

.import-box {
    background: var(--panel);
    border: 0;
    border-radius: 20px;
    padding: 14px 16px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
}
.import-box summary {
    cursor: pointer;
    font-weight: 800;
}
.import-box textarea {
    margin: 10px 0;
    min-height: 140px;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 13px;
}

.roster-panel { margin-bottom: 22px; }
.roster-row {
    display: grid;
    grid-template-columns: minmax(160px, 1.4fr) 120px 110px minmax(120px, 0.8fr);
    gap: 12px;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
}
.roster-row:last-child { border-bottom: 0; }
.roster-hours { font-weight: 800; font-size: 18px; white-space: nowrap; }

.hr-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
}
.hr-view h3 { margin: 18px 0 8px; }
.json-preview {
    background: #16181c;
    color: #e8e4d9;
    padding: 16px 18px;
    border-radius: 16px;
    overflow: auto;
    font-size: 12px;
    line-height: 1.45;
    max-height: 420px;
    white-space: pre-wrap;
    word-break: break-word;
}

.hr-steps {
    display: flex;
    gap: 8px;
    list-style: none;
    padding: 0;
    margin: 0 0 16px;
    flex-wrap: wrap;
}
.hr-steps li {
    padding: 8px 12px;
    border-radius: 999px;
    background: #eef1f4;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}
.hr-steps li.active {
    background: var(--green-soft);
    color: var(--green);
}
.legal-strip, .legal-box {
    background: #f6f3ea;
    border-radius: 16px;
    padding: 12px 16px;
    margin: 0 0 16px;
    font-size: 13px;
    line-height: 1.45;
}
.legal-box p { margin: 0 0 8px; }
.hr-notes {
    background: #eef6f1;
    border-radius: 16px;
    padding: 12px 16px;
    font-size: 14px;
}
.hr-notes p { margin: 0 0 8px; }
.hr-suggest {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 220px;
    overflow: auto;
}
.hr-suggest button, .spec-quick {
    text-align: left;
}
fieldset.hr-step {
    border: 0;
    padding: 0;
    margin: 0;
}
fieldset.hr-step legend {
    font-weight: 800;
    font-size: 20px;
    margin-bottom: 10px;
}

.designer-credit {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 0;
    padding: 12px 4px 10px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
}
.shell > .designer-credit { margin-top: auto; }
.designer-credit img {
    height: 48px;
    width: auto;
    display: block;
}

@media (max-width: 980px) {
    .app { grid-template-columns: 1fr; padding: 12px; }
    .sidebar { flex-direction: row; flex-wrap: wrap; }
    .side-brand { width: 100%; max-width: 220px; }
    .nav { display: flex; gap: 6px; flex-wrap: wrap; }
    .topbar { flex-wrap: wrap; }
    .cards { grid-template-columns: 1fr 1fr; }
    .grid-2 { grid-template-columns: 1fr; }
    .roster-row { grid-template-columns: 1fr 1fr; }
}
