/* Shared base for every page. Tokens (fonts, palette) come from tokens.css, loaded first.
   Sections: base and shared components · sign-in page · alarm. The manager's desk lives in
   manager.css, the zone board in board.css and the phone page behind a QR code in phone.css. */

:root {
  --gray: #8a8f98; --yellow: var(--warn); --red: var(--bad); --green: var(--ok); --blue: var(--info);
  --bg: var(--m-bg); --card: var(--m-card); --text: var(--m-fg); --muted: var(--m-dim); --line: var(--m-line);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.5 var(--ui);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
main { max-width: 1100px; margin: 0 auto; padding: 16px; }
h1 { font-size: 1.4rem; margin: 0 0 12px; }
h2 { font-size: 1.1rem; margin: 24px 0 8px; }
a { color: var(--blue); }
.muted { color: var(--muted); }
.error { color: var(--red); font-weight: 600; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.centered main { min-height: 100vh; display: grid; place-items: center; }
.login { width: min(360px, 100%); display: grid; gap: 12px; }

label { display: grid; gap: 4px; font-size: .9rem; color: var(--muted); }
input, select, button, .button {
  min-height: 48px; font: inherit; border-radius: 10px; border: 1px solid var(--line);
  padding: 8px 12px; background: #fff; color: var(--text);
}
input[type=checkbox], input[type=radio] { min-height: 0; width: 22px; height: 22px; }
button, .button {
  background: var(--text); color: #fff; border-color: var(--text); font-weight: 600; cursor: pointer;
  text-decoration: none; display: inline-flex; align-items: center; justify-content: center;
}
button.secondary, .button.secondary { background: #fff; color: var(--text); border-color: var(--line); }
button.danger { background: var(--red); border-color: var(--red); }
button.ok { background: var(--green); border-color: var(--green); }
button:disabled { opacity: .5; }

table { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; overflow: hidden; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
tr:last-child td { border-bottom: 0; }
.table-wrap { overflow-x: auto; }
form.inline { display: inline; }
form.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  align-items: end; }
form.grid > * { min-width: 0; }
label > select { min-width: 0; width: 100%; }
.checks { display: flex; flex-wrap: wrap; gap: 12px; }
.checks label { display: flex; align-items: center; gap: 6px; color: var(--text); }
.thumb { width: 72px; height: 72px; object-fit: cover; border-radius: 8px; display: block; }
code { font-family: var(--num); background: #eef0f3; padding: 2px 6px; border-radius: 6px; font-size: .95rem; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: .75rem;
  font-weight: 700; color: #fff; background: var(--gray); white-space: nowrap; }
.badge.high { background: var(--yellow); color: #1c2024; }
.badge.critical { background: var(--red); }
.badge.DONE { background: var(--green); } .badge.OVERDUE { background: var(--red); }
.badge.DISPUTED { background: var(--blue); } .badge.ACTIVE { background: var(--text); }
.badge.SUBMITTED { background: var(--review); }
.banner { background: var(--red); color: #fff; padding: 10px 16px; text-align: center; font-weight: 700; }
[hidden] { display: none !important; }

/* The brand mark: a small tile with a turning gradient, as in the mockups. */
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.15rem;
  letter-spacing: -.01em; color: inherit; text-decoration: none; }
.brand i { width: 26px; height: 26px; border-radius: 8px; flex: none;
  background: conic-gradient(from 200deg, #3ccf8e, #6aa4ff, #b48cff, #3ccf8e);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .25), 0 6px 14px -6px rgba(106, 164, 255, .7); }

/* Sign-in (manager and tablet): a raised card on the tinted canvas; dark for the tablet. */
body.auth { min-height: 100vh; background:
    radial-gradient(60% 50% at 100% 0%, rgba(138, 92, 245, .16), transparent 70%),
    radial-gradient(50% 45% at 0% 100%, rgba(47, 182, 123, .16), transparent 70%),
    linear-gradient(180deg, #eef1ec, #e6ebe5) fixed; }
body.auth main { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.auth-card { width: min(380px, 100%); display: grid; gap: 16px; padding: 28px; border-radius: var(--radius);
  background: var(--m-card); border: 1px solid rgba(255, 255, 255, .9); box-shadow: var(--shadow-card); }
.auth-card h1 { margin: 4px 0 0; font-size: 1.6rem; font-weight: 800; letter-spacing: -.02em; }
.auth-card label { font-weight: 600; font-size: .85rem; }
.auth-card input { background: #fbfcfb; border-color: var(--m-line); }
.auth-card input:focus { outline: 2px solid var(--info); outline-offset: 1px; }
.auth-card button { margin-top: 4px; border-radius: 12px; font-weight: 700;
  box-shadow: 0 10px 20px -12px rgba(24, 32, 27, .8); }
body.auth.floor { color-scheme: dark; background:
    radial-gradient(60% 50% at 100% 0%, rgba(106, 164, 255, .16), transparent 70%),
    radial-gradient(50% 45% at 0% 100%, rgba(60, 207, 142, .14), transparent 70%), var(--t-bg); }
body.auth.floor .auth-card { background: #172019; color: var(--t-fg); border-color: rgba(255, 255, 255, .06);
  box-shadow: 0 30px 60px -30px rgba(0, 0, 0, .8); }
body.auth.floor .auth-card label { color: var(--t-dim); }
body.auth.floor .auth-card input { background: #0e1412; color: var(--t-fg); border-color: #2a3832; }
body.auth.floor .auth-card button { background: #fff; color: var(--t-bg); border-color: #fff; }

/* Alarm (the manager's banner; manager.css gives it its colours) */
@keyframes flash { 50% { background: var(--red); } }
.banner.alarm { position: sticky; top: 0; z-index: 5; border-radius: 12px; margin-bottom: 12px; text-align: left;
  animation: flash 1s steps(2, start) infinite; }
.banner.alarm a { color: #fff; }
/* exactly --alarm-rows lines are visible; «+N ещё» in the foot opens the rest */
.alarm-lines { --alarm-rows: 4; line-height: 1.45; max-height: calc(1.45em * var(--alarm-rows)); overflow-y: auto;
  overscroll-behavior: contain; }
.banner.alarm.expanded .alarm-lines { max-height: 50vh; }
.alarm-foot { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 16px; }
.alarm-foot:not(:empty) { margin-top: 6px; padding-top: 6px; border-top: 1px solid rgba(255, 255, 255, .35); }
.alarm-foot div { font-weight: 600; }
