:root {
    --bg: #f4f6f9;
    --card: #ffffff;
    --ink: #1f2733;
    --muted: #6b7685;
    --line: #e6eaf0;
    --brand: #1fa968;
    --accent: #2f6df0;
    --work: #1fa968;
    --break: #f0a128;
    --warn: #e5484d;
    --shadow: 0 1px 3px rgba(20, 30, 50, .06), 0 6px 20px rgba(20, 30, 50, .05);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: "Segoe UI", Inter, system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--ink);
    font-size: 14px;
}

a { color: inherit; text-decoration: none; }

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

.topbar {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 0 24px;
    height: 60px;
    background: #12203a;
    color: #fff;
    position: sticky;
    top: 0;
    z-index: 10;
}

.brand { font-weight: 700; font-size: 16px; }
.brand span { opacity: .6; font-weight: 500; margin-left: 4px; }
.topnav { display: flex; gap: 18px; }
.topnav a { opacity: .85; }
.topnav a:hover { opacity: 1; }
.logout-form { margin-left: auto; }

.content { max-width: 1100px; margin: 0 auto; padding: 28px 24px 60px; }

.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
h1 { font-size: 22px; margin: 0; display: flex; align-items: center; gap: 12px; }
h2 { font-size: 16px; margin: 28px 0 12px; }

.muted { color: var(--muted); }
.strong { font-weight: 700; }
.small { font-size: 14px; }

/* ---------- Live badge ---------- */
.live-badge { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 0 rgba(31,169,104,.5); animation: pulse 2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(31,169,104,.5); } 70% { box-shadow: 0 0 0 8px rgba(31,169,104,0); } 100% { box-shadow: 0 0 0 0 rgba(31,169,104,0); } }

/* ---------- Tiles ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 22px; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; box-shadow: var(--shadow); }
.tile-label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .03em; }
.tile-value { font-size: 24px; font-weight: 700; margin-top: 6px; }
.tile-value.small { font-size: 17px; }

/* ---------- Grid table ---------- */
.grid { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; box-shadow: var(--shadow); }
.grid th, .grid td { text-align: left; padding: 13px 16px; border-bottom: 1px solid var(--line); }
.grid th { font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); background: #fafbfc; }
.grid tbody tr:last-child td { border-bottom: none; }
.grid .num { text-align: right; }
.grid .name { font-weight: 600; }
.row-link { cursor: pointer; }
.row-link:hover { background: #f7f9fc; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.working { color: #147a4a; background: #e4f6ec; }
.badge.break { color: #a4680f; background: #fdf0dc; }
.badge.locked { color: #5a51c9; background: #ecebfb; }
.badge.suspended { color: #6b7685; background: #eef1f5; }
.badge.offline { color: #8a94a2; background: #f0f2f5; }

/* ---------- Timeline ---------- */
.timeline { list-style: none; margin: 0; padding: 0; background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); overflow: hidden; }
.timeline li { display: flex; align-items: flex-start; gap: 14px; padding: 12px 18px; border-bottom: 1px solid var(--line); }
.timeline li:last-child { border-bottom: none; }
.tl-time { color: var(--muted); font-variant-numeric: tabular-nums; min-width: 66px; padding-top: 1px; }
.tl-dot { width: 9px; height: 9px; border-radius: 50%; margin-top: 5px; flex: none; background: var(--muted); }
.tl.work .tl-dot { background: var(--work); }
.tl.break .tl-dot { background: var(--break); }
.tl.warn .tl-dot { background: var(--warn); }
.tl-body { display: flex; flex-direction: column; }
.tl-title { font-weight: 600; }
.tl.warn .tl-title { color: var(--warn); }
.tl-sub { color: var(--muted); font-size: 13px; }

.day-switch { display: flex; align-items: center; gap: 12px; }
.day-label { font-weight: 600; font-variant-numeric: tabular-nums; }

.back { color: var(--muted); display: inline-block; margin-bottom: 14px; }
.back:hover { color: var(--ink); }

.empty { background: var(--card); border: 1px dashed var(--line); border-radius: 12px; padding: 40px; text-align: center; color: var(--muted); }

/* ---------- Buttons ---------- */
.btn-ghost { background: transparent; border: 1px solid rgba(255,255,255,.25); color: inherit; padding: 6px 12px; border-radius: 8px; cursor: pointer; font-size: 13px; }
.content .btn-ghost { border-color: var(--line); color: var(--ink); background: var(--card); }
.btn-ghost:hover:not(:disabled) { background: rgba(255,255,255,.1); }
.content .btn-ghost:hover:not(:disabled) { background: #f2f5f9; }
.btn-ghost:disabled { opacity: .4; cursor: default; }
.btn-primary { background: var(--brand); color: #fff; border: none; padding: 11px 16px; border-radius: 9px; cursor: pointer; font-size: 15px; font-weight: 600; width: 100%; }
.btn-primary:hover { filter: brightness(1.05); }

/* ---------- Login ---------- */
.login-shell { min-height: 100vh; display: grid; place-items: center; background: linear-gradient(135deg, #12203a, #1b3358); padding: 20px; }
.login-card { background: #fff; border-radius: 16px; padding: 36px 32px; width: 100%; max-width: 380px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.login-brand { font-size: 22px; font-weight: 700; }
.login-card h1 { font-size: 18px; margin: 14px 0 4px; }
.login-sub { color: var(--muted); margin: 0 0 20px; }
.login-card label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.login-card input { width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 9px; font-size: 15px; margin-bottom: 16px; }
.login-card input:focus { outline: none; border-color: var(--accent); }
.login-error { background: #fdecec; color: var(--warn); padding: 10px 12px; border-radius: 9px; margin-bottom: 16px; font-size: 13px; }
