:root {
  color-scheme: dark;
  --ink: #111111;
  --panel: #1e1e1e;
  --panel-raised: #252321;
  --paper: #f4efe8;
  --paper-muted: #b8b0a7;
  --line: #393633;
  --red: #dc2626;
  --red-deep: #991b1b;
  --green: #45b876;
  --amber: #f3b33d;
  --radius: 18px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  font-family: Inter, sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-height: 100%; background: var(--ink); }
body { margin: 0; min-height: 100vh; background: var(--ink); color: var(--paper); }
button, input, select, textarea { font: inherit; }
button { color: inherit; }
svg { width: 1.25rem; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .24;
  background-image: repeating-linear-gradient(90deg, transparent 0 47px, rgba(255,255,255,.018) 48px), repeating-linear-gradient(0deg, transparent 0 47px, rgba(255,255,255,.014) 48px);
}

.network-banner {
  position: fixed;
  z-index: 50;
  inset: 0 0 auto;
  padding: calc(8px + env(safe-area-inset-top, 0px)) 16px 8px;
  background: var(--amber);
  color: #211707;
  text-align: center;
  font-size: .78rem;
  font-weight: 800;
}

.employee-shell { width: min(100%, 520px); min-height: 100vh; margin: auto; position: relative; }
.login-view { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; padding: clamp(28px, 8vw, 56px); }
.brand-lockup { display: flex; align-items: center; gap: 12px; }
.brand-lockup--large { align-items: flex-end; gap: 18px; }
.brand-lockup h1 { margin: 2px 0 0; font-size: clamp(1.9rem, 9vw, 3.2rem); letter-spacing: -.055em; line-height: .96; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  flex: 0 0 auto;
  background: var(--red);
  border-radius: 50% 50% 44% 44%;
  color: #fff7ef;
  font-size: .82rem;
  font-weight: 900;
  letter-spacing: -.08em;
  box-shadow: inset 0 -5px 0 rgba(84, 5, 5, .22);
}
.brand-lockup--large .brand-mark { width: 70px; height: 70px; font-size: 1.15rem; }
.eyebrow { margin: 0; color: var(--paper-muted); text-transform: uppercase; letter-spacing: .15em; font-size: .68rem; font-weight: 800; }
.login-intro { margin: 42px 0 22px; color: var(--paper-muted); line-height: 1.55; }
.login-form { display: grid; gap: 16px; }
.login-form label, .field { display: grid; gap: 7px; color: var(--paper-muted); font-size: .78rem; font-weight: 700; }
input, select, textarea {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: 0;
  padding: 0 14px;
  background: #181716;
  color: var(--paper);
  transition: border-color .16s ease, box-shadow .16s ease;
}
textarea { min-height: 96px; padding-block: 12px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--red); box-shadow: 0 0 0 3px rgba(220, 38, 38, .18); }
.password-field { position: relative; width: 100%; color: var(--paper-muted); }
.password-field input { padding-right: 52px; }
.password-toggle {
  position: absolute;
  top: 4px;
  right: 4px;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--paper-muted);
  cursor: pointer;
}
.password-toggle:hover { background: #292624; color: var(--paper); }
.password-toggle:focus-visible { outline: 2px solid var(--red); outline-offset: -2px; }
.password-toggle svg { width: 20px; height: 20px; }
.password-toggle__slash { display: none; }
.password-toggle[aria-pressed="true"] .password-toggle__slash { display: block; }
.button { min-height: 48px; border: 0; border-radius: 10px; padding: 0 18px; cursor: pointer; font-weight: 800; transition: transform .14s ease, background .14s ease, opacity .14s ease; }
.button:active:not(:disabled) { transform: translateY(1px) scale(.99); }
.button:disabled { opacity: .55; cursor: wait; }
.button--primary { background: var(--red); color: #fff8f1; box-shadow: inset 0 -3px 0 rgba(74, 5, 5, .34); }
.button--primary:hover:not(:disabled) { background: #ed2929; }
.button--quiet { background: transparent; color: var(--paper-muted); }
.button--secondary { background: #312e2b; color: var(--paper); border: 1px solid #45413d; }
.button--danger { background: transparent; border: 1px solid #6c2929; color: #ff9898; }
.button--wide { width: 100%; }
.form-error { margin: 0; padding: 11px 13px; border-radius: 8px; background: rgba(220, 38, 38, .12); color: #ffaaa3; font-size: .82rem; line-height: 1.45; }
.install-hint { align-self: flex-start; display: flex; align-items: center; gap: 8px; margin-top: 24px; padding: 8px 0; border: 0; background: transparent; color: var(--paper-muted); cursor: pointer; font-size: .8rem; }

.app-view { min-height: 100vh; padding: max(18px, env(safe-area-inset-top)) 18px calc(28px + var(--safe-bottom)); }
.employee-header { display: flex; align-items: center; justify-content: space-between; padding: 4px 2px 18px; }
.employee-header strong { display: block; margin-top: 2px; max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icon-button { display: grid; place-items: center; width: 42px; height: 42px; border: 1px solid var(--line); border-radius: 50%; background: transparent; cursor: pointer; color: var(--paper-muted); }
.segmented-nav { display: grid; grid-template-columns: 1fr 1fr; border-bottom: 1px solid var(--line); }
.segmented-nav button { position: relative; border: 0; padding: 14px; background: transparent; color: var(--paper-muted); cursor: pointer; font-weight: 700; }
.segmented-nav button::after { content: ""; position: absolute; height: 3px; inset: auto 22% -1px; border-radius: 4px 4px 0 0; background: var(--red); transform: scaleX(0); transition: transform .22s cubic-bezier(.2,.8,.2,1); }
.segmented-nav button.is-active { color: var(--paper); }
.segmented-nav button.is-active::after { transform: scaleX(1); }
.tab-panel { padding-top: 24px; }
.auto-warning { margin-bottom: 18px; padding: 13px 15px; border: 1px solid #674b20; border-radius: 10px; background: #2d2416; color: #f7d99d; font-size: .78rem; line-height: 1.45; }
.auto-warning strong { display: block; color: #ffd687; }
.shift-stage { min-height: 500px; display: flex; flex-direction: column; align-items: center; text-align: center; padding-top: clamp(20px, 7vh, 62px); }
.shift-state { display: inline-flex; align-items: center; gap: 9px; color: var(--paper-muted); font-size: .84rem; font-weight: 700; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #77716a; box-shadow: 0 0 0 5px rgba(119,113,106,.1); }
.shift-stage[data-state="on"] .status-dot { background: var(--green); box-shadow: 0 0 0 5px rgba(69,184,118,.13); }
.shift-stage[data-state="on"] .shift-state { color: #a9e8c4; }
.time-counter { margin-top: 24px; font-size: clamp(2.6rem, 15vw, 4.6rem); font-weight: 800; letter-spacing: -.075em; font-variant-numeric: tabular-nums; line-height: 1; }
.shift-detail { min-height: 21px; margin: 10px 0 0; color: var(--paper-muted); font-size: .82rem; }
.punch-button {
  position: relative;
  width: 206px;
  height: 206px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 54px;
  border: 1px solid #f24747;
  border-radius: 50%;
  background: var(--red);
  color: #fff8f1;
  cursor: pointer;
  box-shadow: inset 0 -12px 0 rgba(91, 7, 7, .25), 0 18px 42px rgba(114, 10, 10, .28);
  transition: transform .18s cubic-bezier(.2,.8,.2,1), background .2s ease;
}
.punch-button:active { transform: scale(.97); }
.punch-button svg { width: 31px; height: 31px; margin-bottom: 6px; }
.punch-button strong { font-size: 1.18rem; }
.punch-button small { color: #ffd5cf; font-size: .68rem; }
.punch-button__halo { position: absolute; inset: -13px; z-index: -1; border: 1px solid rgba(220,38,38,.28); border-radius: 50%; }
.shift-stage[data-state="on"] .punch-button { background: #282624; border-color: #56514d; box-shadow: inset 0 -10px 0 rgba(0,0,0,.18), 0 18px 42px rgba(0,0,0,.2); }
.shift-stage[data-state="on"] .punch-button small { color: var(--paper-muted); }
.feedback { min-height: 44px; margin: 2px 12px 0; color: var(--paper-muted); text-align: center; font-size: .8rem; line-height: 1.5; }

.period-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; }
.period-heading h2 { margin: 4px 0 0; font-size: 1.45rem; letter-spacing: -.035em; }
.period-heading input { width: 145px; min-height: 40px; }
.history-summary { display: flex; gap: 38px; margin: 36px 0 22px; padding-bottom: 24px; border-bottom: 1px solid var(--line); }
.history-summary div { display: grid; gap: 3px; }
.history-summary strong { font-size: 1.75rem; letter-spacing: -.055em; font-variant-numeric: tabular-nums; }
.history-summary span { color: var(--paper-muted); font-size: .72rem; }
.turn-list { display: grid; }
.turn-row { display: flex; justify-content: space-between; align-items: center; gap: 18px; padding: 17px 2px; border-bottom: 1px solid #2c2a28; }
.turn-row div { display: grid; gap: 5px; }
.turn-row strong { text-transform: capitalize; font-size: .9rem; }
.turn-row span { color: var(--paper-muted); font-size: .76rem; }
.turn-row b { font-size: .84rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.loading-copy { color: var(--paper-muted); font-size: .8rem; }
.empty-state { display: grid; gap: 6px; padding: 34px 0; color: var(--paper-muted); }
.empty-state strong { color: var(--paper); }
.empty-state span { font-size: .8rem; line-height: 1.5; }

.confirm-sheet { width: min(100% - 20px, 500px); margin: auto auto 10px; border: 1px solid #403c38; border-radius: 22px; padding: 0; background: var(--panel-raised); color: var(--paper); box-shadow: 0 24px 90px rgba(0,0,0,.58); }
.confirm-sheet::backdrop { background: rgba(6,6,6,.78); }
.confirm-sheet form { padding: 12px 22px calc(18px + var(--safe-bottom)); }
.sheet-handle { display: block; width: 44px; height: 5px; margin: 0 auto 28px; border: 0; border-radius: 10px; background: #5d5853; cursor: pointer; }
.confirm-sheet h2 { margin: 6px 0 12px; font-size: 1.55rem; letter-spacing: -.045em; }
.confirm-sheet p:not(.eyebrow) { margin: 0; color: var(--paper-muted); line-height: 1.58; font-size: .88rem; }
.sheet-actions { display: grid; gap: 7px; margin-top: 28px; }
.toast { position: fixed; z-index: 70; left: 50%; bottom: calc(20px + var(--safe-bottom)); transform: translateX(-50%); width: max-content; max-width: calc(100% - 30px); padding: 12px 16px; border: 1px solid #48433f; border-radius: 9px; background: #2a2725; box-shadow: 0 14px 50px rgba(0,0,0,.45); font-size: .8rem; font-weight: 700; }

@media (min-width: 700px) {
  .employee-body { padding-block: 24px; }
  .employee-shell { min-height: calc(100vh - 48px); border: 1px solid #2b2927; border-radius: 26px; overflow: hidden; background: #151413; box-shadow: 0 28px 90px rgba(0,0,0,.3); }
  .login-view, .app-view { min-height: calc(100vh - 50px); }
  .confirm-sheet { margin-bottom: 28px; }
}

@media (prefers-reduced-motion: no-preference) {
  .login-view, .app-view { animation: reveal .4s cubic-bezier(.2,.8,.2,1) both; }
  @keyframes reveal { from { opacity: 0; transform: translateY(8px); } }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
