:root {
  --bg: #eef7f5;
  --panel: #ffffff;
  --panel-soft: #fbf7f1;
  --ink: #161413;
  --muted: #625950;
  --line: #d7c7b5;
  --primary: #0f7f72;
  --primary-dark: #123f32;
  --danger: #b42318;
  --warning-bg: #fff4df;
  --warning-text: #7a4f15;
  --shadow: 0 18px 45px rgba(18, 63, 50, 0.16);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  touch-action: manipulation;
}

.app-shell {
  min-height: 100dvh;
  padding: max(18px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) max(18px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
}

.frame {
  max-width: 1180px;
  min-height: calc(100dvh - 36px);
  margin: 0 auto;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 18px;
}

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

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

.brand-logo {
  width: 76px;
  height: 76px;
  border-radius: 18px;
  background: #f7efe4;
  object-fit: contain;
  box-shadow: 0 6px 18px rgba(18, 63, 50, 0.12);
}

.brand-copy {
  min-width: 0;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--primary);
  font-size: 16px;
  font-weight: 900;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: clamp(34px, 4vw, 58px);
  line-height: 1;
  letter-spacing: 0;
}

h2 {
  font-size: clamp(28px, 3vw, 42px);
  line-height: 1.08;
}

h3 {
  font-size: 24px;
  line-height: 1.12;
}

.site-pill {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  margin-top: 8px;
  padding: 6px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--primary);
  font-size: 20px;
  font-weight: 900;
}

.time-box {
  min-width: 220px;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
  text-align: right;
}

.time-main {
  font-size: clamp(30px, 3.6vw, 48px);
  line-height: 1;
  font-weight: 900;
}

.time-sub {
  margin-top: 4px;
  color: var(--muted);
  font-size: 16px;
  font-weight: 800;
}

.main-grid {
  display: grid;
  grid-template-columns: minmax(420px, 1.1fr) minmax(320px, 0.9fr);
  gap: 18px;
  align-items: stretch;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.setup-panel,
.staff-panel {
  padding: clamp(24px, 3vw, 38px);
}

.pin-panel {
  padding: clamp(24px, 3vw, 38px);
  display: grid;
  gap: 24px;
}

.muted {
  color: var(--muted);
}

.form-grid {
  display: grid;
  gap: 14px;
  margin-top: 22px;
}

.field {
  display: grid;
  gap: 7px;
}

.field span {
  color: var(--muted);
  font-size: 15px;
  font-weight: 900;
  text-transform: uppercase;
}

.input {
  width: 100%;
  min-height: 62px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  color: var(--ink);
  padding: 12px 16px;
  font-size: 22px;
  outline-color: var(--primary);
}

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

.btn {
  min-height: 68px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
  color: var(--ink);
  padding: 12px 18px;
  font-size: 22px;
  font-weight: 900;
}

.btn:active {
  transform: scale(0.99);
}

.btn-primary {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}

.btn-danger {
  border-color: #e8b7b2;
  background: #fff8f7;
  color: var(--danger);
}

.btn-wide {
  grid-column: 1 / -1;
}

.pin-display {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
}

.pin-dot {
  height: 20px;
  border-radius: 999px;
  border: 2px solid var(--line);
  background: #fff;
}

.pin-dot.filled {
  border-color: var(--primary);
  background: var(--primary);
}

.keypad {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.key {
  min-height: clamp(78px, 11vw, 128px);
  border: 1px solid var(--line);
  border-radius: 24px;
  background: #fff;
  color: var(--ink);
  font-size: clamp(32px, 5vw, 56px);
  font-weight: 900;
}

.status-banner {
  border: 1px solid #c4e4dc;
  border-radius: 18px;
  background: #f0fbf8;
  padding: 16px;
  color: var(--primary-dark);
  font-size: 20px;
  font-weight: 800;
}

.status-banner.error {
  border-color: #efc0bb;
  background: #fff8f7;
  color: var(--danger);
}

.notice-panel {
  padding: clamp(20px, 2.6vw, 32px);
  display: grid;
  align-content: start;
  gap: 16px;
}

.notice-list {
  display: grid;
  gap: 12px;
  max-height: 56dvh;
  overflow: auto;
  padding-right: 4px;
}

.notice {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel-soft);
  padding: 14px;
}

.notice.urgent {
  border-color: #e6aba6;
  background: #fff3f2;
}

.notice.important {
  border-color: #e3c483;
  background: var(--warning-bg);
}

.notice-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #e6fbf7;
  color: var(--primary);
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
}

.notice-text {
  font-size: 20px;
  line-height: 1.32;
}

.staff-card {
  display: grid;
  gap: 18px;
}

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

.state-tile {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel-soft);
  padding: 14px;
}

.state-label {
  color: var(--muted);
  font-size: 14px;
  font-weight: 900;
  text-transform: uppercase;
}

.state-value {
  margin-top: 4px;
  font-size: 24px;
  font-weight: 900;
}

.reminder-modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(18, 63, 50, 0.32);
}

.modal-card {
  width: min(520px, 100%);
  border: 1px solid var(--line);
  border-radius: 22px;
  background: #fff;
  padding: 26px;
  box-shadow: var(--shadow);
}

.footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

.hidden {
  display: none !important;
}

@media (max-width: 820px) {
  .app-shell {
    padding: 14px;
  }

  .topbar,
  .footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .time-box {
    width: 100%;
    text-align: left;
  }

  .main-grid {
    grid-template-columns: 1fr;
  }

  .setup-actions,
  .action-grid,
  .clock-state {
    grid-template-columns: 1fr;
  }
}
