:root {
  color-scheme: light;
  --ink: #17211f;
  --muted: #65716d;
  --line: #dce4df;
  --surface: #ffffff;
  --page: #edf4f0;
  --accent: #156f5a;
  --accent-dark: #0e5142;
  --accent-soft: #dff2ec;
  --danger: #a34135;
  --warn: #b7791f;
  --ok: #14734e;
  --shadow: 0 18px 50px rgba(30, 48, 42, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    linear-gradient(140deg, rgba(21, 111, 90, 0.1), transparent 34%),
    linear-gradient(320deg, rgba(54, 91, 136, 0.12), transparent 30%),
    var(--page);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0;
}

.workspace {
  display: grid;
  gap: 18px;
}

.hidden {
  display: none !important;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 18px;
  min-width: 0;
}

.brand-logo {
  width: clamp(190px, 24vw, 330px);
  max-height: 78px;
  object-fit: contain;
}

.brand-title {
  display: grid;
  gap: 3px;
  justify-items: start;
}

.eyebrow,
.label {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

.topbar h1 {
  font-size: clamp(2.1rem, 3.15vw, 3.05rem);
  line-height: 0.94;
}

h2 {
  font-size: 1.2rem;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.74);
  color: var(--muted);
  font-weight: 700;
  white-space: nowrap;
}

.dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
}

.dot-warn {
  background: var(--warn);
}

.dot-ok {
  background: var(--ok);
}

.dot-bad {
  background: var(--danger);
}

.grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 18px;
  align-items: stretch;
}

.panel {
  border: 1px solid rgba(220, 228, 223, 0.88);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
}

.active-card {
  display: grid;
  gap: 24px;
  padding: 24px;
}

.panel-head,
.table-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

select,
input[type="text"],
input[type="password"],
input[type="number"],
input[type="time"],
input[type="date"],
textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fbfdfc;
  color: var(--ink);
  padding: 0 12px;
  outline: none;
}

textarea {
  min-height: 92px;
  padding: 12px;
  resize: vertical;
}

select:focus,
input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(21, 111, 90, 0.14);
}

.icon-button {
  display: grid;
  place-items: center;
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--accent);
}

.icon-button svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.9;
}

.clock-face {
  display: grid;
  gap: 6px;
  min-height: 145px;
  align-content: center;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.clock-face span {
  font-size: clamp(4rem, 11vw, 8rem);
  font-weight: 800;
  line-height: 0.86;
  font-variant-numeric: tabular-nums;
}

.clock-face small {
  color: var(--muted);
  font-size: 1rem;
  font-weight: 700;
}

.location-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 96px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7fbf9;
}

.location-card strong,
.location-card span {
  display: block;
}

.location-card span {
  margin-top: 4px;
  color: var(--muted);
  font-weight: 650;
}

.range-indicator {
  display: grid;
  place-items: center;
  flex: 0 0 78px;
  width: 78px;
  height: 78px;
  border: 6px solid var(--line);
  border-radius: 50%;
  color: var(--muted);
  font-weight: 900;
}

.range-ok {
  border-color: var(--ok);
  color: var(--ok);
}

.range-bad {
  border-color: var(--danger);
  color: var(--danger);
}

.actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.primary,
.secondary,
.danger,
.text-button {
  min-height: 46px;
  border-radius: 7px;
  font-weight: 800;
}

.primary {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: white;
}

.primary:hover {
  background: var(--accent-dark);
}

.secondary {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
}

.secondary:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.danger {
  border: 1px solid var(--danger);
  background: #fff7f5;
  color: var(--danger);
}

