@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,500;9..144,600;9..144,700&family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
    /* Palette — a time-clock / punch-card idea: warm paper, ink, brass */
    --paper: #FAF8F3;
    --surface: #FFFFFF;
    --ink: #211D17;
    --muted: #746C5E;
    --line: #E7E1D4;
    --brass: #A9772E;
    --brass-dark: #8A5F22;
    --sage: #45745A;
    --sage-bg: #E7F0E9;
    --brick: #A3402C;
    --brick-bg: #F6E5E0;
    --amber-bg: #F7ECD8;
    --slate-bg: #EFEDE7;

    --font-display: 'Fraunces', Georgia, serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;

    --radius: 10px;
    --shadow: 0 1px 2px rgba(33, 29, 23, 0.06), 0 4px 16px rgba(33, 29, 23, 0.05);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 1.5;
}

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

h1, h2, h3 {
    font-family: var(--font-display);
    font-weight: 600;
    margin: 0 0 0.5em;
    letter-spacing: -0.01em;
}
h2 { font-size: 1.35rem; }
h3 { font-size: 1.1rem; }

.muted { color: var(--muted); }
.small { font-size: 0.82rem; }

:focus-visible {
    outline: 2px solid var(--brass);
    outline-offset: 2px;
}

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

.topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 10;
}
.topbar-inner {
    max-width: 1080px;
    margin: 0 auto;
    padding: 14px 24px;
    display: flex;
    align-items: center;
    gap: 28px;
}
.brand {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.2rem;
    color: var(--ink);
}
.brand:hover { text-decoration: none; }
.brand .tag {
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    background: var(--amber-bg);
    color: var(--brass-dark);
    padding: 2px 8px;
    border-radius: 999px;
    vertical-align: middle;
    margin-left: 6px;
}
.topnav {
    display: flex;
    gap: 20px;
    flex: 1;
}
.topnav a {
    color: var(--muted);
    font-weight: 500;
    font-size: 0.92rem;
}
.topnav a:hover { color: var(--ink); text-decoration: none; }
.topbar-user {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.9rem;
    color: var(--muted);
}

.page {
    max-width: 1080px;
    margin: 0 auto;
    padding: 28px 24px 64px;
}

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}
@media (max-width: 760px) {
    .grid-2 { grid-template-columns: 1fr; }
    .topnav { display: none; }
}

.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 22px 24px;
    margin-bottom: 20px;
}

.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.month-nav {
    display: flex;
    align-items: center;
    gap: 10px;
}

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

.auth-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--paper);
    background-image:
        linear-gradient(var(--line) 1px, transparent 1px),
        linear-gradient(90deg, var(--line) 1px, transparent 1px);
    background-size: 32px 32px;
    background-position: center;
}
.auth-card {
    width: 100%;
    max-width: 380px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 32px 28px;
}
.auth-card .brand { display: block; text-align: center; font-size: 1.5rem; margin-bottom: 4px; }
.auth-subtitle { text-align: center; color: var(--muted); margin: 0 0 20px; font-size: 0.9rem; }

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

label {
    display: block;
    font-size: 0.86rem;
    font-weight: 600;
    color: var(--ink);
    margin-bottom: 14px;
}
label > input,
label > select,
label > textarea {
    display: block;
    width: 100%;
    margin-top: 6px;
    font-weight: 400;
}
input, select, textarea {
    font-family: var(--font-body);
    font-size: 0.95rem;
    padding: 9px 11px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: var(--paper);
    color: var(--ink);
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--brass);
    background: var(--surface);
}
textarea { resize: vertical; font-family: var(--font-body); }

.inline-form { display: inline-block; margin: 0; }

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

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 0.9rem;
    padding: 9px 16px;
    border-radius: 7px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: transform 0.05s ease, background 0.15s ease, border-color 0.15s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brass); color: #fff; }
.btn-primary:hover { background: var(--brass-dark); text-decoration: none; }
.btn-danger { background: var(--brick); color: #fff; }
.btn-danger:hover { background: #8a3423; text-decoration: none; }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { background: var(--slate-bg); text-decoration: none; }
.btn-sm { padding: 6px 11px; font-size: 0.82rem; }
.btn-lg { padding: 15px 20px; font-size: 1rem; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: 0.6; cursor: not-allowed; }

/* ---------------- Check-in card (signature element) ---------------- */

.checkin-card {
    text-align: center;
    position: relative;
}
.clock {
    font-family: var(--font-mono);
    font-size: 2.4rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    color: var(--brass-dark);
    background: var(--amber-bg);
    border-radius: var(--radius);
    padding: 18px;
    margin: 14px 0 18px;
    font-variant-numeric: tabular-nums;
    border: 1px dashed var(--brass);
}

/* ---------------- Stats ---------------- */

.stat-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-bottom: 16px;
}
.stat-grid-compact { grid-template-columns: repeat(5, 1fr); }
@media (max-width: 640px) {
    .stat-grid, .stat-grid-compact { grid-template-columns: repeat(2, 1fr); }
}
.stat {
    text-align: center;
    padding: 16px 8px;
    background: var(--slate-bg);
    border-radius: var(--radius);
}
.stat-value {
    display: block;
    font-family: var(--font-display);
    font-size: 1.7rem;
    font-weight: 600;
    color: var(--ink);
}
.stat-label {
    display: block;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
    margin-top: 2px;
}
.stat-link { display: block; font-size: 0.78rem; margin-top: 4px; }

/* ---------------- Table ---------------- */

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}
.table th, .table td {
    text-align: left;
    padding: 10px 12px;
    border-bottom: 1px solid var(--line);
    font-variant-numeric: tabular-nums;
}
.table th {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
    font-weight: 600;
}
.table tbody tr:hover { background: var(--paper); }
.row-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ---------------- Badges ---------------- */

.badge {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 3px 9px;
    border-radius: 999px;
}
.badge-present { background: var(--sage-bg); color: var(--sage); }
.badge-half { background: var(--amber-bg); color: var(--brass-dark); }
.badge-leave { background: #E4E9F5; color: #3B5AA3; }
.badge-absent { background: var(--brick-bg); color: var(--brick); }
.badge-muted { background: var(--slate-bg); color: var(--muted); }

/* ---------------- Alerts ---------------- */

.alert {
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 0.88rem;
    margin: 0 0 14px;
}
.alert-success { background: var(--sage-bg); color: var(--sage); }
.alert-error { background: var(--brick-bg); color: var(--brick); }
.alert-info { background: var(--amber-bg); color: var(--brass-dark); }

/* ---------------- Requests list ---------------- */

.request-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    padding: 14px 0;
    border-bottom: 1px solid var(--line);
    flex-wrap: wrap;
}
.request-item:last-child { border-bottom: none; }
.request-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}
.request-actions input[type="text"] {
    width: 160px;
}

/* ---------------- Modal ---------------- */

.modal {
    position: fixed;
    inset: 0;
    background: rgba(33, 29, 23, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
}
.modal[hidden] { display: none; }
.modal-inner { width: 100%; max-width: 360px; margin: 16px; }
.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 10px;
}
