:root {
  --forest: #123d32;
  --forest-2: #1d5546;
  --ink: #17231f;
  --cream: #f6f2e9;
  --paper: #fffdf8;
  --line: #dcd6c9;
  --muted: #68736e;
  --coral: #e76f51;
  --coral-dark: #b94d36;
  --sage: #dfe9df;
  --gold: #c9a25d;
  --shadow: 0 18px 60px rgba(23, 35, 31, .10);
}

* { box-sizing: border-box; }
html { background: var(--cream); color: var(--ink); font-family: Manrope, system-ui, sans-serif; }
body { margin: 0; min-height: 100vh; }
button, input, select, textarea { font: inherit; }
button, summary { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
h1, h2, h3, p { margin-top: 0; }
h1, h2 { letter-spacing: -.035em; }

.eyebrow { color: var(--coral-dark); font-size: .72rem; font-weight: 800; letter-spacing: .14em; margin-bottom: .65rem; text-transform: uppercase; }
.muted { color: var(--muted); }
.brand-mark { align-items: center; background: var(--paper); border-radius: 50%; color: var(--forest); display: inline-flex; font-family: Prata, Georgia, serif; font-size: 2rem; height: 72px; justify-content: center; width: 72px; }
.brand-mark.small { background: var(--forest); color: var(--paper); font-size: 1rem; height: 34px; width: 34px; }
.button { align-items: center; border: 0; border-radius: 12px; cursor: pointer; display: inline-flex; font-weight: 800; justify-content: center; min-height: 46px; padding: 0 1.15rem; transition: transform .16s, background .16s, opacity .16s; }
.button:hover { transform: translateY(-1px); }
.button:disabled { cursor: wait; opacity: .6; transform: none; }
.button.primary { background: var(--forest); color: white; box-shadow: 0 8px 22px rgba(18,61,50,.18); }
.button.primary:hover { background: var(--forest-2); }
.button.secondary { background: var(--sage); color: var(--forest); }
.button.danger { background: #f7d9d1; color: #8e3523; }
.button.wide { width: 100%; }
.button.compact { font-size: .78rem; min-height: 36px; padding: 0 .85rem; }
.text-button { background: transparent; border: 0; color: var(--muted); cursor: pointer; font-size: .78rem; padding: .25rem; text-decoration: underline; text-underline-offset: 3px; }

.login-page { background: var(--cream); }
.login-shell { align-items: center; display: flex; justify-content: center; min-height: 100vh; padding: 1.25rem; }
.brand-panel { align-items: flex-start; background: var(--forest); color: white; display: flex; flex-direction: column; justify-content: center; overflow: hidden; padding: clamp(3rem, 8vw, 9rem); position: relative; }
.brand-panel::after { border: 1px solid rgba(255,255,255,.1); border-radius: 50%; content: ''; height: 520px; position: absolute; right: -240px; top: -210px; width: 520px; }
.brand-panel h1 { font-family: Prata, Georgia, serif; font-size: clamp(2.6rem, 5vw, 5.8rem); font-weight: 400; line-height: 1.08; margin: 1.6rem 0; max-width: 900px; }
.brand-panel .eyebrow { color: #f4ab98; margin-top: 2rem; }
.brand-copy { color: rgba(255,255,255,.72); line-height: 1.75; max-width: 610px; }
.quiet-rule { align-items: center; display: flex; gap: 1rem; margin-top: 4rem; }
.quiet-rule span { background: var(--coral); border-radius: 50%; height: 10px; box-shadow: 0 0 0 7px rgba(231,111,81,.15); width: 10px; }
.quiet-rule p { color: rgba(255,255,255,.64); font-size: .8rem; margin: 0; }
.login-card { background: var(--paper); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow); margin: 0; padding: clamp(1.5rem, 5vw, 2.8rem); width: min(440px, 100%); }
.login-card h1 { font-size: 2rem; margin-bottom: .65rem; }
.mobile-brand { align-items: center; display: flex; font-family: Prata, serif; font-size: 1.25rem; gap: .7rem; margin-bottom: 2.5rem; }
.stack-form, .dialog-form { display: grid; gap: 1.15rem; margin-top: 2rem; }
label { color: #33403b; display: grid; font-size: .78rem; font-weight: 800; gap: .5rem; }
input, select, textarea { background: white; border: 1px solid var(--line); border-radius: 11px; color: var(--ink); min-height: 48px; outline: none; padding: .75rem .9rem; transition: border .15s, box-shadow .15s; width: 100%; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--forest-2); box-shadow: 0 0 0 3px rgba(29,85,70,.10); }
.form-error { background: #f8ded8; border-left: 4px solid var(--coral); border-radius: 8px; color: #842f1e; font-size: .84rem; margin-top: 1.3rem; padding: .8rem 1rem; }
.secure-note { color: var(--muted); font-size: .7rem; margin: 1.5rem 0 0; text-align: center; }
.secure-note span { color: var(--forest-2); font-size: .6rem; }

.app-page { background: var(--cream); }
.app-header { align-items: center; background: rgba(255,253,248,.94); border-bottom: 1px solid var(--line); display: flex; height: 68px; justify-content: space-between; padding: 0 max(1.1rem, calc((100vw - 1180px)/2)); position: sticky; top: 0; z-index: 20; }
.wordmark { align-items: center; display: flex; font-family: Prata, serif; font-size: 1.12rem; gap: .7rem; text-decoration: none; }
.wordmark em { border-left: 1px solid var(--line); color: var(--muted); font-family: Manrope; font-size: .68rem; font-style: normal; font-weight: 800; letter-spacing: .12em; margin-left: .2rem; padding-left: .9rem; text-transform: uppercase; }
.header-person { align-items: center; display: flex; font-size: .8rem; font-weight: 800; gap: .65rem; }
.header-person form { display: inline-flex; }
.online-dot { background: #3d9a6a; border-radius: 50%; height: 8px; box-shadow: 0 0 0 4px rgba(61,154,106,.12); width: 8px; }

.employee-main { margin: 0 auto; max-width: 760px; padding: 3rem 1.15rem 5rem; }
.welcome-row { align-items: end; display: flex; justify-content: space-between; margin-bottom: 1.6rem; }
.welcome-row h1 { font-family: Prata, Georgia, serif; font-size: clamp(2rem, 7vw, 3rem); font-weight: 400; margin-bottom: 0; }
.connection-pill { align-items: center; background: var(--sage); border-radius: 999px; color: var(--forest); display: flex; font-size: .69rem; gap: .45rem; padding: .55rem .8rem; }
.connection-pill span { background: #3d9a6a; border-radius: 50%; height: 7px; width: 7px; }
.connection-pill.offline { background: #f7d9d1; color: #8e3523; }
.connection-pill.offline span { background: var(--coral); }
.shift-card { background: var(--paper); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow); margin-bottom: 1.4rem; overflow: hidden; padding: clamp(1.25rem, 5vw, 2.2rem); }
.shift-topline { align-items: start; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; margin-bottom: 1.5rem; padding-bottom: 1.4rem; }
.shift-topline h2 { font-size: 1.45rem; margin-bottom: .35rem; }
.shift-topline p:last-child { font-size: .8rem; margin-bottom: 0; }
.time-box { background: var(--cream); border-radius: 13px; min-width: 78px; padding: .65rem .8rem; text-align: center; }
.time-box small { color: var(--muted); display: block; font-size: .6rem; font-weight: 800; text-transform: uppercase; }
.time-box strong { color: var(--forest); display: block; font-size: 1.3rem; }
.state-panel { align-items: flex-start; background: #f2f0e9; border-radius: 15px; display: flex; gap: .9rem; margin: 1rem 0 1.35rem; padding: 1.1rem; }
.state-panel.success { background: var(--sage); }
.state-panel.warm { background: #f7edda; }
.state-panel.danger { background: #f8ded8; }
.state-panel h3 { font-size: .93rem; margin-bottom: .28rem; }
.state-panel p { color: var(--muted); font-size: .77rem; line-height: 1.5; margin-bottom: 0; }
.state-icon { align-items: center; background: white; border-radius: 50%; color: var(--forest); display: inline-flex; flex: 0 0 34px; font-weight: 900; height: 34px; justify-content: center; }
.action-button { font-size: 1rem; min-height: 58px; width: 100%; }
.action-button.queued { background: var(--gold); }
.problem-box { border-top: 1px solid var(--line); margin-top: 1.5rem; padding-top: 1.1rem; }
.problem-box summary { color: var(--muted); cursor: pointer; font-size: .75rem; font-weight: 800; list-style-position: inside; text-align: center; }
.issue-form { display: grid; gap: .9rem; margin-top: 1rem; }
.offline-note { color: var(--muted); font-size: .7rem; line-height: 1.6; margin: 1.4rem auto; max-width: 600px; text-align: center; }
.empty-state { background: var(--paper); border: 1px solid var(--line); border-radius: 22px; padding: 4rem 2rem; text-align: center; }
.empty-state span { color: var(--coral); font-size: 2.2rem; }

.manager-main { margin: 0 auto; max-width: 1220px; padding: 2.3rem 1.25rem 5rem; }
.manager-hero { align-items: center; border-radius: 20px; color: white; display: flex; justify-content: space-between; margin-bottom: 1rem; overflow: hidden; padding: 1.8rem 2rem; position: relative; }
.manager-hero.calm { background: var(--forest); }
.manager-hero.attention { background: #812f24; }
.manager-hero h1 { font-family: Prata, serif; font-size: clamp(2rem, 4vw, 3.2rem); font-weight: 400; margin-bottom: .35rem; }
.manager-hero p { color: rgba(255,255,255,.7); margin-bottom: 0; }
.manager-hero .eyebrow { color: #f6b09e; }
.hero-signal { align-items: center; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.18); border-radius: 999px; display: flex; font-size: .72rem; gap: .6rem; letter-spacing: .12em; padding: .7rem 1rem; }
.hero-signal span { animation: pulse 2s infinite; background: #66ce93; border-radius: 50%; height: 10px; width: 10px; }
.attention .hero-signal span { background: #ffab91; }
@keyframes pulse { 50% { box-shadow: 0 0 0 8px rgba(255,255,255,0); } 0%,100% { box-shadow: 0 0 0 0 rgba(255,255,255,.3); } }
.metric-grid { display: grid; gap: 1rem; grid-template-columns: repeat(4,1fr); margin-bottom: 1rem; }
.metric { background: var(--paper); border: 1px solid var(--line); border-radius: 15px; padding: 1.1rem 1.25rem; }
.metric span { color: var(--muted); display: block; font-size: .67rem; font-weight: 800; margin-bottom: .4rem; text-transform: uppercase; }
.metric strong { color: var(--forest); font-family: Prata, serif; font-size: 2rem; font-weight: 400; }
.alert-metric strong { color: var(--coral-dark); }
.notification-setup { align-items: center; background: #f7edda; border: 1px solid #e8d8ba; border-radius: 15px; display: grid; gap: 1rem; grid-template-columns: auto 1fr auto auto; margin-bottom: 1rem; padding: 1rem 1.2rem; }
.notification-setup.enabled { background: var(--sage); border-color: #cbdaca; }
.notification-setup h2 { font-size: .9rem; margin-bottom: .25rem; }
.notification-setup p { color: var(--muted); font-size: .72rem; margin: 0; }
.setup-icon { align-items: center; background: white; border-radius: 50%; color: var(--forest); display: flex; font-weight: 900; height: 34px; justify-content: center; width: 34px; }
.manager-columns { display: grid; gap: 1rem; grid-template-columns: .85fr 1.15fr; }
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: 17px; overflow: hidden; }
.panel-heading { align-items: center; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; padding: 1.25rem 1.35rem; }
.panel-heading .eyebrow { margin-bottom: .25rem; }
.panel-heading h2 { font-size: 1.25rem; margin: 0; }
.count-badge { align-items: center; background: var(--coral); border-radius: 999px; color: white; display: flex; font-size: .7rem; font-weight: 900; height: 28px; justify-content: center; min-width: 28px; padding: 0 .5rem; }
.alert-list, .shift-list { max-height: 510px; overflow: auto; }
.alert-item { display: grid; grid-template-columns: 4px 1fr; }
.alert-item + .alert-item { border-top: 1px solid var(--line); }
.alert-rail { background: var(--coral); }
.alert-item.warning .alert-rail { background: var(--gold); }
.alert-item.resolved, .alert-item.acknowledged { opacity: .58; }
.alert-body { padding: 1.05rem 1.2rem 1.2rem; }
.alert-meta { color: var(--muted); display: flex; font-size: .62rem; font-weight: 700; justify-content: space-between; text-transform: uppercase; }
.alert-body h3 { font-size: .88rem; margin: .55rem 0 .3rem; }
.alert-body p { color: var(--muted); font-size: .73rem; line-height: 1.5; margin-bottom: .8rem; }
.resolved-label { color: var(--forest-2); font-size: .67rem; font-weight: 800; }
.manager-shift { align-items: center; display: grid; gap: .85rem; grid-template-columns: auto 1fr auto auto; padding: 1rem 1.2rem; }
.manager-shift + .manager-shift { border-top: 1px solid var(--line); }
.avatar { align-items: center; background: var(--sage); border-radius: 50%; color: var(--forest); display: flex; font-family: Prata, serif; height: 38px; justify-content: center; width: 38px; }
.shift-person h3 { font-size: .83rem; margin: 0 0 .18rem; }
.shift-person h3 small { color: var(--muted); font-size: .62rem; font-weight: 600; }
.shift-person p { color: var(--muted); font-size: .69rem; margin: 0; }
.status-chip { background: #eeeae1; border-radius: 999px; color: var(--muted); display: inline-block; font-size: .62rem; font-weight: 900; padding: .42rem .65rem; white-space: nowrap; }
.status-chip.confirmed, .status-chip.checked_in { background: var(--sage); color: var(--forest); }
.status-chip.missed, .status-chip.issue, .status-chip.danger { background: #f7d9d1; color: #8e3523; }
.call-link { color: var(--forest-2); font-size: .67rem; font-weight: 800; }
.empty-compact { color: var(--muted); padding: 3rem; text-align: center; }
.empty-compact span { color: var(--forest-2); font-size: 1.7rem; }
.admin-panel { margin-top: 1rem; }
.admin-actions { display: grid; gap: 1rem; grid-template-columns: repeat(2,1fr); padding: 1.2rem; }
.admin-action { align-items: center; background: var(--cream); border: 1px solid var(--line); border-radius: 13px; color: var(--ink); cursor: pointer; display: grid; gap: .15rem; grid-template-columns: auto 1fr; padding: 1rem; text-align: left; }
.admin-action span { align-items: center; background: white; border-radius: 50%; color: var(--forest); display: flex; font-size: 1.1rem; grid-row: span 2; height: 38px; justify-content: center; margin-right: .6rem; width: 38px; }
.admin-action b { font-size: .8rem; }
.admin-action small { color: var(--muted); font-size: .66rem; }
.audit-panel { color: var(--muted); font-size: .72rem; margin-top: 1.2rem; }
.audit-panel summary { cursor: pointer; font-weight: 800; }
.audit-list { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; margin-top: .7rem; padding: .7rem 1rem; }
.audit-list p { display: grid; gap: .7rem; grid-template-columns: 45px 100px 1fr; margin: 0; padding: .45rem 0; }
.audit-list p + p { border-top: 1px solid var(--line); }
.audit-list b { color: var(--ink); }

.app-dialog { background: var(--paper); border: 0; border-radius: 18px; box-shadow: var(--shadow); color: var(--ink); padding: 0; width: min(520px, calc(100% - 2rem)); }
.app-dialog::backdrop { background: rgba(10,24,19,.63); backdrop-filter: blur(4px); }
.dialog-form { margin: 0; padding: 1.5rem; }
.dialog-heading { align-items: start; display: flex; justify-content: space-between; }
.dialog-heading h2 { margin: 0; }
.dialog-close { background: var(--cream); border: 0; border-radius: 50%; color: var(--muted); cursor: pointer; font-size: 1.4rem; height: 34px; width: 34px; }
.form-grid { display: grid; gap: 1rem; grid-template-columns: 1fr 1fr; }
.toast { background: var(--forest); border-radius: 12px; bottom: max(1rem, env(safe-area-inset-bottom)); box-shadow: var(--shadow); color: white; font-size: .8rem; font-weight: 700; left: 50%; max-width: calc(100% - 2rem); opacity: 0; padding: .9rem 1.15rem; pointer-events: none; position: fixed; transform: translate(-50%, 15px); transition: .2s; z-index: 100; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.warning { background: #8a5c16; }
.toast.error { background: #8b3023; }

@media (max-width: 850px) {
  .brand-panel { display: none; }
  .login-card { padding: 2rem 1.4rem; }
  .manager-columns { grid-template-columns: 1fr; }
  .metric-grid { grid-template-columns: repeat(2,1fr); }
  .notification-setup { grid-template-columns: auto 1fr; }
  .notification-setup .button, .notification-setup .status-chip, .notification-setup .text-button { grid-column: 1 / -1; width: 100%; }
}

@media (max-width: 560px) {
  .app-header { height: 60px; padding: 0 .9rem; }
  .header-person > span:not(.online-dot) { display: none; }
  .wordmark em { display: none; }
  .employee-main, .manager-main { padding-top: 1.4rem; }
  .welcome-row { align-items: start; display: grid; gap: .75rem; grid-template-columns: minmax(0,1fr) auto; }
  .welcome-row > div:first-child { min-width: 0; }
  .welcome-row h1 { font-size: 1.85rem; }
  .connection-pill { margin-top: .2rem; padding: .45rem .65rem; }
  .shift-card { border-radius: 16px; padding: 1.1rem; }
  .manager-hero { align-items: flex-start; flex-direction: column; gap: 1.1rem; padding: 1.35rem; }
  .manager-hero h1 { font-size: 2rem; }
  .metric { padding: .9rem; }
  .metric strong { font-size: 1.65rem; }
  .manager-shift { grid-template-columns: auto 1fr auto; }
  .call-link { grid-column: 2; }
  .admin-actions { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .audit-list p { grid-template-columns: 40px 1fr; }
  .audit-list span { grid-column: 2; }
}

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