.small {
  min-height: 34px;
  padding: 0 10px;
  font-size: 0.84rem;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.message {
  min-height: 24px;
  margin: 0;
  color: var(--muted);
  font-weight: 700;
}

.settings-card {
  display: grid;
  gap: 22px;
  align-content: start;
  padding: 24px;
}

.section-title {
  display: grid;
  gap: 6px;
}

.settings-form {
  display: grid;
  gap: 16px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 800;
}

.two-col {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

input[type="range"] {
  accent-color: var(--accent);
}

.full {
  width: 100%;
}

.form-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.auth-panel {
  display: grid;
  gap: 18px;
  max-width: 680px;
  padding: 22px;
}

.tabs {
  display: inline-grid;
  grid-template-columns: repeat(2, 1fr);
  width: min(100%, 360px);
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7fbf9;
}

.tab-button {
  min-height: 38px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-weight: 850;
}

.tab-button.active {
  background: var(--surface);
  color: var(--accent-dark);
  box-shadow: 0 6px 18px rgba(30, 48, 42, 0.09);
}

.auth-form {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
}

.hint {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 650;
}

.form-status {
  min-height: 22px;
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 800;
}

.form-status.error {
  color: var(--danger);
}

.form-status.success {
  color: var(--ok);
}

.summary-grid {
  display: grid;
  gap: 12px;
}

.summary-grid div {
  display: grid;
  gap: 4px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7fbf9;
}

.summary-grid span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
}

.summary-grid strong {
  font-size: 1.4rem;
}

.exception-box {
  display: grid;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7fbf9;
}

.exception-box summary {
  color: var(--accent-dark);
  cursor: pointer;
  font-weight: 850;
}

.exception-box[open] {
  gap: 14px;
}

.exception-box[open] summary {
  margin-bottom: 12px;
}

.admin-panel {
  display: grid;
  gap: 22px;
  padding: 20px;
}

.admin-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.admin-tools {
  display: flex;
  align-items: end;
  gap: 12px;
  flex-wrap: wrap;
}

.row-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.table-panel {
  padding: 20px;
}

.text-button {
  border: 0;
  background: var(--accent-soft);
  color: var(--accent-dark);
  padding: 0 14px;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  margin-top: 16px;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

th,
td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

td {
  font-weight: 650;
}

.empty-row {
  color: var(--muted);
  text-align: center;
}

@media (max-width: 820px) {
  .shell {
    width: min(100% - 18px, 700px);
    padding: 14px 0 28px;
  }

  .topbar,
  .grid,
  .auth-form,
  .admin-grid,
  .actions,
  .form-actions,
  .two-col {
    grid-template-columns: 1fr;
  }

  .topbar {
    display: grid;
    gap: 12px;
  }

  .brand-lockup {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .status-pill {
    justify-content: center;
    width: 100%;
  }

  .clock-face {
    min-height: 120px;
  }

  .active-card,
  .settings-card,
  .auth-panel,
  .admin-panel,
  .table-panel {
    padding: 16px;
  }

  .panel-head,
  .table-head {
    align-items: stretch;
  }

  .auth-form {
    align-items: stretch;
  }

  .primary,
  .secondary,
  .danger,
  .text-button {
    width: 100%;
    min-height: 50px;
  }

  .location-card {
    align-items: flex-start;
    flex-direction: column;
  }

  .range-indicator {
    align-self: flex-end;
    width: 68px;
    height: 68px;
    flex-basis: 68px;
  }

  .admin-tools {
    display: grid;
    grid-template-columns: 1fr;
  }

  .row-actions {
    display: grid;
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  body {
    background: var(--page);
  }

  .shell {
    width: 100%;
    padding: 0;
  }

  .workspace {
    gap: 10px;
  }

  .topbar {
    padding: 18px 14px 4px;
    text-align: center;
  }

  .brand-logo {
    width: min(100%, 280px);
    max-height: 68px;
  }

  .brand-lockup,
  .brand-title {
    align-items: center;
    justify-items: center;
    width: 100%;
  }

  .topbar h1 {
    font-size: 2.25rem;
  }

  h2 {
    font-size: 1.05rem;
  }

  .panel {
    border-left: 0;
    border-right: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .auth-panel {
    max-width: none;
  }

  .tabs {
    width: 100%;
  }

  .clock-face {
    min-height: 102px;
  }

  .clock-face span {
    font-size: clamp(3.2rem, 18vw, 5.6rem);
    line-height: 0.95;
  }

  .clock-face small {
    font-size: 0.92rem;
  }

  .actions {
    gap: 10px;
  }

  .location-card {
    min-height: 0;
    padding: 14px;
  }

  .summary-grid strong {
    font-size: 1.25rem;
  }

  table {
    min-width: 680px;
  }

  th,
  td {
    padding: 12px 10px;
    font-size: 0.9rem;
  }
}
