:root {
  --navy: #1b2548;
  --navy-2: #23315d;
  --sage: #7f9996;
  --sage-soft: #e7efed;
  --cream: #f6f4ee;
  --paper: #ffffff;
  --ink: #182033;
  --muted: #6f7787;
  --line: #e4e7ec;
  --green: #2f8f63;
  --green-soft: #e6f5ed;
  --amber: #c17b21;
  --amber-soft: #fff2df;
  --red: #b94c4c;
  --red-soft: #fae9e9;
  --shadow: 0 16px 38px rgba(27, 37, 72, 0.08);
  --radius: 18px;
}

* { box-sizing: border-box; }
html { background: var(--cream); }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--cream);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; }
button { cursor: pointer; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 286px 1fr; }
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 28px 22px 24px;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #182241 0%, #1b2548 72%, #202d55 100%);
  color: white;
}
.brand-lockup { padding: 8px 8px 28px; border-bottom: 1px solid rgba(255,255,255,.12); }
.brand-logo { width: 100%; max-width: 228px; display: block; padding: 12px 14px; border-radius: 14px; background: rgba(255,255,255,.97); box-shadow: 0 10px 28px rgba(0,0,0,.12); }
.app-title { margin-top: 22px; font-size: 20px; font-weight: 700; letter-spacing: -.02em; }
.app-subtitle { margin-top: 6px; color: rgba(255,255,255,.64); font-size: 13px; }
.nav-list { display: grid; gap: 7px; margin-top: 26px; }
.nav-item {
  width: 100%; border: 0; color: rgba(255,255,255,.72); background: transparent;
  display: flex; align-items: center; gap: 12px; padding: 13px 14px; border-radius: 12px;
  text-align: left; font-size: 14px; font-weight: 600; transition: .18s ease;
}
.nav-item:hover { background: rgba(255,255,255,.07); color: white; }
.nav-item.active { background: rgba(127,153,150,.22); color: white; box-shadow: inset 3px 0 0 var(--sage); }
.nav-icon { width: 22px; text-align: center; color: #b7cbc8; font-size: 16px; }
.sidebar-footer { margin-top: auto; padding: 18px 10px 4px; border-top: 1px solid rgba(255,255,255,.12); }
.platform-label { color: #a9bfbb; font-size: 10px; font-weight: 800; letter-spacing: .13em; }
.platform-name { margin-top: 7px; color: rgba(255,255,255,.68); font-size: 12px; }

.main-content { padding: 0 42px 48px; min-width: 0; }
.topbar {
  min-height: 112px; display: flex; align-items: center; justify-content: space-between; gap: 24px;
  border-bottom: 1px solid rgba(27,37,72,.08);
}
.eyebrow { color: var(--sage); font-size: 10px; font-weight: 800; letter-spacing: .16em; }
h1 { margin: 6px 0 0; font-size: 30px; line-height: 1.1; color: var(--navy); letter-spacing: -.035em; }
h2 { margin: 0; font-size: 24px; color: var(--navy); letter-spacing: -.025em; }
h3 { margin: 0; font-size: 16px; color: var(--navy); }
p { color: var(--muted); }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.mobile-menu { display: none; }
.mode-pill { padding: 8px 11px; border-radius: 999px; font-size: 10px; font-weight: 800; letter-spacing: .1em; }
.mode-pill.preview { color: var(--amber); background: var(--amber-soft); border: 1px solid #f0d4ad; }
.mode-pill.live { color: var(--green); background: var(--green-soft); border: 1px solid #bddfce; }
.button {
  border: 0; border-radius: 11px; padding: 11px 15px; font-size: 13px; font-weight: 700; transition: transform .14s ease, box-shadow .14s ease, opacity .14s ease;
}
.button:hover { transform: translateY(-1px); }
.button:disabled { cursor: not-allowed; opacity: .45; transform: none; }
.button.secondary { color: var(--navy); background: white; border: 1px solid var(--line); box-shadow: 0 5px 14px rgba(27,37,72,.04); }
.button.primary { color: white; background: var(--navy); box-shadow: 0 9px 18px rgba(27,37,72,.18); }
.button.live { color: white; background: var(--green); box-shadow: 0 9px 18px rgba(47,143,99,.2); }
.button.danger { color: var(--red); background: var(--red-soft); border: 1px solid #efc7c7; }

.mode-banner {
  margin: 24px 0 28px; padding: 16px 18px; border-radius: 14px; display: flex; align-items: center; justify-content: space-between; gap: 18px;
}
.mode-banner strong { display: block; font-size: 14px; color: var(--navy); }
.mode-banner span { display: block; margin-top: 4px; font-size: 12px; color: var(--muted); }
.mode-banner.preview { background: var(--amber-soft); border: 1px solid #efd5b1; }
.mode-banner.live { background: var(--green-soft); border: 1px solid #bedfce; }

.page { display: none; }
.page.active { display: block; }
.status-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 30px; }
.status-card { background: rgba(255,255,255,.72); border: 1px solid rgba(27,37,72,.08); border-radius: 14px; padding: 15px 16px; }
.status-card .label { color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.status-card .value { margin-top: 6px; color: var(--navy); font-size: 15px; font-weight: 800; display: flex; align-items: center; gap: 8px; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; background: #aab0ba; box-shadow: 0 0 0 4px rgba(170,176,186,.14); }
.dot.good { background: var(--green); box-shadow: 0 0 0 4px rgba(47,143,99,.13); }
.dot.warn { background: var(--amber); box-shadow: 0 0 0 4px rgba(193,123,33,.13); }
.dot.bad { background: var(--red); box-shadow: 0 0 0 4px rgba(185,76,76,.12); }
.section-heading { display: flex; justify-content: space-between; align-items: end; gap: 18px; margin-bottom: 18px; }
.section-heading p { margin: 7px 0 0; font-size: 13px; }
.timestamp { color: var(--muted); font-size: 11px; white-space: nowrap; }

.door-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.door-card {
  position: relative; min-height: 250px; overflow: hidden; background: var(--paper); border: 1px solid rgba(27,37,72,.08);
  border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow);
}
.door-card::after { display: none; }
.door-card.active-window { border-color: rgba(47,143,99,.36); box-shadow: 0 18px 40px rgba(47,143,99,.11); }
.door-card-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; position: relative; z-index: 1; }
.door-name { font-size: 18px; font-weight: 800; color: var(--navy); letter-spacing: -.02em; }
.state-badge {
  display: inline-flex; align-items: center; gap: 7px; flex: 0 0 auto; border-radius: 10px; padding: 7px 10px;
  border: 1px solid rgba(27,37,72,.10); background: #fff; box-shadow: 0 4px 12px rgba(27,37,72,.05);
  font-size: 10px; font-weight: 850; letter-spacing: .07em;
}
.state-badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .78; }
.state-badge.on { color: var(--green); background: #f7fcf9; border-color: #cce6d8; }
.state-badge.off { color: #667570; background: #f8faf9; border-color: #dfe6e3; }
.state-badge.unknown { color: var(--amber); background: #fffaf3; border-color: #efd8b8; }
.door-body { position: relative; z-index: 1; margin-top: 28px; }
.window-label { color: var(--sage); font-size: 10px; font-weight: 800; letter-spacing: .12em; }
.window-date { margin-top: 8px; color: var(--muted); font-size: 14px; font-weight: 800; }
.window-time { margin-top: 2px; font-size: 28px; font-weight: 800; color: var(--navy); letter-spacing: -.04em; }
.window-events { margin-top: 12px; display: grid; gap: 4px; color: var(--ink); font-size: 14px; font-weight: 650; }
.reason-row { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 18px; }
.reason-chip { padding: 6px 8px; border-radius: 8px; color: var(--navy-2); background: var(--sage-soft); font-size: 10px; font-weight: 750; }
.no-window { color: var(--muted); font-size: 14px; margin-top: 12px; }

.schedule-layout { display: grid; gap: 18px; }
.schedule-card { background: white; border: 1px solid rgba(27,37,72,.08); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.schedule-card-header { padding: 20px 22px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.schedule-count { color: var(--muted); font-size: 11px; }
.schedule-table { width: 100%; border-collapse: collapse; }
.schedule-table th { padding: 12px 22px; text-align: left; color: var(--muted); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; background: #fafbfc; }
.schedule-table td { padding: 16px 22px; border-top: 1px solid #eef0f3; vertical-align: top; font-size: 13px; }
.schedule-date { color: var(--navy); font-weight: 800; }
.schedule-time { color: var(--ink); font-weight: 750; white-space: nowrap; }
.schedule-events { color: var(--ink); font-weight: 650; }
.schedule-events small { display: block; color: var(--muted); font-weight: 500; margin-top: 4px; }
.empty-state { padding: 30px 22px; color: var(--muted); font-size: 13px; }

.feed-section { margin-bottom: 28px; }
.feed-section-title { margin-bottom: 12px; color: var(--sage); font-size: 10px; font-weight: 800; letter-spacing: .12em; }
.feed-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.feed-card { background: white; border: 1px solid rgba(27,37,72,.08); border-radius: 16px; padding: 18px; box-shadow: 0 10px 24px rgba(27,37,72,.05); }
.feed-header { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.feed-title { color: var(--navy); font-weight: 800; }
.feed-meta { color: var(--muted); font-size: 11px; margin-top: 5px; }
.feed-actions { display: flex; gap: 8px; margin-top: 14px; }
.feed-url { width: 100%; margin-top: 14px; border: 1px solid var(--line); border-radius: 10px; background: #fafbfc; color: #4b5361; padding: 10px 11px; font-size: 11px; }
.toggle { width: 42px; height: 24px; position: relative; border-radius: 999px; border: 0; background: #d7dce3; transition: .2s; }
.toggle::after { content: ""; position: absolute; width: 18px; height: 18px; border-radius: 50%; top: 3px; left: 3px; background: white; box-shadow: 0 2px 5px rgba(0,0,0,.18); transition: .2s; }
.toggle.on { background: var(--green); }
.toggle.on::after { transform: translateX(18px); }

.settings-card { background: white; border: 1px solid rgba(27,37,72,.08); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.settings-section { padding: 26px; display: grid; grid-template-columns: minmax(240px, .8fr) 1.6fr; gap: 32px; border-bottom: 1px solid var(--line); }
.settings-section p { margin: 7px 0 0; font-size: 12px; line-height: 1.55; max-width: 420px; }
.field-grid { display: grid; gap: 14px; align-content: start; }
.field-grid.two { grid-template-columns: repeat(2, minmax(0,1fr)); }
.field-grid.three { grid-template-columns: repeat(3, minmax(0,1fr)); }
.field { display: grid; gap: 8px; }
.field > span { color: #4d5667; font-size: 11px; font-weight: 750; }
.field input { width: 100%; border: 1px solid var(--line); border-radius: 11px; padding: 11px 12px; color: var(--ink); background: #fbfbfc; outline: none; }
.field input:focus { border-color: var(--sage); box-shadow: 0 0 0 3px rgba(127,153,150,.13); }
.number-field { display: grid; grid-template-columns: 1fr auto; align-items: center; border: 1px solid var(--line); background: #fbfbfc; border-radius: 11px; overflow: hidden; }
.number-field input { border: 0; background: transparent; border-radius: 0; }
.number-field em { color: var(--muted); font-style: normal; font-size: 11px; padding-right: 12px; }
.form-actions { padding: 18px 26px; display: flex; align-items: center; justify-content: flex-end; gap: 14px; background: #fafbfc; }
.form-message { color: var(--muted); font-size: 12px; margin-right: auto; }

.system-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 14px; margin-bottom: 18px; }
.system-card { background: white; border: 1px solid rgba(27,37,72,.08); border-radius: 16px; padding: 18px; box-shadow: 0 10px 24px rgba(27,37,72,.05); }
.system-card .kicker { color: var(--sage); font-size: 10px; font-weight: 800; letter-spacing: .1em; }
.system-card .big { margin-top: 9px; color: var(--navy); font-size: 20px; font-weight: 800; }
.system-card .small { margin-top: 6px; color: var(--muted); font-size: 11px; }
.log-card { background: #111827; color: #d7e0ed; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.log-header { padding: 18px 20px; display: flex; align-items: center; justify-content: space-between; gap: 16px; background: #192236; border-bottom: 1px solid rgba(255,255,255,.08); }
.log-header h3 { color: white; }
.log-header p { margin: 5px 0 0; color: #8f9bae; font-size: 11px; }
.log-card pre { margin: 0; padding: 20px; max-height: 520px; overflow: auto; white-space: pre-wrap; font: 11px/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

.modal-backdrop { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 20px; background: rgba(11,18,35,.7); backdrop-filter: blur(8px); }
.modal-backdrop[hidden] { display: none; }
.modal { width: min(470px, 100%); background: white; border-radius: 24px; padding: 30px; text-align: center; box-shadow: 0 30px 80px rgba(0,0,0,.3); }
.modal-mark { width: 70px; height: 70px; object-fit: contain; }
.modal-kicker { margin-top: 16px; color: var(--sage); font-size: 10px; font-weight: 800; letter-spacing: .13em; }
.modal h2 { margin-top: 7px; font-size: 25px; }
.modal p { font-size: 13px; line-height: 1.55; }
.modal .field { margin-top: 22px; text-align: left; }
.modal-actions { margin-top: 22px; display: flex; justify-content: flex-end; gap: 10px; }

.toast { position: fixed; right: 24px; bottom: 24px; z-index: 60; max-width: 380px; padding: 13px 16px; border-radius: 12px; background: var(--navy); color: white; font-size: 12px; font-weight: 650; box-shadow: 0 16px 40px rgba(27,37,72,.25); opacity: 0; pointer-events: none; transform: translateY(12px); transition: .2s ease; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { background: var(--red); }

@media (max-width: 1050px) {
  .app-shell { grid-template-columns: 240px 1fr; }
  .main-content { padding-left: 28px; padding-right: 28px; }
  .status-strip { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .settings-section { grid-template-columns: 1fr; }
  .field-grid.three { grid-template-columns: repeat(2, minmax(0,1fr)); }
}

@media (max-width: 760px) {
  .app-shell { display: block; }
  .sidebar { position: fixed; z-index: 45; width: 286px; left: -300px; transition: .22s ease; }
  .sidebar.open { left: 0; box-shadow: 20px 0 50px rgba(0,0,0,.25); }
  .main-content { padding: 0 18px 32px; }
  .topbar { min-height: 92px; }
  .mobile-menu { display: inline-grid; place-items: center; width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 10px; background: white; color: var(--navy); }
  .topbar { justify-content: flex-start; }
  .topbar-actions { margin-left: auto; }
  .topbar-actions .button { display: none; }
  h1 { font-size: 25px; }
  .mode-banner { align-items: flex-start; flex-direction: column; }
  .status-strip, .door-grid, .feed-grid, .system-grid { grid-template-columns: 1fr; }
  .field-grid.two, .field-grid.three { grid-template-columns: 1fr; }
  .schedule-table th:nth-child(4), .schedule-table td:nth-child(4) { display: none; }
  .schedule-table th, .schedule-table td { padding-left: 14px; padding-right: 14px; }
  .section-heading { align-items: flex-start; flex-direction: column; }
}

.login-body { min-height: 100vh; background: var(--cream); }
.login-shell { min-height: 100vh; display: grid; grid-template-columns: 1.15fr .85fr; }
.login-brand { position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: center; padding: 72px 8vw; background: linear-gradient(145deg, #17213f 0%, #1b2548 62%, #26355f 100%); color: white; }
.login-brand::before { content: ""; position: absolute; width: 520px; height: 520px; border-radius: 50%; left: -180px; bottom: -250px; background: rgba(127,153,150,.12); }
.login-brand::after { content: ""; position: absolute; width: 300px; height: 300px; border-radius: 50%; right: -100px; top: -90px; border: 1px solid rgba(255,255,255,.12); }
.login-logo { position: relative; z-index: 1; width: min(540px, 88%); padding: 18px 22px; border-radius: 22px; background: rgba(255,255,255,.97); box-shadow: 0 20px 48px rgba(0,0,0,.18); }
.login-copy { position: relative; z-index: 1; margin-top: 58px; max-width: 560px; }
.login-copy .eyebrow { color: #afc4c0; }
.login-copy h1 { color: white; font-size: clamp(38px, 4.5vw, 70px); margin-top: 14px; }
.login-copy p { max-width: 480px; color: rgba(255,255,255,.68); font-size: 16px; line-height: 1.6; }
.login-card { align-self: center; width: min(430px, calc(100% - 48px)); margin: 0 auto; padding: 38px; background: white; border: 1px solid rgba(27,37,72,.08); border-radius: 24px; box-shadow: 0 30px 70px rgba(27,37,72,.12); }
.login-mark { width: 72px; height: 72px; object-fit: contain; }
.login-kicker { margin-top: 22px; color: var(--sage); font-size: 10px; font-weight: 800; letter-spacing: .13em; }
.login-card h2 { margin-top: 8px; font-size: 28px; }
.login-card > p { margin: 8px 0 24px; font-size: 13px; }
.login-card form { display: grid; gap: 16px; }
.login-error { color: var(--red); background: var(--red-soft); border: 1px solid #efc7c7; border-radius: 10px; padding: 10px 12px; font-size: 12px; }
.login-button { width: 100%; margin-top: 2px; padding: 13px 16px; }
.login-foot { margin-top: 24px; color: #9aa1ac; font-size: 10px; text-align: center; }

@media (max-width: 860px) {
  .login-shell { grid-template-columns: 1fr; }
  .login-brand { min-height: 38vh; padding: 46px 28px; }
  .login-logo { width: min(430px, 80%); }
  .login-copy { margin-top: 28px; }
  .login-copy h1 { font-size: 38px; }
  .login-copy p { font-size: 14px; }
  .login-card { margin: 34px auto 48px; }
}
.sidebar-logout { margin-top: 14px; padding: 0; border: 0; background: transparent; color: rgba(255,255,255,.56); font-size: 11px; font-weight: 650; }
.sidebar-logout:hover { color: white; }

/* v1.1 — named accounts, manual door control, and audit history */
.signed-in-name { margin-top: 8px; color: white; font-size: 13px; font-weight: 800; }
.signed-in-role { margin-top: 3px; color: #afc4c0; font-size: 9px; font-weight: 800; letter-spacing: .12em; }
.sidebar-link, .sidebar-logout { margin-top: 13px; padding: 0; border: 0; background: transparent; color: rgba(255,255,255,.56); font-size: 11px; font-weight: 650; }
.sidebar-link:hover, .sidebar-logout:hover { color: white; }

.control-source { margin-top: 4px; color: var(--muted); font-size: 10px; font-weight: 650; }
.door-card { min-height: 330px; display: flex; flex-direction: column; }
.door-card.manual-window { border-color: rgba(193,123,33,.38); box-shadow: 0 18px 40px rgba(193,123,33,.10); }
.door-body { flex: 1; }
.manual-active-banner { position: relative; z-index: 1; margin-top: 17px; padding: 11px 12px; border: 1px solid #efd5b1; border-radius: 11px; background: var(--amber-soft); display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--amber); }
.manual-active-banner > div { display: flex; align-items: center; gap: 8px; }
.manual-active-banner strong { font-size: 11px; color: #845113; }
.manual-active-banner > span { color: #8d6b3b; font-size: 10px; text-align: right; }
.manual-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 0 4px rgba(193,123,33,.12); }
.door-actions { position: relative; z-index: 1; margin: 22px -24px -24px; padding: 15px 24px; border-top: 1px solid var(--line); background: #fafbfc; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.manual-label { color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: .12em; }
.button.manual-open { color: white; background: var(--navy); padding: 9px 13px; }
.button.manual-release { color: var(--amber); background: var(--amber-soft); border: 1px solid #efd5b1; padding: 9px 13px; }

.manual-modal { width: min(600px, 100%); }
.duration-picker { margin-top: 22px; display: grid; gap: 14px; }
.quick-duration-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.duration-option { border: 1px solid var(--line); border-radius: 13px; padding: 15px; background: #fafbfc; text-align: left; color: var(--ink); transition: .16s ease; }
.duration-option:hover { border-color: #bcc6d2; transform: translateY(-1px); }
.duration-option.selected { border-color: var(--sage); background: var(--sage-soft); box-shadow: 0 0 0 3px rgba(127,153,150,.12); }
.duration-option strong { display: block; color: var(--navy); font-size: 14px; }
.duration-option span { display: block; margin-top: 4px; color: var(--muted); font-size: 10px; }
.duration-field { margin-top: 0; text-align: left; }
.duration-field select { font-size: 13px; font-weight: 700; background: white; }

.field select { width: 100%; border: 1px solid var(--line); border-radius: 11px; padding: 11px 12px; color: var(--ink); background: #fbfbfc; outline: none; }
.field select:focus { border-color: var(--sage); box-shadow: 0 0 0 3px rgba(127,153,150,.13); }
.form-modal { text-align: left; width: min(520px, 100%); }
.form-modal .modal-kicker, .form-modal h2 { text-align: center; }
.form-modal form { margin-top: 20px; display: grid; gap: 14px; }
.form-modal .field { margin-top: 0; }
.check-field { display: flex; align-items: center; gap: 9px; color: #4d5667; font-size: 11px; font-weight: 700; }
.check-field input { width: 16px; height: 16px; accent-color: var(--green); }

.audit-card { margin-top: 18px; background: white; border: 1px solid rgba(27,37,72,.08); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.audit-header { padding: 18px 20px; display: flex; align-items: center; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--line); }
.audit-header p { margin: 5px 0 0; font-size: 11px; }
.audit-list { max-height: 480px; overflow: auto; }
.audit-row { display: grid; grid-template-columns: 150px 1fr; gap: 16px; padding: 13px 20px; border-top: 1px solid #eef0f3; font-size: 12px; }
.audit-row:first-child { border-top: 0; }
.audit-time { color: var(--muted); font-size: 10px; }
.audit-copy { color: #4d5667; }
.audit-copy strong { color: var(--navy); }
.audit-copy span { color: var(--ink); font-weight: 700; }

.role-guide { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.role-guide > div { padding: 15px 17px; border: 1px solid rgba(27,37,72,.08); border-radius: 14px; background: rgba(255,255,255,.72); }
.role-guide strong { color: var(--navy); font-size: 12px; }
.role-guide span { display: block; margin-top: 5px; color: var(--muted); font-size: 10px; line-height: 1.5; }
.users-card { background: white; border: 1px solid rgba(27,37,72,.08); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.user-row { display: grid; grid-template-columns: 46px minmax(180px, 1fr) 110px 100px auto; align-items: center; gap: 14px; padding: 16px 20px; border-top: 1px solid #eef0f3; }
.user-row:first-child { border-top: 0; }
.user-row.disabled-user { opacity: .58; }
.user-avatar { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px; background: var(--sage-soft); color: var(--navy); font-size: 12px; font-weight: 850; }
.user-identity strong { display: block; color: var(--navy); font-size: 13px; }
.user-identity span { display: block; margin-top: 4px; color: var(--muted); font-size: 10px; }
.role-badge { display: inline-flex; padding: 6px 8px; border-radius: 8px; font-size: 9px; font-weight: 850; letter-spacing: .07em; }
.role-badge.admin { color: var(--navy); background: #e6eafa; }
.role-badge.operator { color: var(--green); background: var(--green-soft); }
.role-badge.viewer { color: #626b78; background: #f0f2f5; }
.user-status { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 10px; font-weight: 700; }
.user-actions { display: flex; justify-content: flex-end; align-items: center; gap: 7px; }
.small-button { padding: 8px 10px; font-size: 10px; }
.icon-danger { width: 32px; height: 32px; border: 1px solid #efc7c7; border-radius: 9px; background: var(--red-soft); color: var(--red); font-size: 20px; line-height: 1; }

@media (max-width: 1100px) {
  .user-row { grid-template-columns: 46px 1fr 90px auto; }
  .user-status { display: none; }
}

@media (max-width: 760px) {
  .door-card { min-height: 320px; }
  .manual-active-banner { align-items: flex-start; flex-direction: column; }
  .manual-active-banner > span { text-align: left; }
  .quick-duration-grid { grid-template-columns: 1fr; }
  .role-guide { grid-template-columns: 1fr; }
  .user-row { grid-template-columns: 42px 1fr auto; }
  .user-row > div:nth-child(3) { grid-column: 2; }
  .user-actions { grid-column: 1 / -1; justify-content: flex-start; }
  .audit-row { grid-template-columns: 1fr; gap: 4px; }
}

/* v1.3 door safety, calendar, and one-off access */
.command-safety { margin: 14px 0 0; padding: 12px; border-radius: 12px; background: #f7f8fa; border: 1px solid var(--line); display:flex; justify-content:space-between; align-items:center; gap:12px; }
.command-safety.disabled { background: var(--red-soft); border-color:#ecc5c5; }
.command-copy strong { display:block; color:var(--navy); font-size:13px; }
.command-copy span { color:var(--muted); font-size:12px; }
.command-toggle { border:0; border-radius:999px; padding:8px 12px; font-size:11px; font-weight:800; background:var(--red-soft); color:var(--red); }
.command-toggle.on { background:var(--green-soft); color:var(--green); }
.door-card.commands-disabled { opacity:.78; border:2px solid #e4b7b7; }
.commands-warning { margin:10px 0; padding:10px 12px; border-radius:10px; background:var(--red-soft); color:var(--red); font-size:12px; font-weight:800; }
.calendar-toolbar { display:flex; flex-wrap:wrap; gap:10px; align-items:end; margin:18px 0; }
.calendar-date-field { min-width:180px; margin-left:auto; }
.door-legend { display:flex; flex-wrap:wrap; gap:10px; margin-bottom:16px; }
.legend { padding:7px 11px; border-radius:999px; color:white; font-size:12px; font-weight:800; }
.legend.main,.calendar-event.main { background:#294c8f; }.legend.gym,.calendar-event.gym { background:#2f8f63; }.legend.soccer,.calendar-event.soccer { background:#b36b22; }.legend.west,.calendar-event.west { background:#7b4f9d; }
.calendar-content { display:grid; gap:18px; }
.calendar-day { background:white; border:1px solid var(--line); border-radius:var(--radius); box-shadow:var(--shadow); overflow:hidden; }
.calendar-day-header { padding:14px 18px; background:#f7f8fa; color:var(--navy); font-weight:800; }
.calendar-door-row { display:grid; grid-template-columns:150px 1fr; gap:14px; padding:14px 18px; border-top:1px solid var(--line); }
.calendar-door-name { font-weight:800; color:var(--navy); }
.calendar-events { display:grid; gap:8px; }
.calendar-event { color:white; padding:10px 12px; border-radius:10px; display:flex; justify-content:space-between; gap:14px; align-items:flex-start; }
.calendar-event small { display:block; opacity:.84; margin-top:4px; }
.calendar-event-actions { white-space:nowrap; }
.calendar-event-actions button { border:0; background:rgba(255,255,255,.2); color:white; border-radius:7px; padding:5px 7px; margin-left:4px; }
.pco-edit-link { display:inline-block; background:rgba(255,255,255,.94); color:#183153; text-decoration:none; font-weight:700; font-size:12px; border-radius:7px; padding:6px 8px; margin-left:4px; }
.pco-edit-link:hover { background:white; text-decoration:underline; }
.calendar-event-name { display:inline; }
.event-separator { opacity:.75; }
.calendar-empty { color:var(--muted); font-size:13px; padding:6px 0; }
@media(max-width:760px){.calendar-door-row{grid-template-columns:1fr}.calendar-date-field{margin-left:0}.calendar-event{display:block}.calendar-event-actions{margin-top:8px}}


/* v1.4 local door schedule overrides */
.calendar-event.suppressed { background:#5f6670 !important; border:2px dashed rgba(255,255,255,.65); opacity:.92; }
.calendar-event-actions { display:flex; flex-wrap:wrap; justify-content:flex-end; gap:5px; }
.calendar-event-actions button { cursor:pointer; font:inherit; }
.override-detail { display:block; margin-top:7px !important; opacity:1 !important; }
.override-badge { display:inline-block; padding:2px 7px; border-radius:999px; background:rgba(255,255,255,.9); color:#243e67; font-size:10px; font-weight:900; letter-spacing:.06em; margin-right:5px; }
.override-badge.disabled { color:#7b2f2f; }
.local-only-note { background:#eef5f1; border:1px solid #c9ddd2; border-radius:10px; padding:11px 13px; color:#294b3c; }
.override-summary { display:grid; gap:9px; background:#f7f8fa; border:1px solid var(--line); border-radius:12px; padding:13px; margin:14px 0; }
.override-summary div { display:grid; grid-template-columns:150px 1fr; gap:10px; align-items:start; }
.override-summary span { color:var(--muted); font-size:12px; font-weight:800; text-transform:uppercase; letter-spacing:.04em; }
.override-summary strong { color:var(--navy); }
.suppress-check { align-items:flex-start; background:#fff7ed; border:1px solid #f0cfaa; border-radius:10px; padding:11px 12px; margin:12px 0; }
.suppress-check span { display:grid; gap:3px; }
.suppress-check small { color:var(--muted); font-weight:400; }
.disabled-fields { opacity:.48; }
.split-actions { grid-template-columns:auto 1fr auto auto; }
.ghost-danger { background:white; color:#9b3434; border:1px solid #d8a8a8; }
@media(max-width:640px){.override-summary div{grid-template-columns:1fr}.split-actions{display:flex;flex-wrap:wrap}.calendar-event-actions{justify-content:flex-start}}

.schedule-suppressed td { opacity:.68; background:#f3f4f6; }

/* v1.5 — Scheduler role and visual calendar views */
.role-guide { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.role-badge.scheduler { color:#6f4b13; background:#fff2d9; }

.calendar-toolbar-main { align-items:center; }
.calendar-navigation { display:flex; flex-wrap:wrap; gap:8px; }
.calendar-range-label { min-width:190px; color:var(--navy); font-size:18px; font-weight:850; text-align:center; }
.calendar-view-toggle { display:inline-flex; padding:3px; border:1px solid var(--line); border-radius:11px; background:white; }
.calendar-view-button { border:0; border-radius:8px; padding:8px 12px; background:transparent; color:var(--muted); font-size:11px; font-weight:800; cursor:pointer; }
.calendar-view-button.active { background:var(--navy); color:white; box-shadow:0 4px 12px rgba(27,37,72,.16); }

.month-calendar { overflow:hidden; border:1px solid var(--line); border-radius:var(--radius); background:white; box-shadow:var(--shadow); }
.month-weekdays { display:grid; grid-template-columns:repeat(7,minmax(0,1fr)); background:#f5f7f9; border-bottom:1px solid var(--line); }
.month-weekdays div { padding:11px 8px; color:var(--muted); font-size:10px; font-weight:900; letter-spacing:.08em; text-align:center; text-transform:uppercase; }
.month-grid { display:grid; grid-template-columns:repeat(7,minmax(0,1fr)); }
.month-day { min-height:165px; padding:9px; border-right:1px solid var(--line); border-bottom:1px solid var(--line); background:white; }
.month-day:nth-child(7n) { border-right:0; }
.month-day:nth-last-child(-n+7) { border-bottom:0; }
.month-day.outside-month { background:#fafbfc; }
.month-day.outside-month .month-day-number { color:#a8aeb8; }
.month-day.today { background:#f8fbfa; box-shadow:inset 0 0 0 2px rgba(47,143,99,.28); }
.month-day-number { width:27px; height:27px; display:grid; place-items:center; border-radius:50%; color:var(--navy); font-size:12px; font-weight:850; }
.month-day.today .month-day-number { background:var(--green); color:white; }
.month-events { display:grid; gap:5px; margin-top:5px; }
.month-event { width:100%; min-width:0; border:0; border-radius:8px; padding:6px 7px; color:white; cursor:pointer; text-align:left; font:inherit; box-shadow:0 2px 7px rgba(27,37,72,.10); }
.month-event.main { background:#294c8f; }
.month-event.gym { background:#2f8f63; }
.month-event.soccer { background:#b36b22; }
.month-event.west { background:#7b4f9d; }
.month-event.suppressed { background:#5f6670; border:1px dashed rgba(255,255,255,.72); }
.month-event:hover { filter:brightness(1.06); transform:translateY(-1px); }
.month-event-time { display:block; font-size:9px; font-weight:900; line-height:1.2; }
.month-event-door { display:block; margin-top:2px; font-size:9px; font-weight:850; opacity:.88; }
.month-event-title { display:block; margin-top:2px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:10px; font-weight:650; }
.month-more { border:0; padding:3px 4px; background:transparent; color:var(--navy); font-size:10px; font-weight:850; text-align:left; cursor:pointer; }
.calendar-view-note { margin:10px 2px 0; color:var(--muted); font-size:11px; }

@media (max-width: 1180px) {
  .role-guide { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .calendar-range-label { order:-1; width:100%; text-align:left; }
  .calendar-date-field { margin-left:0; }
  .month-day { min-height:145px; padding:7px; }
  .month-event-title { display:none; }
}

@media (max-width: 760px) {
  .role-guide { grid-template-columns:1fr; }
  .calendar-toolbar-main { display:grid; grid-template-columns:1fr; }
  .calendar-navigation { display:grid; grid-template-columns:repeat(3,1fr); }
  .calendar-range-label { text-align:center; }
  .calendar-view-toggle { width:100%; }
  .calendar-view-button { flex:1; }
  .month-calendar { overflow-x:auto; }
  .month-weekdays, .month-grid { min-width:760px; }
  .month-day { min-height:150px; }
}

/* v1.6 — polished mobile experience, rollout controls, and daily auto lock */
.mobile-topbar-mark,
.mobile-bottom-nav,
.sidebar-scrim { display: none; }

.rollout-card {
  margin: 0 0 28px;
  padding: 18px 20px;
  display: grid;
  grid-template-columns: minmax(240px, .9fr) minmax(420px, 1.4fr);
  gap: 22px;
  align-items: center;
  background: linear-gradient(135deg, #edf3f2, #f8faf9);
  border: 1px solid #cadbd7;
  border-radius: 16px;
}
.rollout-kicker { color: var(--sage); font-size: 9px; font-weight: 900; letter-spacing: .13em; }
.rollout-copy h3 { margin-top: 6px; }
.rollout-copy p { margin: 6px 0 0; font-size: 11px; line-height: 1.5; }
.rollout-controls { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.rollout-button {
  min-height: 40px;
  border: 1px solid #cfd8dd;
  border-radius: 10px;
  padding: 9px 12px;
  background: white;
  color: var(--navy);
  font-size: 11px;
  font-weight: 800;
}
.rollout-button.active { color: white; background: var(--green); border-color: var(--green); }
.rollout-button.none { color: var(--red); border-color: #e4bebe; background: #fff7f7; }
.rollout-summary { width: 100%; color: var(--muted); font-size: 10px; text-align: right; }

.setting-check {
  min-height: 49px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fbfbfc;
  align-items: flex-start;
}
.setting-check span { display: grid; gap: 3px; }
.setting-check strong { color: var(--navy); font-size: 12px; }
.setting-check small { color: var(--muted); font-weight: 500; }
.auto-lock-note { color: var(--amber); font-weight: 750; }
.state-badge.auto-lock { color: #7a4d12; background: #fff8ea; border-color: #edcf9f; }

@media (max-width: 1050px) {
  .rollout-card { grid-template-columns: 1fr; }
  .rollout-controls { justify-content: flex-start; }
  .rollout-summary { text-align: left; }
}

@media (max-width: 760px) {
  :root { --radius: 15px; }
  body { padding-bottom: 72px; }
  body.nav-open { overflow: hidden; }
  .app-shell { min-height: calc(100vh - 72px); }
  .sidebar {
    width: min(320px, 86vw);
    left: min(-340px, -90vw);
    padding: 20px 18px 24px;
    overflow-y: auto;
  }
  .sidebar.open { left: 0; }
  .sidebar-scrim {
    position: fixed;
    inset: 0;
    z-index: 44;
    border: 0;
    background: rgba(11,18,35,.48);
    backdrop-filter: blur(2px);
  }
  body.nav-open .sidebar-scrim { display: block; }
  .brand-lockup { padding: 4px 4px 18px; }
  .brand-logo { max-width: 205px; padding: 9px 12px; }
  .app-title { margin-top: 16px; font-size: 18px; }
  .nav-list { margin-top: 18px; gap: 5px; }
  .nav-item { min-height: 46px; padding: 11px 12px; }
  .sidebar-footer { margin-top: 24px; }

  .main-content { padding: 0 13px 26px; }
  .topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    min-height: 72px;
    margin: 0 -13px;
    padding: 0 13px;
    gap: 9px;
    background: rgba(246,244,238,.94);
    backdrop-filter: blur(12px);
  }
  .mobile-menu {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    font-size: 18px;
  }
  .mobile-topbar-mark { display: block; width: 34px; height: 34px; object-fit: contain; }
  .topbar .eyebrow { display: none; }
  .topbar h1 { margin: 0; font-size: 20px; white-space: nowrap; }
  .topbar-actions { margin-left: auto; }
  .mode-pill { padding: 7px 9px; font-size: 8px; letter-spacing: .07em; white-space: nowrap; }

  .mode-banner {
    margin: 13px 0 16px;
    padding: 12px 13px;
    border-radius: 12px;
    gap: 10px;
  }
  .mode-banner strong { font-size: 13px; }
  .mode-banner span { font-size: 10px; line-height: 1.4; }
  .mode-banner .button { width: 100%; min-height: 44px; }

  .status-strip { grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px; margin-bottom: 16px; }
  .status-card { min-width: 0; padding: 11px 12px; border-radius: 12px; background: white; }
  .status-card .label { font-size: 8px; }
  .status-card .value { margin-top: 5px; font-size: 11px; line-height: 1.3; overflow-wrap: anywhere; }
  .dot { width: 7px; height: 7px; flex: 0 0 7px; }

  .rollout-card { margin-bottom: 18px; padding: 14px; gap: 14px; }
  .rollout-copy p { font-size: 10px; }
  .rollout-controls { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); width: 100%; }
  .rollout-button { width: 100%; padding: 9px 7px; font-size: 10px; }
  .rollout-button.none { grid-column: 1 / -1; }
  .rollout-summary { grid-column: 1 / -1; }

  .section-heading { margin-bottom: 12px; gap: 9px; }
  .section-heading h2 { font-size: 20px; }
  .section-heading p { font-size: 11px; line-height: 1.45; }
  .section-heading > .button { width: 100%; min-height: 44px; }
  .timestamp { font-size: 9px; }

  .door-grid { gap: 12px; }
  .door-card { min-height: 0; padding: 16px; border-radius: 15px; }
  .door-name { font-size: 17px; }
  .state-badge { padding: 6px 8px; font-size: 8px; }
  .control-source { max-width: 220px; font-size: 9px; line-height: 1.35; }
  .door-body { margin-top: 18px; }
  .window-label { font-size: 9px; }
  .window-date { margin-top: 6px; font-size: 12px; }
  .window-time { margin-top: 2px; font-size: 23px; }
  .window-events { margin-top: 9px; font-size: 12px; }
  .reason-row { margin-top: 12px; gap: 5px; }
  .reason-chip { padding: 5px 7px; font-size: 9px; }
  .manual-active-banner { margin-top: 12px; padding: 9px 10px; }
  .command-safety { margin-top: 12px; padding: 10px; }
  .command-copy strong { font-size: 11px; }
  .command-copy span { font-size: 9px; }
  .command-toggle { min-height: 36px; padding: 7px 10px; }
  .door-actions { margin: 15px -16px -16px; padding: 12px 16px; }
  .door-actions .button { min-height: 42px; }

  .schedule-card-header { padding: 15px 14px; }
  .schedule-card-header h3 { font-size: 15px; }
  .schedule-table, .schedule-table tbody, .schedule-table tr, .schedule-table td { display: block; width: 100%; }
  .schedule-table thead { display: none; }
  .schedule-table tr { padding: 12px 14px; border-top: 1px solid #eef0f3; }
  .schedule-table td { display: grid; grid-template-columns: 88px 1fr; gap: 8px; padding: 4px 0 !important; border: 0; font-size: 11px; white-space: normal; }
  .schedule-table td::before { content: attr(data-label); color: var(--muted); font-size: 8px; font-weight: 900; letter-spacing: .07em; text-transform: uppercase; }
  .schedule-table td:empty { display: none; }

  .calendar-toolbar { margin: 12px 0; }
  .calendar-navigation .button { min-width: 0; padding: 10px 6px; font-size: 10px; }
  .calendar-range-label { font-size: 16px; }
  .door-legend { gap: 6px; margin-bottom: 10px; }
  .legend { padding: 5px 8px; font-size: 9px; }
  .month-calendar { overflow: hidden; }
  .month-weekdays, .month-grid { min-width: 0; }
  .month-weekdays div { padding: 8px 2px; font-size: 8px; letter-spacing: 0; }
  .month-day { min-height: 76px; padding: 4px; }
  .month-day-number { width: 23px; height: 23px; font-size: 10px; }
  .month-events { gap: 3px; margin-top: 2px; }
  .month-event { height: 8px; min-height: 8px; padding: 0; border-radius: 999px; box-shadow: none; }
  .month-event span { display: none !important; }
  .month-more { padding: 1px; font-size: 8px; line-height: 1; }
  .calendar-view-note { font-size: 9px; }
  .calendar-day { border-radius: 14px; }
  .calendar-day-header { padding: 12px 13px; font-size: 13px; }
  .calendar-door-row { padding: 12px 13px; gap: 8px; }
  .calendar-door-name { font-size: 12px; }
  .calendar-event { padding: 10px; }
  .calendar-event strong { font-size: 12px; }
  .calendar-event small { font-size: 9px; line-height: 1.45; }
  .calendar-event-actions { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); }
  .calendar-event-actions button { min-height: 36px; margin: 0; font-size: 9px; }

  .settings-section { padding: 18px 15px; gap: 16px; }
  .settings-section p { font-size: 10px; }
  .field > span { font-size: 10px; }
  .field input, .field select { min-height: 46px; padding: 11px; font-size: 16px; }
  .check-field { font-size: 10px; }
  .form-actions { padding: 14px 15px; flex-direction: column; align-items: stretch; }
  .form-actions .button { min-height: 46px; }
  .form-message { margin: 0; }

  .feed-grid, .system-grid { gap: 10px; }
  .feed-card, .system-card { padding: 14px; }
  .feed-url { font-size: 10px; }
  .system-card .big { font-size: 16px; overflow-wrap: anywhere; }
  .log-card pre { padding: 13px; font-size: 9px; }

  .modal-backdrop { align-items: end; padding: 0; }
  .modal {
    width: 100%;
    max-height: 92vh;
    overflow-y: auto;
    border-radius: 22px 22px 0 0;
    padding: 22px 17px calc(22px + env(safe-area-inset-bottom));
  }
  .modal-mark { width: 48px; height: 48px; }
  .modal h2 { font-size: 22px; }
  .modal-actions { position: sticky; bottom: -1px; margin: 18px -4px -4px; padding-top: 10px; background: white; }
  .modal-actions .button { min-height: 44px; flex: 1; }
  .quick-duration-grid { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .duration-option { padding: 11px 8px; text-align: center; }
  .duration-option strong { font-size: 12px; }
  .duration-option span { display: none; }
  .split-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .split-actions span { display: none; }
  .split-actions .ghost-danger { grid-column: 1 / -1; }

  .toast { left: 12px; right: 12px; bottom: 84px; max-width: none; }

  .mobile-bottom-nav {
    position: fixed;
    z-index: 40;
    left: 0;
    right: 0;
    bottom: 0;
    min-height: 66px;
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    display: grid;
    grid-template-columns: repeat(5,1fr);
    background: rgba(255,255,255,.97);
    border-top: 1px solid var(--line);
    box-shadow: 0 -10px 30px rgba(27,37,72,.08);
    backdrop-filter: blur(14px);
  }
  .mobile-nav-item {
    min-width: 0;
    border: 0;
    border-radius: 10px;
    padding: 5px 2px;
    display: grid;
    place-items: center;
    gap: 2px;
    background: transparent;
    color: var(--muted);
  }
  .mobile-nav-item span { font-size: 16px; line-height: 1; }
  .mobile-nav-item strong { font-size: 8px; font-weight: 800; }
  .mobile-nav-item.active { color: var(--navy); background: var(--sage-soft); }

  .login-body { background: linear-gradient(180deg, #182241 0 170px, var(--cream) 170px); }
  .login-shell { display: block; min-height: 100svh; }
  .login-brand { min-height: 0; padding: 22px 18px 48px; background: transparent; align-items: center; text-align: center; }
  .login-brand::before, .login-brand::after { display: none; }
  .login-logo { width: min(280px, 88%); padding: 10px 13px; border-radius: 15px; }
  .login-copy { margin-top: 17px; }
  .login-copy .eyebrow, .login-copy p { display: none; }
  .login-copy h1 { margin: 0; font-size: 25px; }
  .login-card { width: calc(100% - 24px); margin: -28px auto 28px; padding: 23px 19px; border-radius: 20px; }
  .login-mark { width: 48px; height: 48px; }
  .login-kicker { margin-top: 12px; }
  .login-card h2 { font-size: 24px; }
  .login-card > p { margin-bottom: 17px; }
  .login-card form { gap: 13px; }
  .login-card input { font-size: 16px; min-height: 48px; }
  .login-remember { align-items: center; }
  .login-button { min-height: 48px; }
}

@media (max-width: 380px) {
  .topbar h1 { font-size: 18px; }
  .mobile-topbar-mark { display: none; }
  .mode-pill { font-size: 7px; padding: 6px 7px; }
  .status-strip { grid-template-columns: 1fr; }
  .rollout-controls { grid-template-columns: 1fr; }
  .rollout-button.none { grid-column: auto; }
  .calendar-event-actions { grid-template-columns: 1fr; }
}

.calendar-event.auto-lock-blocked { background:#8b6227 !important; border:2px dashed rgba(255,255,255,.62); }
.month-event.auto-lock-blocked { background:#8b6227 !important; }
.month-day[data-calendar-focus] { cursor:pointer; }
@media (max-width:760px) { .login-body { padding-bottom:0; } }
.rollout-button:disabled { cursor:not-allowed; opacity:.48; }


/* v1.7 — dedicated admin-only System settings page */
.settings-group-heading {
  margin: 26px 0 12px;
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 18px;
}
.settings-group-heading:first-of-type { margin-top: 0; }
.settings-group-heading h3 { margin-top: 5px; font-size: 19px; }
.settings-group-heading p { margin: 6px 0 0; font-size: 12px; }
.settings-group-kicker { color: var(--sage); font-size: 9px; font-weight: 900; letter-spacing: .13em; }
.settings-mode-banner { margin: 0 0 28px; }
.settings-rollout-card { margin-bottom: 14px; }
.rules-heading { margin-top: 34px; }
.door-command-settings { margin-top: 14px; }
.door-command-settings-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.door-command-setting {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 15px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: white;
  box-shadow: 0 7px 18px rgba(27,37,72,.04);
}
.door-command-setting.disabled { background: #fff9f9; border-color: #ebcccc; }
.door-command-setting > div { min-width: 0; }
.door-command-setting strong { display: block; color: var(--navy); font-size: 14px; }
.door-command-setting span { display: block; margin-top: 4px; color: var(--muted); font-size: 10px; line-height: 1.4; }
.door-command-setting .command-toggle { flex: 0 0 auto; }

@media (max-width: 760px) {
  .settings-group-heading { margin: 22px 0 10px; align-items: flex-start; }
  .settings-group-heading h3 { font-size: 17px; }
  .settings-group-heading p { font-size: 10px; line-height: 1.45; }
  .settings-mode-banner { margin-bottom: 18px; }
  .door-command-settings-grid { grid-template-columns: 1fr; gap: 8px; }
  .door-command-setting { padding: 12px; gap: 10px; }
  .door-command-setting strong { font-size: 13px; }
  .door-command-setting span { font-size: 9px; }
  .door-command-setting .command-toggle { min-height: 36px; padding: 7px 9px; font-size: 9px; }
  .rules-heading { margin-top: 25px; }
}

/* v1.7.1 — dashboard cards always show the scheduled day and date */


/* v1.7.2 — cleaner door-state marker and typical weekly-hours reminder */
.typical-hours {
  position: relative; z-index: 1; margin-top: 20px; padding: 13px 14px;
  border: 1px solid #dfe7e4; border-radius: 12px; background: #f7faf9;
}
.typical-hours-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.typical-hours-heading > span:first-child { color: var(--sage); font-size: 9px; font-weight: 900; letter-spacing: .12em; text-transform: uppercase; }
.typical-hours-reference { color: var(--muted); font-size: 8px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.typical-hours-lines { margin-top: 7px; display: grid; gap: 3px; color: var(--navy-2); font-size: 11px; font-weight: 700; line-height: 1.45; }

@media (max-width: 760px) {
  .state-badge { border-radius: 9px; padding: 6px 8px; gap: 6px; font-size: 9px; }
  .state-badge::before { width: 6px; height: 6px; }
  .typical-hours { margin-top: 14px; padding: 11px 12px; border-radius: 10px; }
  .typical-hours-lines { font-size: 10px; }
}

/* v1.8 — real protected business-hours schedule rules */
.business-hours-editor {
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.business-hours-card {
  border: 1px solid var(--line);
  border-radius: 15px;
  background: #fff;
  padding: 15px;
  box-shadow: 0 7px 18px rgba(27,37,72,.04);
}
.business-hours-card.enabled { border-color: #bcd9d0; background: #fbfefd; }
.business-hours-card.disabled { background: #fafafa; opacity: .78; }
.business-hours-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.business-hours-card-head strong { display: block; color: var(--navy); font-size: 14px; }
.business-hours-card-head > div > span { display: block; margin-top: 4px; color: var(--muted); font-size: 9px; }
.business-enable { display: inline-flex; align-items: center; gap: 7px; color: var(--navy); font-size: 9px; font-weight: 900; text-transform: uppercase; letter-spacing: .08em; }
.business-enable input { width: 16px; height: 16px; accent-color: var(--green); }
.business-hours-rows { display: grid; gap: 7px; margin-top: 12px; }
.business-hours-row {
  display: grid;
  grid-template-columns: minmax(80px, 1fr) 100px 18px 100px;
  align-items: center;
  gap: 7px;
}
.business-day { color: var(--navy-2); font-size: 10px; font-weight: 800; }
.business-hours-row input[type="time"] {
  min-width: 0;
  width: 100%;
  padding: 8px 7px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  color: var(--navy);
  font: inherit;
  font-size: 10px;
}
.business-hours-row input:disabled { background: #f1f2f3; color: #9aa0aa; }
.business-to { color: var(--muted); font-size: 9px; text-align: center; }
.typical-hours.protected { border-color: #bcd9d0; background: #f3faf7; }
.typical-hours.protected .typical-hours-reference { color: var(--green); }
.typical-hours-note { margin-top: 7px; color: var(--muted); font-size: 9px; line-height: 1.4; }

@media (max-width: 1000px) {
  .business-hours-editor { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .business-hours-card { padding: 12px; border-radius: 12px; }
  .business-hours-card-head { align-items: flex-start; }
  .business-hours-row { grid-template-columns: minmax(74px, 1fr) 82px 14px 82px; gap: 5px; }
  .business-day { font-size: 9px; }
  .business-hours-row input[type="time"] { font-size: 9px; padding: 7px 5px; }
}

/* v1.8.1 configurable door display order */
.door-order-editor { display:grid; gap:10px; width:100%; }
.door-order-row {
  display:grid;
  grid-template-columns:auto minmax(0,1fr) auto;
  align-items:center;
  gap:14px;
  padding:14px 16px;
  border:1px solid #dfe5ea;
  border-radius:14px;
  background:#fff;
}
.door-order-number {
  display:grid;
  place-items:center;
  width:34px;
  height:34px;
  border-radius:10px;
  background:#eef2f5;
  color:#1b2548;
  font-weight:800;
}
.door-order-row > div:nth-child(2) { min-width:0; display:grid; gap:3px; }
.door-order-row strong { color:#1b2548; }
.door-order-row span { color:#68737d; font-size:.84rem; }
.door-order-actions { display:flex; gap:8px; }
.button.compact { padding:8px 11px; min-height:36px; }
.button.compact:disabled { opacity:.4; cursor:not-allowed; }
@media (max-width: 640px) {
  .door-order-row { grid-template-columns:auto minmax(0,1fr); }
  .door-order-actions { grid-column:1 / -1; }
  .door-order-actions .button { flex:1; }
}

/* v1.8.3 — authoritative rollout state and repaired business-hours layout */
.rollout-summary.warning {
  color: #9a5d12;
  font-weight: 800;
}

/* Give protected business hours the full settings-card width. The previous
   nested two-column layout squeezed the time controls and let them overlap. */
.business-hours-settings-section {
  grid-template-columns: 1fr;
  gap: 18px;
}
.business-hours-settings-section > div:first-child p {
  max-width: 760px;
}
.business-hours-editor {
  width: 100%;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
}
.business-hours-card {
  min-width: 0;
  overflow: hidden;
  box-sizing: border-box;
}
.business-hours-row {
  grid-template-columns: minmax(92px, 120px) minmax(132px, 1fr) 24px minmax(132px, 1fr);
  gap: 10px;
}
.business-time {
  min-width: 0;
  display: grid;
  gap: 4px;
}
.business-time > span {
  display: none;
  color: var(--muted);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.business-time input[type="time"] {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

@media (max-width: 1350px) {
  .business-hours-editor { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
  .business-hours-row {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 7px 9px;
    padding: 8px 0;
    border-bottom: 1px solid #edf0f2;
  }
  .business-hours-row:last-child { border-bottom: 0; }
  .business-day { grid-column: 1 / -1; font-size: 10px; }
  .business-to { display: none; }
  .business-time > span { display: block; }
  .business-hours-row input[type="time"] { font-size: 10px; padding: 8px 6px; }
}


/* v1.8.5 — clearer Preview vs Live vs per-door command path wording */
.window-command-note {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.35;
}
.window-command-note.preview {
  color: #8b5a16;
  background: #fff8ea;
  border: 1px solid #efd5a7;
}
.window-command-note.live {
  color: var(--green);
  background: #eef8f3;
  border: 1px solid #cce6d8;
}
.window-command-note.disabled {
  color: var(--red);
  background: var(--red-soft);
  border: 1px solid #efc7c7;
}
.commands-armed-note,
.commands-live-note {
  margin: 10px 0 0;
  padding: 9px 11px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 850;
  letter-spacing: .04em;
  line-height: 1.35;
}
.commands-armed-note {
  color: #8b5a16;
  background: #fff8ea;
  border: 1px solid #efd5a7;
}
.commands-live-note {
  color: var(--green);
  background: #eef8f3;
  border: 1px solid #cce6d8;
}
.state-badge.preview-only {
  color: #8b5a16;
  background: #fff8ea;
  border-color: #efd5a7;
}
.command-toggle.on {
  letter-spacing: .08em;
}
.rollout-summary.warning {
  color: #a15d0d;
  font-weight: 850;
}
@media (max-width: 760px) {
  .window-command-note { font-size: 10px; }
  .commands-armed-note,
  .commands-live-note { font-size: 9px; }
}

/* v1.9 — per-door Online / Manual only / Offline control */
.mode-pill.paused { color: var(--amber); background: var(--amber-soft); border: 1px solid #f0d4ad; }
.mode-pill.manual { color: #58636d; background: #eef1f3; border: 1px solid #d9dfe3; }
.mode-banner.paused { background: var(--amber-soft); border: 1px solid #efd5b1; }

.door-mode-note {
  position: relative;
  z-index: 1;
  margin-top: 15px;
  padding: 10px 12px;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
}
.door-mode-note strong { font-size: 10px; letter-spacing: .09em; }
.door-mode-note span { font-size: 9px; line-height: 1.35; text-align: right; color: var(--muted); }
.door-mode-note.online { background: var(--green-soft); border-color: #bedfce; }
.door-mode-note.online strong { color: var(--green); }
.door-mode-note.manual { background: #f3f5f6; border-color: #dce2e5; }
.door-mode-note.manual strong { color: #59656e; }
.door-mode-note.paused { background: var(--amber-soft); border-color: #efd5b1; }
.door-mode-note.paused strong { color: var(--amber); }
.door-mode-note.offline { background: var(--red-soft); border-color: #efc7c7; }
.door-mode-note.offline strong { color: var(--red); }
.door-card.mode-offline { background: #fcfcfc; }

.door-command-setting { align-items: flex-start; flex-direction: column; }
.door-mode-copy { width: 100%; }
.door-mode-selector {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  padding: 5px;
  border-radius: 11px;
  background: #f1f3f5;
}
.door-mode-button {
  min-height: 38px;
  padding: 8px 9px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #65707a;
  font-size: 10px;
  font-weight: 800;
  cursor: pointer;
}
.door-mode-button:hover { background: rgba(255,255,255,.65); }
.door-mode-button.active { background: #fff; box-shadow: 0 3px 9px rgba(27,37,72,.09); }
.door-mode-button.active.online { color: var(--green); border-color: #c7e2d5; }
.door-mode-button.active.manual { color: #4f5c65; border-color: #d8dee2; }
.door-mode-button.active.offline { color: var(--red); border-color: #efcccc; background: #fffafa; }
.door-command-setting.mode-online { border-color: #bddfce; }
.door-command-setting.mode-manual_only { border-color: #d8dee2; }
.door-command-setting.mode-offline { border-color: #efcccc; background: #fffafa; }

@media (max-width: 760px) {
  .door-mode-note { align-items: flex-start; flex-direction: column; gap: 4px; padding: 9px 10px; }
  .door-mode-note span { text-align: left; }
  .door-mode-button { min-height: 42px; font-size: 9px; padding: 7px 5px; }
}

/* v1.9.3 — simplified System settings page */
.settings-control-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin: 4px 0 16px;
}
.settings-control-header h2 {
  margin-top: 6px;
  font-size: 24px;
}
.settings-control-header p {
  max-width: 760px;
  margin: 7px 0 0;
  font-size: 12px;
  line-height: 1.55;
}
.settings-control-header .button {
  flex: 0 0 auto;
}
.settings-control-header .button:disabled {
  color: var(--green);
  background: var(--green-soft);
  border-color: #c6e2d4;
  opacity: 1;
  cursor: default;
}
.simplified-settings-card {
  margin-top: 22px;
}
.simplified-settings-card .settings-section h3 {
  margin-top: 5px;
}
.simplified-settings-card .business-hours-settings-section {
  padding-top: 24px;
}
.settings-emergency-section {
  margin-top: 26px;
  padding: 22px;
  border: 1px solid #ead7bd;
  border-radius: var(--radius);
  background: #fffaf2;
}
.settings-emergency-heading h3 {
  margin-top: 5px;
  font-size: 18px;
}
.settings-emergency-heading p {
  max-width: 760px;
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}
.settings-emergency-section .settings-mode-banner {
  margin: 16px 0 0;
  box-shadow: none;
}

@media (max-width: 760px) {
  .settings-control-header {
    align-items: stretch;
    flex-direction: column;
    gap: 14px;
  }
  .settings-control-header h2 { font-size: 21px; }
  .settings-control-header p { font-size: 10px; }
  .settings-control-header .button { width: 100%; min-height: 44px; }
  .simplified-settings-card { margin-top: 16px; }
  .settings-emergency-section { margin-top: 18px; padding: 15px; }
  .settings-emergency-heading p { font-size: 10px; }
}

/* v1.9.4 — dedicated user and door command activity log */
.activity-heading { align-items: center; }
.activity-tabs { display: inline-flex; gap: 5px; margin-bottom: 16px; padding: 5px; border: 1px solid var(--line); border-radius: 13px; background: rgba(255,255,255,.7); }
.activity-tab { border: 0; border-radius: 9px; padding: 10px 16px; background: transparent; color: var(--muted); font-size: 11px; font-weight: 800; }
.activity-tab.active { background: var(--navy); color: white; box-shadow: 0 6px 16px rgba(27,37,72,.16); }
.activity-filter-card { display: grid; grid-template-columns: minmax(220px, 1.5fr) repeat(4, minmax(135px, .75fr)) auto; align-items: end; gap: 12px; margin-bottom: 14px; padding: 16px; border: 1px solid rgba(27,37,72,.08); border-radius: 16px; background: white; box-shadow: var(--shadow); }
.activity-filter-card .field { margin: 0; }
.activity-filter-actions { display: flex; align-items: center; gap: 8px; padding-bottom: 1px; }
.activity-summary { margin: 8px 2px 12px; color: var(--muted); font-size: 11px; font-weight: 700; }
.activity-card { border: 1px solid rgba(27,37,72,.08); border-radius: var(--radius); overflow: hidden; background: white; box-shadow: var(--shadow); }
.activity-table-header, .activity-row { display: grid; grid-template-columns: 150px 150px minmax(180px, .9fr) minmax(150px, .8fr) minmax(260px, 1.6fr); gap: 16px; align-items: center; }
.activity-table-header { padding: 12px 18px; border-bottom: 1px solid var(--line); background: #f7f8fa; color: var(--muted); font-size: 9px; font-weight: 850; letter-spacing: .1em; text-transform: uppercase; }
.activity-list { max-height: 650px; overflow: auto; }
.activity-row { padding: 14px 18px; border-top: 1px solid #eef0f3; color: #4d5667; font-size: 11px; }
.activity-row:first-child { border-top: 0; }
.activity-time { color: var(--muted); font-size: 10px; }
.activity-actor strong, .activity-action { color: var(--navy); font-weight: 800; }
.activity-actor small, .activity-details small { display: block; margin-top: 4px; color: var(--muted); font-size: 9px; line-height: 1.45; }
.activity-target { color: var(--ink); font-weight: 750; }
.activity-details { min-width: 0; line-height: 1.5; overflow-wrap: anywhere; }
.activity-details strong { color: var(--ink); }
.command-badge { display: inline-flex; align-items: center; justify-content: center; border-radius: 999px; padding: 7px 10px; font-size: 9px; font-weight: 900; letter-spacing: .05em; white-space: nowrap; }
.command-badge.on { color: var(--green); background: var(--green-soft); }
.command-badge.off { color: #5f6875; background: #edf0f4; }

@media (max-width: 1180px) {
  .activity-filter-card { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .activity-search-field { grid-column: span 2; }
  .activity-filter-actions { align-self: end; }
  .activity-table-header, .activity-row { grid-template-columns: 130px 130px minmax(150px, .9fr) minmax(130px, .7fr) minmax(220px, 1.3fr); gap: 12px; }
}

@media (max-width: 760px) {
  .activity-heading { align-items: flex-start; }
  .activity-heading .button { width: 100%; }
  .activity-tabs { width: 100%; }
  .activity-tab { flex: 1; }
  .activity-filter-card { grid-template-columns: 1fr 1fr; }
  .activity-search-field { grid-column: 1 / -1; }
  .activity-filter-actions { grid-column: 1 / -1; }
  .activity-filter-actions .button { flex: 1; }
  .activity-table-header { display: none; }
  .activity-list { max-height: none; }
  .activity-row { grid-template-columns: 1fr 1fr; gap: 7px 12px; padding: 16px; }
  .activity-time { grid-column: 1 / -1; }
  .activity-details { grid-column: 1 / -1; padding-top: 5px; border-top: 1px dashed var(--line); }
}

/* v1.9.8 — event-by-event calendar tags and labeled override targets */
.event-requests-panel { border-top:1px solid var(--line); background:#fbfcfd; }
.event-requests-panel > summary { list-style:none; cursor:pointer; padding:16px 22px; display:flex; align-items:center; justify-content:space-between; gap:16px; color:var(--navy); font-weight:850; }
.event-requests-panel > summary::-webkit-details-marker { display:none; }
.event-requests-panel > summary::after { content:'+'; width:28px; height:28px; border:1px solid var(--line); border-radius:9px; display:grid; place-items:center; font-size:18px; color:var(--muted); flex:0 0 auto; }
.event-requests-panel[open] > summary::after { content:'−'; }
.event-requests-panel > summary small { color:var(--muted); font-size:10px; font-weight:650; margin-left:auto; }
.event-requests-intro { padding:0 22px 14px; color:var(--muted); font-size:12px; line-height:1.5; }
.event-request-list { display:grid; gap:10px; padding:0 22px 22px; }
.event-request-empty { padding:16px; border:1px dashed var(--line); border-radius:12px; color:var(--muted); background:white; }
.event-request-item { border:1px solid var(--line); border-radius:13px; background:white; overflow:hidden; }
.event-request-item > summary { list-style:none; cursor:pointer; display:grid; grid-template-columns:minmax(0,1fr) minmax(190px,.7fr) 24px; align-items:center; gap:14px; padding:14px 16px; }
.event-request-item > summary::-webkit-details-marker { display:none; }
.event-request-item > summary::after { content:'›'; color:var(--muted); font-size:22px; transform:rotate(0deg); transition:transform .15s ease; }
.event-request-item[open] > summary::after { transform:rotate(90deg); }
.event-request-title,.event-request-outcome { display:grid; gap:3px; min-width:0; }
.event-request-title strong,.event-request-outcome strong { color:var(--navy); font-size:13px; overflow-wrap:anywhere; }
.event-request-title small,.event-request-outcome small { color:var(--muted); font-size:10px; font-weight:600; }
.event-request-outcome { text-align:right; }
.event-request-body { padding:14px 16px 16px; border-top:1px solid #edf0f3; background:#fcfdfd; }
.request-tags { display:flex; flex-wrap:wrap; gap:7px; }
.request-tag { display:inline-flex; align-items:center; gap:6px; padding:6px 9px; border-radius:999px; font-size:8px; font-weight:900; letter-spacing:.08em; }
.request-tag.enabled { color:#27704f; background:#e8f6ef; }
.request-tag.disabled { color:#747b88; background:#eef1f4; }
.request-tag-dot { width:6px; height:6px; border-radius:50%; background:currentColor; }
.request-help { margin:11px 0; color:var(--muted); font-size:10px; line-height:1.5; }
.request-blocks { display:grid; gap:8px; }
.request-block { border:1px solid var(--line); border-left-width:4px; border-radius:11px; padding:11px 12px; background:white; }
.request-block.included { border-left-color:#2f9468; }
.request-block.ignored { border-left-color:#aeb5bf; background:#f5f6f7; }
.request-block-heading { display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.request-block-type { color:var(--navy); font-size:8px; font-weight:900; letter-spacing:.09em; }
.request-block-source { color:var(--muted); font-size:9px; }
.request-decision { margin-left:auto; border-radius:999px; padding:4px 7px; font-size:8px; font-weight:900; letter-spacing:.06em; }
.request-decision.included { color:#27704f; background:#e8f6ef; }
.request-decision.ignored { color:#6f7580; background:#e6e9ed; }
.request-block-result { margin-top:8px; display:flex; justify-content:space-between; align-items:baseline; gap:10px; }
.request-block-result strong { color:var(--ink); font-size:11px; }
.request-block-result span { color:var(--navy); font-size:11px; font-weight:800; white-space:nowrap; }
.request-block p { margin:6px 0 0; color:var(--muted); font-size:9px; line-height:1.45; }
.request-warnings { display:grid; gap:6px; margin-top:10px; }
.request-warning { color:#8a5b18; background:#fff3dc; border:1px solid #f1d49c; border-radius:9px; padding:8px 10px; font-size:9px; font-weight:700; line-height:1.4; }
.request-ignored-note { margin:10px 0 0; color:var(--muted); font-size:9px; }

@media(max-width:760px){
  .event-requests-panel > summary { padding:14px; align-items:flex-start; flex-wrap:wrap; }
  .event-requests-panel > summary small { width:100%; margin:0; }
  .event-requests-intro,.event-request-list { padding-left:14px; padding-right:14px; }
  .event-request-item > summary { grid-template-columns:1fr 22px; gap:8px; }
  .event-request-outcome { grid-column:1; text-align:left; }
  .event-request-item > summary::after { grid-column:2; grid-row:1 / span 2; }
  .request-block-result { display:grid; }
  .request-block-result span { white-space:normal; }
  .request-decision { margin-left:0; }
}


/* v1.9.8 — identify each merged-window override target */
.calendar-event-actions .calendar-action-button {
  display:grid;
  gap:2px;
  min-width:150px;
  max-width:320px;
  padding:7px 10px;
  text-align:left;
  white-space:normal;
  line-height:1.25;
}
.calendar-event-actions .calendar-action-button strong {
  display:block;
  font-size:10px;
  font-weight:800;
  overflow-wrap:anywhere;
}
.calendar-event-actions .calendar-action-button small {
  display:block;
  font-size:9px;
  color:rgba(255,255,255,.82);
}
.calendar-event-actions .calendar-action-button.danger {
  background:rgba(120,22,22,.28);
}

/* v1.9.8 — event-by-event request view in Door calendar */
.calendar-request-view-intro {
  display:flex;
  align-items:flex-start;
  gap:12px;
  margin-bottom:14px;
  padding:14px 16px;
  border:1px solid #cfe0dd;
  border-radius:14px;
  background:#f2f8f7;
}
.calendar-request-view-intro strong { color:var(--navy); white-space:nowrap; }
.calendar-request-view-intro span { color:var(--muted); font-size:12px; line-height:1.5; }

.calendar-request-day-content { padding:14px; display:grid; gap:10px; }
.calendar-request-card {
  border:1px solid var(--line);
  border-radius:14px;
  background:white;
  overflow:hidden;
}
.calendar-request-card > summary {
  list-style:none;
  cursor:pointer;
  display:grid;
  grid-template-columns:minmax(180px,1fr) minmax(220px,1.25fr) auto 22px;
  align-items:center;
  gap:12px;
  padding:14px 16px;
}
.calendar-request-card > summary::-webkit-details-marker { display:none; }
.calendar-request-card > summary::after {
  content:'›';
  color:var(--muted);
  font-size:22px;
  transition:transform .15s ease;
}
.calendar-request-card[open] > summary::after { transform:rotate(90deg); }
.calendar-request-title { display:grid; gap:3px; min-width:0; }
.calendar-request-title strong { color:var(--navy); font-size:14px; overflow-wrap:anywhere; }
.calendar-request-title small { color:var(--muted); font-size:10px; }
.calendar-request-door-chips { display:flex; flex-wrap:wrap; gap:6px; }
.request-door-chip {
  display:inline-flex;
  align-items:center;
  min-height:25px;
  padding:5px 9px;
  border-radius:999px;
  color:white;
  font-size:9px;
  font-weight:850;
  letter-spacing:.04em;
}
.request-door-chip.main { background:#294c8f; }
.request-door-chip.gym { background:#2f8f63; }
.request-door-chip.soccer { background:#b36b22; }
.request-door-chip.west { background:#7b4f9d; }
.calendar-request-timing-summary { display:flex; flex-wrap:wrap; justify-content:flex-end; gap:5px; }
.calendar-request-timing-summary span {
  padding:5px 7px;
  border-radius:8px;
  background:var(--sage-soft);
  color:var(--navy);
  font-size:9px;
  font-weight:800;
}
.calendar-request-card-body {
  display:grid;
  gap:12px;
  padding:14px 16px 16px;
  border-top:1px solid #edf0f3;
  background:#fbfcfd;
}
.calendar-request-assignment {
  border:1px solid var(--line);
  border-radius:12px;
  padding:12px;
  background:white;
}
.calendar-request-assignment-header {
  display:grid;
  grid-template-columns:auto auto minmax(180px,1fr);
  align-items:center;
  gap:9px;
  margin-bottom:10px;
}
.calendar-request-assignment-header > strong {
  color:var(--green);
  font-size:10px;
  text-transform:uppercase;
  letter-spacing:.08em;
}
.request-assignment-window {
  color:var(--muted);
  font-size:10px;
  text-align:right;
  overflow-wrap:anywhere;
}
.calendar-request-assignment .request-tags { margin-bottom:10px; }
.calendar-request-assignment .request-blocks { display:grid; gap:8px; }

@media(max-width:900px) {
  .calendar-view-toggle { flex-wrap:wrap; }
  .calendar-request-card > summary {
    grid-template-columns:1fr 22px;
  }
  .calendar-request-door-chips,
  .calendar-request-timing-summary {
    grid-column:1;
    justify-content:flex-start;
  }
  .calendar-request-card > summary::after {
    grid-column:2;
    grid-row:1 / span 3;
  }
  .calendar-request-assignment-header {
    grid-template-columns:auto 1fr;
  }
  .request-assignment-window {
    grid-column:1 / -1;
    text-align:left;
  }
}
@media(max-width:640px) {
  .calendar-request-view-intro { display:grid; gap:5px; }
  .calendar-request-view-intro strong { white-space:normal; }
  .calendar-request-day-content { padding:9px; }
  .calendar-request-card > summary { padding:12px; }
  .calendar-request-card-body { padding:10px; }
  .calendar-event-actions .calendar-action-button {
    max-width:none;
    width:100%;
  }
}


/* v1.9.9 — event-separated calendar and persistent diagnostics */
.event-request-override-actions {
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  margin:10px 0 12px;
}
.event-override-button {
  display:grid;
  gap:2px;
  min-width:150px;
  text-align:left;
}
.event-override-button strong { font-size:10px; }
.event-override-button small { font-size:9px; color:var(--muted); }

.calendar-event-view-intro {
  display:flex;
  gap:12px;
  align-items:flex-start;
  margin-bottom:14px;
  padding:14px 16px;
  border:1px solid #cfe0dd;
  border-radius:14px;
  background:#f2f8f7;
}
.calendar-event-view-intro strong { color:var(--navy); white-space:nowrap; }
.calendar-event-view-intro span { color:var(--muted); font-size:12px; line-height:1.5; }
.calendar-door-row.event-separated { align-items:stretch; }
.calendar-event-detail-column { min-width:0; display:grid; gap:12px; }
.calendar-individual-list { display:grid; gap:10px; }
.calendar-individual-event {
  border:1px solid var(--line);
  border-radius:14px;
  background:white;
  padding:12px 14px;
}
.calendar-individual-event.business-source { border-left:5px solid #6c8f88; }
.calendar-individual-event.oneoff-source { border-left:5px solid #b36b22; }
.calendar-individual-event-head {
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:12px;
  margin-bottom:9px;
}
.calendar-individual-event-head > div:first-child { display:grid; gap:2px; }
.calendar-individual-event-head strong { color:var(--navy); font-size:13px; }
.calendar-individual-event-head small { color:var(--muted); font-size:9px; }
.calendar-individual-tags { display:flex; flex-wrap:wrap; justify-content:flex-end; gap:5px; }
.calendar-individual-tags span {
  padding:4px 7px;
  border-radius:999px;
  background:var(--sage-soft);
  color:var(--navy);
  font-size:8px;
  font-weight:800;
}
.calendar-individual-segments { display:grid; gap:7px; }
.calendar-individual-segment {
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:10px;
  padding:9px 10px;
  border-radius:10px;
  background:#f7f9fb;
}
.calendar-individual-segment > div:first-child { display:grid; gap:2px; min-width:0; }
.calendar-individual-segment strong { color:var(--navy); font-size:11px; }
.calendar-individual-segment small { color:var(--muted); font-size:9px; overflow-wrap:anywhere; }
.calendar-individual-actions { display:flex; gap:6px; }
.calendar-individual-no-window {
  padding:9px 10px;
  border-radius:10px;
  background:#faf6ef;
  color:var(--muted);
  font-size:10px;
}
.calendar-final-result {
  border:1px dashed #b8c7c4;
  border-radius:14px;
  padding:12px;
  background:#f6faf9;
}
.calendar-final-result > strong {
  display:block;
  margin-bottom:8px;
  color:var(--navy);
  font-size:10px;
  text-transform:uppercase;
  letter-spacing:.08em;
}
.calendar-final-windows { display:grid; gap:7px; }
.calendar-final-window {
  display:grid;
  grid-template-columns:auto minmax(180px,1fr);
  gap:3px 10px;
  align-items:start;
}
.calendar-final-window strong { color:var(--green); font-size:11px; }
.calendar-final-window span { color:var(--navy); font-size:10px; }
.calendar-final-window small { grid-column:2; color:var(--muted); font-size:9px; }
.calendar-final-empty { color:var(--muted); font-size:10px; }

@media(max-width:800px) {
  .calendar-event-view-intro { display:grid; gap:5px; }
  .calendar-event-view-intro strong { white-space:normal; }
  .calendar-door-row.event-separated { grid-template-columns:1fr; }
  .calendar-individual-event-head { display:grid; }
  .calendar-individual-tags { justify-content:flex-start; }
  .calendar-individual-segment { align-items:flex-start; }
  .calendar-final-window { grid-template-columns:1fr; }
  .calendar-final-window small { grid-column:1; }
}
@media(max-width:560px) {
  .calendar-individual-segment { display:grid; }
  .calendar-individual-segment .button { width:100%; }
  .event-request-override-actions .button { width:100%; }
}


/* v1.10.0 — real event calendar, day unlock plan, and clickable per-event editor */
.month-day-number.month-day-open { border:0; background:transparent; cursor:pointer; font:inherit; }
.month-day-number.month-day-open:hover { background:var(--sage-soft); }
.real-event-calendar .month-day { min-height:178px; }
.month-agenda-event {
  width:100%; min-width:0; border:1px solid #e1e7ec; border-left:4px solid #8190a5;
  border-radius:8px; padding:6px 7px; background:#fff; cursor:pointer; text-align:left; font:inherit;
  display:grid; grid-template-columns:auto minmax(0,1fr) auto; align-items:center; gap:6px;
  box-shadow:0 2px 7px rgba(27,37,72,.07);
}
.month-agenda-event:hover { transform:translateY(-1px); box-shadow:0 5px 12px rgba(27,37,72,.12); }
.month-agenda-event.oneoff { border-left-color:#b36b22; background:#fffaf3; }
.month-agenda-time { color:var(--muted); font-size:8px; font-weight:850; white-space:nowrap; }
.month-agenda-title { color:var(--navy); font-size:9px; font-weight:750; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.month-agenda-dots { display:flex; gap:3px; }
.calendar-door-dot { width:8px; height:8px; border-radius:50%; display:inline-block; flex:0 0 auto; }
.calendar-door-dot.main { background:#294c8f; }.calendar-door-dot.gym { background:#2f8f63; }.calendar-door-dot.soccer { background:#b36b22; }.calendar-door-dot.west { background:#7b4f9d; }

.calendar-day-agenda { display:grid; gap:18px; }
.day-unlock-plan,.day-event-list { background:#fff; border:1px solid var(--line); border-radius:var(--radius); box-shadow:var(--shadow); overflow:hidden; }
.day-section-heading { display:flex; justify-content:space-between; align-items:flex-start; gap:20px; padding:18px 20px; border-bottom:1px solid var(--line); background:#f8fafb; }
.day-section-heading > div { display:grid; gap:4px; }
.day-section-heading span { color:var(--sage); font-size:9px; font-weight:900; letter-spacing:.18em; }
.day-section-heading h3 { margin:0; color:var(--navy); font-size:20px; }
.day-section-heading p { max-width:620px; margin:0; color:var(--muted); font-size:11px; line-height:1.5; }
.day-unlock-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; padding:16px; }
.day-door-plan { border:1px solid var(--line); border-top:5px solid #8190a5; border-radius:14px; overflow:hidden; background:#fff; }
.day-door-plan.main { border-top-color:#294c8f; }.day-door-plan.gym { border-top-color:#2f8f63; }.day-door-plan.soccer { border-top-color:#b36b22; }.day-door-plan.west { border-top-color:#7b4f9d; }
.day-door-plan-head { display:flex; justify-content:space-between; align-items:center; gap:10px; padding:12px 14px; border-bottom:1px solid #edf0f3; }
.day-door-plan-head strong { color:var(--navy); font-size:13px; }
.day-door-plan-head span { color:var(--muted); font-size:8px; font-weight:850; letter-spacing:.08em; }
.day-door-plan-windows { display:grid; gap:8px; padding:12px; }
.day-door-window { display:grid; gap:7px; padding:11px; border-radius:10px; background:#f7f9fb; }
.day-door-window > strong { color:var(--navy); font-size:15px; }
.day-door-window > small { color:var(--muted); font-size:9px; }
.day-door-window.suppressed { background:#fff5f4; }
.day-door-causes { display:flex; flex-wrap:wrap; gap:5px; }
.day-door-causes span { padding:4px 7px; border-radius:999px; background:white; border:1px solid #dde4e8; color:var(--navy); font-size:9px; font-weight:700; }

.agenda-event-list { display:grid; gap:9px; padding:16px; }
.calendar-agenda-event { width:100%; border:1px solid var(--line); border-radius:14px; background:#fff; padding:0; cursor:pointer; text-align:left; font:inherit; display:grid; grid-template-columns:95px minmax(0,1fr) auto; align-items:stretch; overflow:hidden; transition:.15s ease; }
.calendar-agenda-event:hover { transform:translateY(-1px); box-shadow:0 8px 20px rgba(27,37,72,.10); border-color:#c9d7d4; }
.calendar-agenda-event.oneoff { background:#fffaf3; }
.agenda-event-time { display:grid; align-content:center; gap:2px; padding:15px; background:#f5f7f9; color:var(--navy); }
.agenda-event-time strong { font-size:13px; }.agenda-event-time small { color:var(--muted); font-size:9px; }
.agenda-event-main { min-width:0; display:grid; gap:8px; padding:14px 16px; }
.agenda-event-main > strong { color:var(--navy); font-size:15px; }
.agenda-event-tags { display:flex; flex-wrap:wrap; gap:5px; }
.agenda-timing-chip { display:inline-flex; align-items:center; min-height:25px; padding:5px 9px; border-radius:999px; background:var(--sage-soft); color:var(--navy); font-size:9px; font-weight:800; }
.agenda-request-summary { display:flex; flex-wrap:wrap; gap:8px; color:var(--muted); font-size:9px; }
.agenda-request-summary > span { display:flex; gap:5px; padding-right:8px; border-right:1px solid #e2e6ea; }
.agenda-request-summary strong { color:var(--navy); }
.agenda-warning { color:#a46616; font-size:9px; font-weight:750; }
.agenda-event-open { display:flex; align-items:center; gap:8px; padding:14px 16px; color:var(--green); font-size:10px; font-weight:850; white-space:nowrap; }
.agenda-event-open b { font-size:18px; }

.calendar-event-modal { width:min(920px,calc(100vw - 36px)); max-height:90vh; overflow:auto; }
.calendar-event-modal-header { display:flex; justify-content:space-between; align-items:flex-start; gap:18px; }
.calendar-event-modal-header h2 { margin:4px 0 0; }
.calendar-event-modal-time { margin:6px 0 0; color:var(--muted); }
.calendar-event-modal-close { width:38px; height:38px; border:1px solid var(--line); border-radius:10px; background:#fff; color:var(--navy); font-size:24px; cursor:pointer; }
.calendar-event-modal-tags { display:flex; flex-wrap:wrap; gap:6px; margin:14px 0; }
.calendar-event-modal-body { display:grid; gap:12px; }
.event-modal-door-section { border:1px solid var(--line); border-radius:14px; padding:14px; background:#fbfcfd; }
.event-modal-door-head { display:flex; justify-content:space-between; align-items:center; gap:12px; margin-bottom:10px; }
.event-modal-door-head > strong { color:var(--navy); font-size:11px; text-align:right; }
.event-modal-blocks { display:grid; gap:8px; margin-top:10px; }
.event-modal-actions { display:flex; flex-wrap:wrap; gap:8px; margin-top:12px; }
.event-modal-override { display:grid; gap:2px; text-align:left; }
.event-modal-override small { color:rgba(255,255,255,.82); font-size:9px; }

@media(max-width:800px) {
  .day-section-heading { display:grid; gap:7px; }
  .day-unlock-grid { grid-template-columns:1fr; }
  .calendar-agenda-event { grid-template-columns:76px minmax(0,1fr); }
  .agenda-event-open { grid-column:1 / -1; justify-content:flex-end; border-top:1px solid #edf0f3; padding:8px 14px; }
  .event-modal-door-head { display:grid; }
  .event-modal-door-head > strong { text-align:left; }
}
@media(max-width:640px) {
  .real-event-calendar .month-day { min-height:84px; }
  .month-agenda-event { height:10px; min-height:10px; padding:0; border:0; border-radius:999px; background:#294c8f; }
  .month-agenda-event.oneoff { background:#b36b22; }
  .month-agenda-event span { display:none; }
  .calendar-agenda-event { grid-template-columns:68px minmax(0,1fr); }
  .agenda-event-time { padding:11px 8px; }
  .agenda-event-main { padding:11px; }
  .agenda-event-main > strong { font-size:13px; }
  .agenda-request-summary { display:grid; }
  .agenda-request-summary > span { border-right:0; padding-right:0; }
  .day-unlock-grid,.agenda-event-list { padding:10px; }
  .calendar-event-modal { width:100%; max-height:92vh; border-radius:20px 20px 0 0; margin-top:auto; }
}
