:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --text: #1c2333;
  --muted: #667085;
  --border: #e4e7ec;
  --primary: #2453d6;
  --primary-dark: #1c42ab;
  --green: #12805c;
  --green-bg: #e6f4ef;
  --amber: #b25e09;
  --amber-bg: #fdf0e0;
  --red: #c02434;
  --red-bg: #fceaec;
  --blue-bg: #e8eefc;
  --radius: 10px;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.5;
}
.container { max-width: 1080px; margin: 0 auto; padding: 0 16px; }

/* Top bar */
.topbar { background: var(--surface); border-bottom: 1px solid var(--border); }
.topbar-inner { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; padding: 12px 16px; }
.brand { font-weight: 700; color: var(--text); text-decoration: none; font-size: 1.05rem; }
.nav { display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: center; margin-left: auto; }
.nav a { color: var(--muted); text-decoration: none; padding: 4px 2px; font-weight: 500; }
.nav a:hover { color: var(--primary); }
.linklike { background: none; border: none; color: var(--muted); font: inherit; font-weight: 500; cursor: pointer; padding: 4px 2px; }
.linklike:hover { color: var(--red); }
.inline { display: inline; }

main { padding: 20px 16px 40px; }
h1 { font-size: 1.4rem; margin: 8px 0 16px; }
h2 { font-size: 1.1rem; margin: 24px 0 10px; }
.footer { color: var(--muted); font-size: 0.8rem; padding-bottom: 24px; }

/* Cards & stats */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.stat .num { font-size: 1.7rem; font-weight: 700; }
.stat .label { color: var(--muted); font-size: 0.82rem; }

/* Tables */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { color: var(--muted); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; }
tr:last-child td { border-bottom: none; }
td.wrap { white-space: normal; min-width: 160px; }

/* Badges */
.badge { display: inline-block; padding: 2px 10px; border-radius: 99px; font-size: 0.78rem; font-weight: 600; }
.badge-green { background: var(--green-bg); color: var(--green); }
.badge-amber { background: var(--amber-bg); color: var(--amber); }
.badge-red { background: var(--red-bg); color: var(--red); }
.badge-blue { background: var(--blue-bg); color: var(--primary); }
.badge-gray { background: var(--border); color: var(--muted); }

/* Buttons */
.btn {
  display: inline-block; border: none; border-radius: 8px; cursor: pointer;
  background: var(--primary); color: #fff; font: inherit; font-weight: 600;
  padding: 10px 18px; text-decoration: none; text-align: center;
}
.btn:hover { background: var(--primary-dark); }
.btn-lg { font-size: 1.15rem; padding: 16px 28px; width: 100%; }
.btn-secondary { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--bg); }
.btn-green { background: var(--green); }
.btn-green:hover { background: #0d6448; }
.btn-red { background: var(--red); }
.btn-red:hover { background: #9b1c2a; }
.btn-sm { padding: 5px 12px; font-size: 0.85rem; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* Forms */
form p { margin: 0 0 14px; }
label { display: block; font-weight: 600; font-size: 0.88rem; margin-bottom: 4px; }
input[type=text], input[type=email], input[type=password], input[type=date],
input[type=time], input[type=number], select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px;
  font: inherit; background: var(--surface);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary); outline-offset: 0; border-color: var(--primary); }
.helptext { display: block; color: var(--muted); font-size: 0.8rem; margin-top: 3px; }
.errorlist { color: var(--red); margin: 4px 0; padding-left: 18px; font-size: 0.88rem; }
.form-narrow { max-width: 480px; }

/* Filter bar */
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-bottom: 16px; }
.filters .field { min-width: 130px; flex: 1 1 140px; }
.filters label { font-size: 0.78rem; color: var(--muted); }

/* Flash messages */
.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; font-weight: 500; }
.flash-success { background: var(--green-bg); color: var(--green); }
.flash-warning { background: var(--amber-bg); color: var(--amber); }
.flash-error { background: var(--red-bg); color: var(--red); }

/* Clock page */
.clock-card { text-align: center; max-width: 440px; margin: 24px auto; }
.clock-time { font-size: 2.4rem; font-weight: 700; letter-spacing: 0.02em; }
.clock-date { color: var(--muted); margin-bottom: 18px; }
.clock-status { margin: 14px 0; }
.muted { color: var(--muted); }
.mt { margin-top: 16px; }

@media (max-width: 640px) {
  body { font-size: 15px; }
  h1 { font-size: 1.25rem; }
  .stat .num { font-size: 1.4rem; }
}
