:root {
  color-scheme: dark;
  --bg: #0a1014;
  --surface: #151a1f;
  --card: #1d1e24;
  --card-soft: #171c21;
  --border: #2c343a;
  --border-soft: #222a30;
  --text: #f1f1f1;
  --muted: #8e999f;
  --brand: #29a2a7;
  --brand-soft: rgba(41, 162, 167, .12);
  --green-soft: rgba(34, 197, 94, .12);
  --amber: #f4b740;
  --amber-soft: rgba(244, 183, 64, .12);
  --red-soft: rgba(239, 68, 68, .12);
  --radius: 12px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: var(--bg); color: var(--text); }
button, input, select, textarea { font: inherit; }
button { color: inherit; }
[hidden] { display: none !important; }
.skip-link { position: fixed; z-index: 30; top: 10px; left: 10px; padding: 10px 14px; transform: translateY(-160%); background: var(--text); color: var(--bg); border-radius: 8px; }
.skip-link:focus { transform: none; }

.topbar { min-height: 88px; display: flex; justify-content: space-between; align-items: center; gap: 24px; padding: 18px clamp(22px, 4vw, 64px); border-bottom: 1px solid var(--border-soft); background: rgba(10,16,20,.92); }
.eyebrow { margin: 0 0 3px; color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
h1 { margin: 0; font-size: clamp(22px, 2.4vw, 30px); line-height: 1.15; letter-spacing: -.035em; }
.user-chip { display: flex; align-items: center; gap: 10px; min-width: 190px; padding: 7px 10px 7px 7px; border: 1px solid var(--border-soft); border-radius: 10px; background: var(--surface); }
.user-chip div { display: grid; gap: 2px; }
.user-chip strong { font-size: 12px; }
.user-chip span:last-child { color: var(--muted); font-size: 11px; }
.avatar { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; background: #26333a; color: #d3e6e8; font-size: 11px; font-weight: 800; }

.home-nav { border-bottom: 1px solid var(--border-soft); background: #0d1317; }
.home-nav-inner { display: flex; align-items: center; gap: 22px; width: 100%; max-width: 1660px; margin: 0 auto; padding: 12px clamp(22px, 4vw, 64px); }
.nav-label { flex: 0 0 auto; margin: 0; color: #c7ced1; font-size: 11px; font-weight: 750; letter-spacing: .04em; text-transform: uppercase; }
.home-nav nav { min-width: 0; }
.tabs { display: flex; gap: 6px; margin: 0; padding: 0; overflow-x: auto; list-style: none; }
.tabs li { flex: 0 0 auto; }
.tab { display: flex; align-items: center; gap: 7px; min-height: 36px; padding: 8px 11px; border: 1px solid transparent; border-radius: 8px; background: transparent; color: #9da7ac; font-size: 11px; font-weight: 650; cursor: pointer; }
.tab span { color: #69767c; font-size: 14px; }
.tab:hover { color: var(--text); background: rgba(255,255,255,.035); }
.tab.is-active { border-color: rgba(41,162,167,.28); background: var(--brand-soft); color: #dff9fa; }
.tab.is-active span { color: #66cbd0; }
.tab:focus-visible, .button:focus-visible, .icon-button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid #58cbd0; outline-offset: 2px; }

.preview-banner, .error-banner { align-items: center; gap: 12px; margin: 20px clamp(22px, 4vw, 64px) 0; padding: 12px 14px; border-radius: 10px; }
.preview-banner { display: flex; border: 1px solid rgba(244,183,64,.3); background: var(--amber-soft); color: #f7ddb0; }
[data-mode="operational"] .preview-banner { display: none; }
.preview-banner div { display: grid; gap: 2px; }
.preview-banner strong, .error-banner strong { font-size: 12px; }
.preview-banner div span { color: #c8b892; font-size: 11px; }
.preview-icon { color: var(--amber); font-size: 10px; }
.preview-badge { margin-left: auto; padding: 4px 7px; border: 1px solid rgba(244,183,64,.32); border-radius: 5px; font-size: 9px; font-weight: 800; letter-spacing: .08em; }
.error-banner { display: flex; border: 1px solid rgba(239,68,68,.3); background: var(--red-soft); }
.error-banner span { flex: 1; color: #d9a4a4; font-size: 11px; }

main { width: 100%; max-width: 1660px; margin: 0 auto; padding: 30px clamp(22px, 4vw, 64px) 60px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; margin-bottom: 22px; }
.page-head h2 { margin: 0 0 6px; font-size: 21px; letter-spacing: -.025em; }
.page-head p { max-width: 760px; margin: 0; color: var(--muted); font-size: 13px; line-height: 1.55; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 36px; padding: 8px 13px; border: 1px solid var(--border); border-radius: 8px; background: #222a2f; font-size: 12px; font-weight: 700; cursor: pointer; }
.button:hover:not(:disabled) { border-color: #465159; }
.button:disabled { cursor: not-allowed; color: #758087; background: #171d21; opacity: .72; }
.button-primary { border-color: rgba(41,162,167,.45); background: var(--brand-soft); color: #bdebed; }
.button-compact { min-height: 32px; padding: 6px 10px; font-size: 10px; }
.icon-button { width: 36px; height: 36px; border: 1px solid var(--border); border-radius: 8px; background: transparent; color: var(--muted); font-size: 20px; cursor: pointer; }
.icon-button-small { flex: 0 0 auto; width: 32px; height: 32px; font-size: 17px; }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { min-height: 104px; padding: 17px; border: 1px solid var(--border-soft); border-radius: var(--radius); background: var(--card-soft); }
.stat-label { display: block; margin-bottom: 14px; color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; }
.stat-value { font-size: 26px; font-weight: 760; letter-spacing: -.04em; }
.stat-hint { display: block; margin-top: 3px; color: #7e8a90; font-size: 10px; }
.green { color: #6edf91; }
.amber { color: #efc76e; }

.panel-card { overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius); background: var(--card); }
.card-toolbar { display: flex; align-items: center; gap: 10px; padding: 13px 15px; border-bottom: 1px solid var(--border-soft); }
.search { min-width: 0; flex: 1; height: 36px; padding: 0 12px; border: 1px solid var(--border); border-radius: 8px; background: #13191d; color: var(--text); }
.search::placeholder { color: #667279; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { padding: 11px 15px; background: #181d22; color: #77838a; font-size: 9px; font-weight: 800; letter-spacing: .08em; text-align: left; text-transform: uppercase; }
td { padding: 14px 15px; border-top: 1px solid var(--border-soft); color: #c9ced0; font-size: 12px; }
tbody tr:hover { background: rgba(255,255,255,.018); }
.person { display: flex; align-items: center; gap: 10px; min-width: 170px; }
.person-icon { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: #263138; color: #afc1c5; font-size: 10px; font-weight: 800; }
.person-photo { display: grid; flex: 0 0 auto; place-items: center; width: 30px; height: 30px; overflow: hidden; border: 1px solid var(--border); border-radius: 8px; background: #263138; color: #afc1c5; font-size: 10px; font-weight: 800; }
.person-photo img { width: 100%; height: 100%; object-fit: cover; }
.person-photo-large { width: 68px; height: 68px; border-radius: 14px; font-size: 18px; }
.person div, .list-main { display: grid; gap: 3px; }
.person strong, .list-main strong { color: var(--text); font-size: 12px; }
.person span, .list-main span, .list-meta { color: var(--muted); font-size: 10px; }
.status { display: inline-flex; align-items: center; gap: 6px; padding: 4px 7px; border-radius: 999px; font-size: 10px; font-weight: 700; }
.status::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.status-online { background: var(--green-soft); color: #6edf91; }
.status-later { background: var(--amber-soft); color: #ebc66f; }
.status-off { background: rgba(142,153,159,.1); color: #929da2; }
.status-national { background: var(--brand-soft); color: #72d1d5; }
.table-actions { display: flex; flex-wrap: wrap; gap: 7px; }
.card-section-head { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 15px; border-bottom: 1px solid var(--border-soft); }
.card-section-head > div { display: grid; gap: 4px; }
.card-section-head strong { font-size: 13px; }
.card-section-head span { color: var(--muted); font-size: 10px; }
.section-spacer { height: 24px; }
.permission-check { display: flex; align-items: center; gap: 7px; min-width: 86px; font-size: 11px; }
.permission-check input { width: 15px; height: 15px; accent-color: var(--brand); }

.operation-card { display: grid; gap: 18px; margin-bottom: 26px; padding: 20px; border: 1px solid rgba(41,162,167,.26); border-radius: var(--radius); background: linear-gradient(145deg, rgba(41,162,167,.08), rgba(29,30,36,.82) 52%); }
.operation-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; }
.operation-card-head h3 { margin: 4px 0 6px; font-size: 18px; letter-spacing: -.02em; }
.operation-card-head p { max-width: 720px; margin: 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.section-kicker { color: #64cbd0; font-size: 9px; font-weight: 800; letter-spacing: .11em; text-transform: uppercase; }
.operation-actions { display: flex; flex: 0 0 auto; align-items: center; gap: 10px; }
.operation-week { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.operation-day { display: grid; min-width: 0; gap: 5px; padding: 11px 12px; border: 1px solid var(--border-soft); border-radius: 9px; background: rgba(10,16,20,.62); }
.operation-day strong { color: #c8d0d3; font-size: 10px; }
.operation-day span { overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.operation-foot { display: flex; justify-content: space-between; gap: 12px; padding-top: 2px; color: #758087; font-size: 9px; }
.section-divider { display: flex; align-items: baseline; gap: 10px; margin: 0 0 12px; }
.section-divider strong { font-size: 13px; }
.section-divider span { color: var(--muted); font-size: 11px; }

.list { display: grid; }
.list-row { display: grid; grid-template-columns: minmax(180px, 1fr) minmax(180px, .8fr) auto; align-items: center; gap: 15px; padding: 15px; border-top: 1px solid var(--border-soft); }
.list-row:first-child { border-top: 0; }
.audit-list { display: grid; }
.audit-entry { display: grid; grid-template-columns: minmax(0, 1fr) minmax(180px, auto); align-items: center; gap: 18px; padding: 16px; border-top: 1px solid var(--border-soft); }
.audit-entry:first-child { border-top: 0; }
.audit-main, .audit-meta { display: grid; gap: 4px; min-width: 0; }
.audit-main strong { color: var(--text); font-size: 12px; }
.audit-main span, .audit-meta span, .audit-meta time { color: var(--muted); font-size: 10px; line-height: 1.45; }
.audit-meta { justify-items: end; text-align: right; }
.audit-meta strong { color: #c8d0d3; font-size: 11px; }
.empty-state { display: grid; place-items: center; min-height: 260px; padding: 32px; border: 1px dashed var(--border); border-radius: var(--radius); text-align: center; }
.empty-state strong { margin-bottom: 7px; font-size: 14px; }
.empty-state span { max-width: 520px; color: var(--muted); font-size: 12px; line-height: 1.55; }
.empty-cell { padding: 44px 20px; text-align: center; }

.loading-state { display: flex; gap: 6px; align-items: center; justify-content: center; min-height: 300px; }
.loading-state span { width: 7px; height: 7px; border-radius: 50%; background: var(--brand); animation: load 1s infinite alternate; }
.loading-state span:nth-child(2) { animation-delay: .18s; }
.loading-state span:nth-child(3) { animation-delay: .36s; }
@keyframes load { to { opacity: .2; transform: translateY(-5px); } }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 30; padding: 12px 15px; border: 1px solid rgba(41,162,167,.4); border-radius: 9px; background: #142528; color: #bdebed; font-size: 11px; box-shadow: 0 18px 50px rgba(0,0,0,.35); }

.modal { width: min(680px, calc(100vw - 32px)); max-height: calc(100vh - 40px); padding: 0; overflow: hidden; border: 1px solid var(--border); border-radius: 14px; background: #11181c; color: var(--text); box-shadow: 0 30px 90px rgba(0,0,0,.62); }
.modal.modal-profile { width: min(980px, calc(100vw - 32px)); }
.modal::backdrop { background: rgba(2,6,8,.78); backdrop-filter: blur(3px); }
.modal form { display: grid; max-height: calc(100vh - 40px); }
.modal-head, .modal-actions { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 17px 20px; }
.modal-head { border-bottom: 1px solid var(--border-soft); }
.modal-head h2 { margin: 0; font-size: 18px; }
.modal-body { display: grid; min-width: 0; min-height: 0; gap: 16px; padding: 20px; overflow-x: hidden; overflow-y: auto; }
.modal-actions { justify-content: flex-end; border-top: 1px solid var(--border-soft); }
.field { display: grid; min-width: 0; gap: 7px; }
.field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.field-row-short-end { grid-template-columns: minmax(0, 1fr) minmax(72px, 120px); }
.field label, .field-label { color: #bdc5c8; font-size: 11px; font-weight: 700; }
.field input, .field select, .field textarea { width: 100%; min-width: 0; min-height: 40px; padding: 9px 11px; border: 1px solid var(--border); border-radius: 8px; background: #0c1216; color: var(--text); }
.field textarea { min-height: 80px; resize: vertical; }
.checkbox { display: flex; align-items: center; gap: 9px; font-size: 12px; }
.checkbox input { width: 16px; height: 16px; accent-color: var(--brand); }
.field-help { color: var(--muted); font-size: 10px; line-height: 1.45; }
.mode-explanation, .activation-box { display: grid; gap: 5px; padding: 12px 13px; border: 1px solid var(--border-soft); border-radius: 9px; background: rgba(41,162,167,.055); }
.mode-explanation strong, .activation-box strong { font-size: 11px; }
.mode-explanation span, .activation-box > span { color: var(--muted); font-size: 10px; line-height: 1.5; }
.activation-box { border-color: rgba(41,162,167,.24); }
.page-notice { margin-bottom: 18px; }
.confirmation.page-notice { display: grid; }
.lunch-rule { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 11px 13px; border: 1px solid rgba(244,183,64,.3); border-radius: 9px; background: var(--amber-soft); }
.lunch-rule strong { color: #f0d290; font-size: 11px; }
.lunch-rule span { color: #bcae8d; font-size: 10px; line-height: 1.45; text-align: right; }
.confirmation { display: flex; align-items: flex-start; gap: 9px; padding: 12px 13px; border: 1px solid rgba(244,183,64,.24); border-radius: 9px; background: var(--amber-soft); color: #ddc895; font-size: 10px; line-height: 1.45; }
.confirmation input { flex: 0 0 auto; width: 16px; height: 16px; margin: 0; accent-color: var(--brand); }
.schedule-editor-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; min-width: 0; }
.schedule-editor-head > div { display: grid; min-width: 0; gap: 4px; }
.schedule-editor-head strong { font-size: 12px; }
.schedule-editor-head span { color: var(--muted); font-size: 10px; line-height: 1.45; }
.schedule-editor-head > .schedule-editor-actions { display: flex; flex: 0 0 auto; flex-wrap: wrap; justify-content: flex-end; gap: 7px; }
.schedule-editor { display: grid; min-width: 0; gap: 8px; }
.schedule-editor-day { display: grid; grid-template-columns: 82px minmax(0, 1fr) auto; align-items: start; gap: 10px; min-width: 0; padding: 10px; border: 1px solid var(--border-soft); border-radius: 9px; background: #0d1418; }
.schedule-editor-label { display: grid; gap: 3px; padding-top: 7px; }
.schedule-editor-label strong { font-size: 11px; }
.schedule-editor-label span { color: var(--muted); font-size: 9px; }
.schedule-ranges { display: grid; min-width: 0; gap: 7px; }
.schedule-range { display: grid; grid-template-columns: minmax(0, 1fr) 22px minmax(0, 1fr) 32px; align-items: center; gap: 7px; min-width: 0; }
.schedule-range input { width: 100%; min-width: 0; height: 32px; padding: 5px 7px; border: 1px solid var(--border); border-radius: 7px; background: #091015; color: var(--text); }
.schedule-range > span { color: var(--muted); font-size: 9px; text-align: center; }
.schedule-grid { display: grid; gap: 8px; }
.schedule-day { display: grid; grid-template-columns: 94px 1fr 20px 1fr; align-items: center; gap: 8px; }
.schedule-day span { color: var(--muted); font-size: 11px; text-align: center; }

.profile-hero { display: flex; align-items: center; gap: 14px; min-width: 0; padding: 14px; border: 1px solid var(--border-soft); border-radius: 11px; background: #0d1418; }
.profile-identity { display: grid; min-width: 0; gap: 3px; }
.profile-identity strong { overflow: hidden; font-size: 15px; text-overflow: ellipsis; white-space: nowrap; }
.profile-identity > span:last-child { overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.profile-photo-actions { display: flex; flex-wrap: wrap; gap: 7px; margin-left: auto; }
.profile-tabs { display: flex; gap: 5px; max-width: 100%; overflow-x: auto; padding-bottom: 2px; }
.profile-tab { flex: 0 0 auto; min-height: 34px; padding: 7px 10px; border: 1px solid transparent; border-radius: 7px; background: transparent; color: var(--muted); font-size: 11px; font-weight: 700; cursor: pointer; }
.profile-tab:hover { color: var(--text); background: rgba(255,255,255,.03); }
.profile-tab.is-active { border-color: rgba(41,162,167,.34); background: var(--brand-soft); color: #dff9fa; }
.profile-panel { display: grid; min-width: 0; gap: 16px; }
.profile-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; min-width: 0; }
.profile-grid-wide { grid-column: 1 / -1; }
.profile-readonly-grid > div { display: grid; min-width: 0; gap: 5px; padding: 13px; border: 1px solid var(--border-soft); border-radius: 9px; background: #0d1418; }
.profile-readonly-grid span { color: var(--muted); font-size: 10px; }
.profile-readonly-grid strong { overflow-wrap: anywhere; font-size: 12px; }
.sensitive-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.sensitive-heading > div { display: grid; gap: 4px; }
.sensitive-heading strong { font-size: 13px; }
.profile-subsection { display: grid; gap: 12px; padding-top: 2px; }
.profile-subsection > strong { padding-bottom: 8px; border-bottom: 1px solid var(--border-soft); font-size: 12px; }
.profile-restricted { display: grid; justify-items: center; min-height: 190px; place-content: center; gap: 8px; padding: 24px; border: 1px dashed var(--border); border-radius: 10px; text-align: center; }
.profile-restricted > span { color: var(--amber); font-size: 13px; }
.profile-restricted strong { font-size: 13px; }
.profile-restricted p { max-width: 520px; margin: 0; color: var(--muted); font-size: 11px; line-height: 1.55; }
.profile-history { display: grid; overflow: hidden; border: 1px solid var(--border-soft); border-radius: 10px; }
.profile-history article { display: grid; grid-template-columns: minmax(0, 1fr) minmax(150px, auto); align-items: center; gap: 16px; padding: 13px; border-top: 1px solid var(--border-soft); }
.profile-history article:first-child { border-top: 0; }
.profile-history article > div { display: grid; min-width: 0; gap: 3px; }
.profile-history article > div:last-child { justify-items: end; text-align: right; }
.profile-history strong { font-size: 11px; }
.profile-history span, .profile-history time, .profile-meta { color: var(--muted); font-size: 10px; line-height: 1.45; }

@media (max-width: 780px) {
  .topbar { min-height: 74px; padding: 14px 18px; }
  .user-chip { min-width: 0; }
  .user-chip div { display: none; }
  .home-nav-inner { align-items: flex-start; flex-direction: column; gap: 8px; padding: 11px 18px; }
  .home-nav nav { width: 100%; }
  .preview-banner, .error-banner { margin: 14px 18px 0; }
  .preview-badge { display: none; }
  main { padding: 25px 18px 44px; }
  .page-head { align-items: flex-start; flex-direction: column; }
  .stats { grid-template-columns: 1fr 1fr; }
  .list-row { grid-template-columns: 1fr auto; }
  .list-meta { grid-column: 1 / -1; }
  .audit-entry { grid-template-columns: 1fr; }
  .audit-meta { justify-items: start; text-align: left; }
  .operation-card-head { flex-direction: column; }
  .operation-actions { width: 100%; justify-content: space-between; }
  .operation-week { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .schedule-editor-day { grid-template-columns: 70px minmax(0, 1fr); }
  .schedule-editor-day > .button { grid-column: 2; justify-self: start; }
  .card-section-head, .profile-hero { align-items: flex-start; flex-direction: column; }
  .profile-photo-actions { margin-left: 0; }
  .profile-grid { grid-template-columns: 1fr; }
  .profile-grid-wide { grid-column: 1; }
  .profile-history article { grid-template-columns: 1fr; }
  .profile-history article > div:last-child { justify-items: start; text-align: left; }
}
@media (max-width: 500px) {
  .stats { grid-template-columns: 1fr; }
  .field-row, .field-row-short-end, .schedule-day { grid-template-columns: 1fr; }
  .schedule-day span { display: none; }
  .operation-card { padding: 15px; }
  .operation-actions, .operation-foot, .section-divider, .schedule-editor-head { align-items: flex-start; flex-direction: column; }
  .lunch-rule { align-items: flex-start; flex-direction: column; }
  .lunch-rule span { text-align: left; }
  .schedule-editor-actions { width: 100%; justify-content: flex-start; }
  .operation-week { grid-template-columns: 1fr; }
  .schedule-editor-day { grid-template-columns: minmax(0, 1fr); }
  .schedule-editor-label { padding-top: 0; }
  .schedule-editor-day > .button { grid-column: 1; }
  .schedule-range { grid-template-columns: minmax(0, 1fr) 18px minmax(0, 1fr) 32px; gap: 5px; }
  .card-section-head .button, .profile-photo-actions { width: 100%; }
  .profile-photo-actions .button { flex: 1 1 auto; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; } }
