/* Centraleyes Clock — design system
   Framework-free, deployable as static files. Light + dark via prefers-color-scheme,
   overridable with [data-theme] on <html>. */

:root {
  /* Brand */
  --brand: #4f6bff;
  --brand-600: #3f57e0;
  --brand-700: #3346bd;
  --brand-soft: rgba(79, 107, 255, 0.12);

  /* Semantic */
  --success: #14b88a;
  --success-soft: rgba(20, 184, 138, 0.14);
  --warn: #f5a623;
  --danger: #ef5b5b;
  --danger-soft: rgba(239, 91, 91, 0.12);

  /* Light surfaces */
  --bg: #f6f7fb;
  --bg-grad: radial-gradient(1200px 600px at 100% -10%, #eef1ff 0%, transparent 60%),
             radial-gradient(900px 500px at -10% 110%, #eafff7 0%, transparent 55%);
  --surface: #ffffff;
  --surface-2: #fbfcfe;
  --border: #e7e9f2;
  --border-strong: #d6d9e6;
  --text: #161a2b;
  --text-2: #5b6276;
  --text-3: #8a90a3;

  --shadow-sm: 0 1px 2px rgba(20, 26, 51, 0.05), 0 1px 3px rgba(20, 26, 51, 0.06);
  --shadow-md: 0 6px 24px rgba(20, 26, 51, 0.08), 0 2px 6px rgba(20, 26, 51, 0.05);
  --shadow-lg: 0 24px 60px rgba(20, 26, 51, 0.14);

  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 20px;
  --space: 8px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "SF Mono", ui-monospace, "Cascadia Code", Menlo, monospace;
  --maxw: 1120px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a0d18;
    --bg-grad: radial-gradient(1200px 600px at 100% -10%, #161d3a 0%, transparent 60%),
               radial-gradient(900px 500px at -10% 110%, #0f2a22 0%, transparent 55%);
    --surface: #11152a;
    --surface-2: #0d1124;
    --border: #222743;
    --border-strong: #2c3252;
    --text: #e8eaf4;
    --text-2: #9aa1bd;
    --text-3: #6b7290;
    --brand-soft: rgba(79, 107, 255, 0.18);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 8px 30px rgba(0, 0, 0, 0.45);
    --shadow-lg: 0 24px 70px rgba(0, 0, 0, 0.6);
  }
}
:root[data-theme="dark"] {
  --bg: #0a0d18;
  --bg-grad: radial-gradient(1200px 600px at 100% -10%, #161d3a 0%, transparent 60%),
             radial-gradient(900px 500px at -10% 110%, #0f2a22 0%, transparent 55%);
  --surface: #11152a; --surface-2: #0d1124; --border: #222743; --border-strong: #2c3252;
  --text: #e8eaf4; --text-2: #9aa1bd; --text-3: #6b7290; --brand-soft: rgba(79,107,255,0.18);
  --shadow-sm: 0 1px 2px rgba(0,0,0,.4); --shadow-md: 0 8px 30px rgba(0,0,0,.45); --shadow-lg: 0 24px 70px rgba(0,0,0,.6);
}
:root[data-theme="light"] { color-scheme: light; }

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  background-image: var(--bg-grad);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -0.01em; }
a { color: var(--brand); text-decoration: none; }

/* Layout */
.shell { min-height: 100%; display: flex; flex-direction: column; }
.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }

.topbar {
  position: sticky; top: 0; z-index: 30;
  backdrop-filter: saturate(180%) blur(12px);
  background: color-mix(in srgb, var(--surface) 78%, transparent);
  border-bottom: 1px solid var(--border);
}
.topbar-inner { display: flex; align-items: center; gap: 16px; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: -0.02em; }
.brand .logo {
  width: 30px; height: 30px; border-radius: 9px;
  background: linear-gradient(135deg, var(--brand), #7b8cff);
  display: grid; place-items: center; color: #fff; box-shadow: var(--shadow-sm);
}
.nav { display: flex; gap: 4px; margin-left: 10px; }
.nav a {
  color: var(--text-2); font-weight: 550; font-size: 0.92rem;
  padding: 8px 14px; border-radius: 10px; transition: background .15s, color .15s;
}
.nav a:hover { background: var(--brand-soft); color: var(--text); }
.nav a.active { background: var(--brand-soft); color: var(--brand); }
.spacer { flex: 1; }

.userchip { display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; flex: none;
  background: linear-gradient(135deg, #7b8cff, var(--brand)); color: #fff;
  display: grid; place-items: center; font-weight: 650; font-size: 0.85rem;
}
.userchip .meta { line-height: 1.1; }
.userchip .meta .name { font-size: 0.88rem; font-weight: 600; }
.userchip .meta .role { font-size: 0.72rem; color: var(--text-3); text-transform: uppercase; letter-spacing: .05em; }

main { flex: 1; padding: 28px 0 60px; }
.page-head { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head h1 { font-size: 1.6rem; }
.page-head p { margin: 4px 0 0; color: var(--text-2); }

/* Cards */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.card.pad { padding: 20px; }
.grid { display: grid; gap: 16px; }
.stats { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.stat .label { color: var(--text-2); font-size: 0.82rem; font-weight: 550; }
.stat .value { font-size: 1.9rem; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; margin-top: 4px; }
.stat .sub { color: var(--text-3); font-size: 0.78rem; margin-top: 2px; }
.stat .value.brand { color: var(--brand); }
.stat .value.success { color: var(--success); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: inherit; font-size: 0.9rem; font-weight: 600; line-height: 1;
  padding: 10px 16px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); cursor: pointer;
  transition: transform .04s ease, background .15s, border-color .15s, box-shadow .15s;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-2); border-color: var(--text-3); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 3px solid var(--brand-soft); outline-offset: 1px; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: var(--shadow-sm); }
.btn.primary:hover { background: var(--brand-600); border-color: var(--brand-600); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--brand-soft); color: var(--text); }
.btn.danger { color: var(--danger); border-color: transparent; background: transparent; }
.btn.danger:hover { background: var(--danger-soft); }
.btn.sm { padding: 7px 11px; font-size: 0.82rem; }
.btn.icon { padding: 8px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* Forms */
label.field { display: block; }
.field .lbl { display: block; font-size: 0.8rem; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
input, select, textarea {
  font-family: inherit; font-size: 0.92rem; color: var(--text);
  background: var(--surface-2); border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); padding: 10px 12px; width: 100%;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft);
}
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.row > * { flex: 1; min-width: 120px; }

/* Table */
.table-wrap { overflow-x: auto; border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; min-width: 560px; }
thead th {
  text-align: left; font-weight: 600; color: var(--text-2); font-size: 0.78rem;
  text-transform: uppercase; letter-spacing: .04em; padding: 12px 16px;
  border-bottom: 1px solid var(--border); background: var(--surface-2);
  position: sticky; top: 0;
}
tbody td { padding: 13px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background .12s; }
tbody tr:hover { background: var(--surface-2); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.muted { color: var(--text-3); }

/* Badges */
.badge {
  display: inline-flex; align-items: center; gap: 5px; font-size: 0.74rem; font-weight: 600;
  padding: 3px 9px; border-radius: 999px; background: var(--brand-soft); color: var(--brand);
}
.badge.ok { background: var(--success-soft); color: var(--success); }
.badge.warn { background: rgba(245,166,35,.14); color: var(--warn); }

/* Week strip */
.weekbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.weekbar .label { font-weight: 600; }
.daypills { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.daypill {
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px;
  text-align: center; cursor: pointer; background: var(--surface); transition: all .12s;
}
.daypill:hover { border-color: var(--brand); }
.daypill.active { border-color: var(--brand); background: var(--brand-soft); }
.daypill.today .dnum { color: var(--brand); }
.daypill .dname { font-size: 0.72rem; color: var(--text-3); text-transform: uppercase; letter-spacing: .04em; }
.daypill .dnum { font-size: 1.25rem; font-weight: 700; margin: 2px 0; }
.daypill .dhrs { font-size: 0.74rem; color: var(--text-2); font-variant-numeric: tabular-nums; }
.daypill .dhrs.zero { color: var(--text-3); }

/* Empty state */
.empty { text-align: center; padding: 48px 20px; color: var(--text-2); }
.empty .ico { font-size: 2.2rem; margin-bottom: 8px; }

/* Toast */
.toasts { position: fixed; bottom: 20px; right: 20px; z-index: 100; display: flex; flex-direction: column; gap: 10px; }
.toast {
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg);
  border-radius: 12px; padding: 12px 16px; font-size: 0.9rem; min-width: 240px;
  border-left: 3px solid var(--brand); animation: slidein .25s ease;
}
.toast.ok { border-left-color: var(--success); }
.toast.err { border-left-color: var(--danger); }
@keyframes slidein { from { opacity: 0; transform: translateX(20px); } }

/* Modal */
.backdrop {
  position: fixed; inset: 0; z-index: 90; background: rgba(8,11,22,.45);
  backdrop-filter: blur(3px); display: grid; place-items: center; padding: 20px;
  animation: fade .15s ease;
}
.modal {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); width: 100%; max-width: 460px; animation: pop .18s ease;
}
.modal header { padding: 20px 22px 0; }
.modal header h3 { font-size: 1.15rem; }
.modal .body { padding: 18px 22px; display: grid; gap: 14px; }
.modal footer { padding: 14px 22px 20px; display: flex; justify-content: flex-end; gap: 10px; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: scale(.96) translateY(6px); } }

/* Utilities */
.hidden { display: none !important; }
.flex { display: flex; }
.between { justify-content: space-between; }
.center { align-items: center; }
.gap { gap: 12px; }
.wrap { flex-wrap: wrap; }
.mt { margin-top: 16px; }
.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--border) 50%, var(--surface-2) 75%);
  background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: 8px;
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* Loading spinner (login pages) */
.spinner {
  width: 36px; height: 36px; border-radius: 50%;
  border: 3px solid var(--border); border-top-color: var(--brand);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 720px) {
  .nav .lbl-full { display: none; }
  .userchip .meta { display: none; }
  .page-head h1 { font-size: 1.35rem; }
  .topbar-inner { gap: 8px; }
}
