:root {
  color-scheme: light;
  --ink: #192326;
  --muted: #687579;
  --line: #dce3e2;
  --soft: #f1f5f4;
  --paper: #ffffff;
  --canvas: #e9eeec;
  --accent: #16745f;
  --accent-dark: #105c4b;
  --yellow: #e7b94e;
  --red: #a53f3f;
  --sidebar: #152521;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--canvas); color: var(--ink); }
body { font-size: 15px; letter-spacing: 0; }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.app-shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; background: var(--sidebar); color: #f7fbf9; padding: 22px 16px; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { display: grid; place-items: center; width: 44px; height: 44px; flex: 0 0 44px; border-radius: 6px; overflow: hidden; }
.brand-mark img { display: block; width: 100%; height: 100%; object-fit: contain; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 15px; }
.brand small { margin-top: 3px; color: #9db0aa; font-size: 11px; }
.nav { display: grid; gap: 6px; margin-top: 42px; }
.nav a { display: flex; align-items: center; gap: 12px; color: #bdcbc7; text-decoration: none; padding: 11px 12px; border-radius: 6px; font-weight: 650; }
.nav a:hover { background: #20332e; color: white; }
.nav a.active { background: #f4f7f5; color: #14231f; }
.nav-icon { width: 20px; text-align: center; font-size: 19px; }
.sidebar-foot { margin-top: auto; display: grid; gap: 16px; }
.worker-indicator { display: flex; align-items: center; gap: 10px; padding: 12px; border-top: 1px solid #32423e; border-bottom: 1px solid #32423e; }
.worker-indicator > span { width: 9px; height: 9px; border-radius: 50%; background: #47bd87; box-shadow: 0 0 0 4px #25483b; }
.worker-indicator[data-online="false"] > span { background: #c65a52; box-shadow: 0 0 0 4px #54302b; }
.worker-indicator strong, .worker-indicator small { display: block; }
.worker-indicator small { margin-top: 2px; color: #98aaa4; font-size: 11px; }
.quiet-button { width: 100%; border: 1px solid #42534e; border-radius: 5px; color: #cbd6d3; background: transparent; padding: 9px 12px; cursor: pointer; }

.main { min-width: 0; padding: 0 34px 60px; }
.topbar { min-height: 96px; display: flex; align-items: center; justify-content: space-between; gap: 24px; border-bottom: 1px solid #cbd4d1; }
.topbar h1 { margin: 2px 0 0; font-size: 27px; line-height: 1.1; }
.eyebrow { margin: 0; color: var(--accent); font-size: 11px; font-weight: 800; letter-spacing: 1.4px; }
.account { display: grid; justify-items: end; gap: 3px; min-width: 0; }
.account span { color: var(--muted); font-size: 11px; text-transform: uppercase; }
.account strong { max-width: 280px; overflow: hidden; text-overflow: ellipsis; }
.notice { margin-top: 18px; padding: 12px 15px; border: 1px solid; border-radius: 5px; }
.notice.success { background: #e4f4ec; border-color: #aad5c1; color: #155c48; }
.notice.error { background: #f8e8e6; border-color: #e5bbb6; color: #862f2f; }

.stats-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); background: var(--paper); border-bottom: 1px solid var(--line); margin: 24px 0 0; }
.stats-strip > div { min-width: 0; padding: 18px 20px; border-right: 1px solid var(--line); }
.stats-strip > div:last-child { border-right: 0; }
.stats-strip span, .stats-strip strong { display: block; }
.stats-strip span { color: var(--muted); font-size: 12px; }
.stats-strip strong { margin-top: 7px; font-size: 21px; }
.stats-strip .status-good { color: var(--accent); font-size: 16px; }
.stats-strip .status-bad { color: var(--red); }

.section { margin-top: 34px; }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 14px; }
.section h2, .upload-panel h2, .storage-hero h2 { margin: 4px 0 0; font-size: 20px; }
.section-note { color: var(--muted); font-size: 12px; text-align: right; }
.channel-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.channel-card { background: var(--paper); border: 1px solid var(--line); border-radius: 7px; padding: 18px; min-width: 0; }
.channel-top { display: grid; grid-template-columns: 42px minmax(0, 1fr) auto; align-items: center; gap: 12px; }
.channel-avatar { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 6px; background: #d8e9e3; color: var(--accent-dark); font-size: 18px; font-weight: 800; }
.channel-top h3 { margin: 0; font-size: 16px; }
.channel-top p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.priority { border-radius: 12px; padding: 5px 9px; font-size: 11px; font-weight: 700; }
.priority.normal { background: #edf2f0; color: #53635f; }
.priority.urgent { background: #f8e6df; color: #8a3d2f; }
.channel-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin-top: 16px; }
.channel-metrics div { padding: 13px 10px 13px 0; min-width: 0; }
.channel-metrics span, .channel-metrics strong { display: block; }
.channel-metrics span { color: var(--muted); font-size: 11px; line-height: 1.3; min-height: 28px; }
.channel-metrics strong { margin-top: 4px; font-size: 15px; overflow-wrap: anywhere; }
.path-line { color: var(--muted); margin: 13px 0 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 11px; }
.empty-state { background: var(--paper); border: 1px dashed #aebbb7; padding: 24px; color: var(--muted); }

.split-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; align-items: start; }
.table-wrap { background: var(--paper); border: 1px solid var(--line); overflow-x: auto; }
table { width: 100%; border-collapse: collapse; table-layout: fixed; }
th { background: var(--soft); color: var(--muted); text-align: left; font-size: 11px; padding: 10px 12px; }
td { border-top: 1px solid var(--line); padding: 12px; vertical-align: middle; overflow: hidden; text-overflow: ellipsis; }
td strong, td small { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
td small { color: var(--muted); margin-top: 3px; font-size: 10px; }
.worker-error { color: var(--red); white-space: nowrap; }
.worker-error.worker-wait { color: #efcf8a; }
.project-status { margin-top: 6px; text-align: right; }
.cloud-progress { display: flex; justify-content: space-between; gap: 8px; margin-top: 5px; color: var(--accent); font-size: 10px; white-space: nowrap; }
.cloud-progress b { font-size: 10px; }
.projects-table th:nth-child(1) { width: 25%; }
.projects-table th:nth-child(2) { width: 14%; }
.projects-table th:nth-child(3) { width: 19%; }
.projects-table th:nth-child(4) { width: 18%; }
.projects-table th:nth-child(5) { width: 190px; }
.stage { display: block; white-space: normal; line-height: 1.25; overflow-wrap: anywhere; }
.progress-row { display: grid; grid-template-columns: minmax(70px, 1fr) 38px; align-items: center; gap: 8px; }
.progress { height: 7px; background: #e3e9e7; overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--accent); }
.progress-row b { font-size: 11px; text-align: right; }
.actions { display: flex; align-items: center; justify-content: flex-end; gap: 5px; overflow: visible; }
.actions form { margin: 0; }
.icon-button { display: grid; place-items: center; width: 30px; height: 30px; border: 1px solid var(--line); border-radius: 5px; background: white; color: var(--ink); text-decoration: none; cursor: pointer; }
.icon-button:hover { border-color: var(--accent); color: var(--accent); }
.icon-button.action-primary { background: var(--accent); border-color: var(--accent); color: white; }
.synced { display: grid; place-items: center; width: 30px; height: 30px; color: var(--accent); font-weight: 800; }
.empty-cell { color: var(--muted); text-align: center; padding: 30px; }
.action-menu { position: relative; }
.action-menu summary { list-style: none; }
.action-menu summary::-webkit-details-marker { display: none; }
.action-menu > div { position: fixed; z-index: 1000; width: 210px; max-height: min(320px, calc(100vh - 24px)); overflow-y: auto; padding: 5px; background: white; border: 1px solid var(--line); box-shadow: 0 12px 32px #23322e35; }
.action-menu > div button, .action-menu > div > a { display: block; width: 100%; border: 0; background: transparent; padding: 9px 10px; text-align: left; cursor: pointer; color: var(--ink); text-decoration: none; font: inherit; }
.action-menu > div button:hover, .action-menu > div > a:hover { background: var(--soft); }

.upload-panel { background: #f8faf9; border: 1px solid var(--line); border-top: 3px solid var(--yellow); padding: 20px; }
.form-stack { display: grid; gap: 14px; margin-top: 20px; }
.form-stack label { display: grid; gap: 7px; color: #44514e; font-size: 12px; font-weight: 700; }
.form-stack input, .form-stack select { width: 100%; height: 42px; border: 1px solid #bdc9c6; border-radius: 5px; background: white; color: var(--ink); padding: 0 11px; outline: none; }
.form-stack input:focus, .form-stack select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px #dceee8; }
.primary-button { border: 0; border-radius: 5px; background: var(--accent); color: white; padding: 12px 16px; font-weight: 750; cursor: pointer; }
.primary-button:hover { background: var(--accent-dark); }
.primary-button:disabled { opacity: .45; cursor: not-allowed; }
.secondary-button, .danger-button { border-radius: 5px; padding: 9px 12px; font-weight: 700; cursor: pointer; }
.secondary-button { border: 1px solid #b8c5c1; color: var(--ink); background: white; text-decoration: none; }
.danger-button { border: 1px solid #d7aaa4; color: #862f2f; background: #fff7f6; }
.danger-button:hover { background: #f8e8e6; }
.file-input input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.file-input span { display: grid; place-items: center; min-height: 70px; border: 1px dashed #96aaa4; background: white; color: var(--accent); cursor: pointer; }
.file-input.is-dragging span { border-color: var(--accent); background: #e7f4ef; box-shadow: 0 0 0 3px #d3e9e1; }
.file-input.has-file span { border-style: solid; color: var(--ink); overflow-wrap: anywhere; padding: 10px; text-align: center; }
.drive-upload-row td { padding: 9px 12px 12px; background: #f7faf9; }
.drive-upload-progress { display: grid; grid-template-columns: 150px minmax(100px, 1fr) 42px; align-items: center; gap: 10px; }
.drive-upload-progress span, .drive-upload-progress b { font-size: 11px; }
.drive-upload-progress b { text-align: right; }
.drive-upload-error { color: var(--red); margin-top: 6px; white-space: normal; }

.channels-layout { grid-template-columns: minmax(0, 1fr) 340px; }
.management-list { display: grid; gap: 12px; }
.readonly-channel { padding: 18px; }
.readonly-channel-head { display: flex; align-items: center; gap: 12px; }
.readonly-channel-head > div { display: grid; gap: 3px; min-width: 0; }
.readonly-channel-head small { color: var(--muted); }
.readonly-channel .channel-metrics { margin-top: 16px; }
.user-state { width: 10px; height: 10px; border-radius: 50%; background: #17836d; box-shadow: 0 0 0 4px #dff0ea; }
.user-state.disabled { background: #8e9996; box-shadow: 0 0 0 4px #e8ecea; }
.user-edit-form { padding: 18px; border-top: 1px solid var(--line); background: #f8faf9; }
.channel-access-list { display: grid; gap: 9px; margin: 0; padding: 13px; border: 1px solid var(--line); border-radius: 5px; }
.channel-access-list legend { padding: 0 5px; color: #44514e; font-size: 12px; font-weight: 750; }
.channel-access-list label { display: flex; align-items: center; gap: 9px; font-weight: 600; }
.channel-access-list input { width: 17px; height: 17px; margin: 0; }
.management-card, .archive-row { background: var(--paper); border: 1px solid var(--line); }
.management-card > summary { display: grid; grid-template-columns: 42px minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 16px; cursor: pointer; list-style: none; }
.management-card > summary::-webkit-details-marker { display: none; }
.management-card summary strong, .management-card summary small { display: block; }
.management-card summary small { color: var(--muted); margin-top: 4px; }
.summary-action { color: var(--accent); font-size: 12px; font-weight: 750; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; padding: 18px; border-top: 1px solid var(--line); background: #f8faf9; }
.form-grid label { display: grid; gap: 7px; color: #44514e; font-size: 12px; font-weight: 700; }
.form-grid label > small { color: var(--muted); font-size: 10px; font-weight: 500; line-height: 1.4; }
.form-grid input, .form-grid select { min-width: 0; width: 100%; height: 42px; border: 1px solid #bdc9c6; border-radius: 5px; background: white; padding: 0 11px; }
.form-grid .wide { grid-column: 1 / -1; }
.form-actions { display: flex; justify-content: flex-end; }
.danger-zone { display: flex; justify-content: flex-end; padding: 12px 18px; border-top: 1px solid var(--line); }
.archive-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 16px; }
.archive-row strong, .archive-row small { display: block; }
.archive-row small { color: var(--muted); margin-top: 5px; }
.archive-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.archive-actions form { display: flex; align-items: center; gap: 8px; margin: 0; }
.check-label { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 11px; }
.modal { width: min(92vw, 560px); max-height: calc(100vh - 40px); border: 0; border-radius: 8px; padding: 0; overflow: hidden; box-shadow: 0 18px 60px #13251f50; }
.modal::backdrop { background: #10211d99; }
.modal-form { display: grid; margin: 0; background: white; }
.modal-form > .modal-head { padding: 22px 24px 18px; border-bottom: 1px solid var(--line); }
.modal-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; padding: 22px 24px; overflow-y: auto; }
.modal-form-grid label { display: grid; align-content: start; gap: 7px; min-width: 0; color: #44514e; font-size: 12px; font-weight: 700; }
.modal-form-grid label.wide { grid-column: 1 / -1; }
.modal-form-grid input, .modal-form-grid select { width: 100%; min-width: 0; height: 42px; border: 1px solid #bdc9c6; border-radius: 5px; background: white; padding: 0 11px; }
.modal-form-grid input:focus, .modal-form-grid select:focus { border-color: var(--accent); outline: 0; box-shadow: 0 0 0 3px #dceee8; }
.modal-actions { display: flex; justify-content: flex-end; gap: 9px; padding: 16px 24px 20px; border-top: 1px solid var(--line); background: #f8faf9; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.modal-head h2 { margin: 0; }
.modal-close { width: 34px; height: 34px; border: 0; background: transparent; font-size: 25px; cursor: pointer; color: var(--muted); }
.log-modal { width: min(94vw, 900px); }
.log-panel { padding: 22px; }
.log-project-title { color: var(--muted); margin: 5px 0 14px; }
.log-panel pre { height: min(62vh, 560px); margin: 0; overflow: auto; padding: 16px; background: #111a18; color: #d6e5e0; font: 12px/1.55 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
.stage-modal { width: min(96vw, 980px); }
.stage-panel { max-height: calc(100vh - 40px); padding: 24px; overflow-y: auto; }
.stage-project-title { margin: 5px 0 0; color: var(--ink); font-weight: 750; }
.stage-help { margin: 8px 0 18px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.stage-list { display: grid; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.stage-loading { padding: 28px; color: var(--muted); text-align: center; }
.stage-item { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; align-items: center; gap: 10px; min-height: 62px; padding: 10px 12px; border-top: 1px solid var(--line); }
.stage-item:first-child { border-top: 0; }
.stage-item > div:nth-child(2) { min-width: 0; }
.stage-item strong, .stage-item small { display: block; }
.stage-item small { margin-top: 3px; color: var(--muted); }
.stage-marker { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: #edf2f0; color: var(--muted); font-weight: 800; }
.stage-item.state-complete .stage-marker { background: #dff0ea; color: var(--accent); }
.stage-item.state-partial .stage-marker { background: #fff1cb; color: #8a6514; }
.stage-actions { display: flex; align-items: center; justify-content: flex-end; gap: 7px; }
.stage-download, .stage-replace, .stage-restart, .stage-delete { border-radius: 5px; padding: 8px 10px; font-size: 11px; font-weight: 700; text-decoration: none; white-space: nowrap; }
.stage-download { border: 1px solid #b8c5c1; background: white; color: var(--ink); }
.stage-replace { border: 1px solid #9bbcb2; background: #f3faf7; color: var(--accent-dark); cursor: pointer; }
.stage-replace input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.stage-replace.disabled { opacity: .45; cursor: not-allowed; }
.stage-replace.uploading { min-width: 82px; text-align: center; border-color: var(--accent); background: #dff0ea; }
.stage-replace.failed { border-color: #d7aaa4; background: #fff7f6; color: #862f2f; }
.stage-restart { border: 1px solid #d7aaa4; background: #fff7f6; color: #862f2f; cursor: pointer; }
.stage-delete { border: 1px solid #d7aaa4; background: white; color: #862f2f; cursor: pointer; }
.stage-restart:disabled, .stage-delete:disabled { opacity: .45; cursor: not-allowed; }
.revision-section { margin-top: 20px; }
.revision-section h3 { margin: 0; font-size: 15px; }
.revision-section > p { margin: 5px 0 10px; color: var(--muted); font-size: 11px; }
.revision-list { display: grid; border: 1px solid var(--line); }
.revision-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 11px 12px; border-top: 1px solid var(--line); }
.revision-item:first-child { border-top: 0; }
.revision-item strong, .revision-item small { display: block; }
.revision-item small { margin-top: 3px; color: var(--muted); }
.revision-restore { border: 1px solid #9bbcb2; border-radius: 5px; padding: 8px 10px; background: #f3faf7; color: var(--accent-dark); font-size: 11px; font-weight: 700; cursor: pointer; white-space: nowrap; }
.revision-restore:disabled { opacity: .45; cursor: not-allowed; }
.calendar-strip { display: grid; grid-template-columns: repeat(7, minmax(110px, 1fr)); background: var(--paper); border: 1px solid var(--line); overflow-x: auto; }
.calendar-strip div { min-width: 110px; min-height: 96px; padding: 13px; border-right: 1px solid var(--line); }
.calendar-strip div:last-child { border-right: 0; }
.calendar-strip span, .calendar-strip strong, .calendar-strip small { display: block; }
.calendar-strip span { color: var(--muted); font-size: 11px; }
.calendar-strip strong { margin-top: 12px; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.calendar-strip small { margin-top: 3px; color: var(--muted); font-size: 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.section-actions { display: flex; align-items: center; gap: 12px; }

.storage-hero { display: flex; align-items: center; justify-content: space-between; gap: 30px; margin-top: 28px; background: var(--paper); border-left: 4px solid var(--accent); padding: 24px; }
.storage-hero p:last-child { color: var(--muted); margin: 8px 0 0; }
.storage-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-top: 16px; background: var(--paper); border: 1px solid var(--line); }
.storage-grid div { padding: 18px; border-right: 1px solid var(--line); min-width: 0; }
.storage-grid div:last-child { border-right: 0; }
.storage-grid span, .storage-grid strong { display: block; overflow-wrap: anywhere; }
.storage-grid span { color: var(--muted); font-size: 11px; }
.storage-grid strong { margin-top: 8px; }
.folder-tree { display: grid; gap: 9px; background: var(--paper); border: 1px solid var(--line); padding: 20px; }
.folder-tree span { color: var(--muted); }
.folder-tree .indent { padding-left: 24px; }
.folder-tree .indent-2 { padding-left: 48px; }
.retention-band { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 16px; border: 1px solid var(--line); background: var(--paper); }
.retention-band > div { min-width: 0; padding: 18px; border-right: 1px solid var(--line); }
.retention-band > div:last-child { border-right: 0; }
.retention-band span, .retention-band strong, .retention-band small { display: block; }
.retention-band span, .retention-band small { color: var(--muted); }
.retention-band span { font-size: 11px; }
.retention-band strong { margin: 7px 0 4px; }
.retention-band small { line-height: 1.4; }
.upload-policy { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--line); background: var(--paper); }
.upload-policy > div { min-width: 0; padding: 17px; border-right: 1px solid var(--line); }
.upload-policy > div:last-child { border-right: 0; }
.upload-policy b { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--accent); color: white; font-size: 10px; }
.upload-policy strong, .upload-policy span { display: block; }
.upload-policy strong { margin: 9px 0 5px; font-size: 12px; }
.upload-policy span { color: var(--muted); font-size: 10px; line-height: 1.45; }
.storage-filters { display: flex; align-items: end; justify-content: flex-end; gap: 9px; }
.storage-filters label, .calendar-filter label { display: grid; gap: 5px; color: var(--muted); font-size: 10px; font-weight: 700; }
.storage-filters select, .calendar-filter select { height: 36px; min-width: 150px; border: 1px solid #bdc9c6; border-radius: 5px; background: white; padding: 0 9px; }
.storage-table th:nth-child(1) { width: 25%; }
.storage-table th:nth-child(2) { width: 16%; }
.storage-table th:nth-child(3) { width: 12%; }
.storage-table th:nth-child(4) { width: 18%; }
.storage-table th:nth-child(5) { width: 22%; }
.storage-table th:last-child { width: 44px; }
.storage-table td small { white-space: normal; }
.channel-calendar-link { display: inline-block; margin-top: 13px; color: var(--accent); font-size: 11px; font-weight: 750; text-decoration: none; }
.process-strip { display: grid; grid-template-columns: repeat(8, minmax(82px, 1fr)); margin-top: 14px; border: 1px solid var(--line); background: var(--paper); overflow-x: auto; }
.process-strip > div { min-width: 82px; padding: 12px; border-right: 1px solid var(--line); }
.process-strip > div:last-child { border-right: 0; }
.process-strip span, .process-strip strong { display: block; }
.process-strip span { color: var(--muted); font-size: 9px; text-transform: uppercase; }
.process-strip strong { margin-top: 5px; font-size: 17px; }
.process-strip .busy { box-shadow: inset 0 3px 0 var(--accent); background: #f4faf7; }
.settings-hint { margin: 0; padding: 11px 12px; border-left: 3px solid var(--yellow); background: #fff9e8; color: #596460; font-size: 11px; line-height: 1.5; }

.calendar-toolbar { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: end; gap: 18px; margin-top: 28px; padding: 18px; border: 1px solid var(--line); background: var(--paper); }
.calendar-toolbar h2 { margin: 4px 0 0; font-size: 24px; }
.calendar-nav { display: flex; align-items: center; gap: 8px; }
.month-calendar { margin-top: 16px; border: 1px solid var(--line); background: var(--paper); }
.calendar-weekdays, .calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(115px, 1fr)); }
.calendar-weekdays span { padding: 10px 12px; border-right: 1px solid var(--line); background: #eef3f1; color: var(--muted); font-size: 10px; font-weight: 800; text-transform: uppercase; }
.calendar-weekdays span:last-child { border-right: 0; }
.month-day { min-height: 132px; padding: 10px; border-top: 1px solid var(--line); border-right: 1px solid var(--line); background: white; }
.month-day:nth-child(7n) { border-right: 0; }
.month-day.outside { background: #f5f7f6; color: #a0aaa7; }
.month-day.today { position: relative; box-shadow: inset 0 0 0 2px var(--yellow), 0 0 18px #efc14f35; }
.month-day time { display: grid; place-items: center; width: 25px; height: 25px; font-size: 11px; font-weight: 800; }
.month-day.today time { border-radius: 50%; background: var(--yellow); color: #12231e; }
.calendar-events { display: grid; gap: 6px; margin-top: 7px; }
.calendar-event { min-width: 0; padding: 7px 8px; border-left: 3px solid #86928e; background: #f3f5f4; color: var(--ink); text-decoration: none; box-shadow: 0 3px 10px transparent; }
.calendar-event strong, .calendar-event span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.calendar-event strong { font-size: 10px; }
.calendar-event span { margin-top: 3px; color: var(--muted); font-size: 9px; }
.calendar-event.status-ready { border-color: #278969; background: #eaf7f1; box-shadow: 0 3px 12px #27896922; }
.calendar-event.status-active { border-color: #3377c8; background: #edf4ff; box-shadow: 0 3px 12px #3377c822; }
.calendar-event.status-stock { border-color: #d1a42f; background: #fff8e3; box-shadow: 0 3px 12px #d1a42f22; }
.calendar-event.status-error { border-color: #c9564d; background: #fff0ee; box-shadow: 0 3px 12px #c9564d22; }
.calendar-legend { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 12px; color: var(--muted); font-size: 11px; }
.calendar-legend span::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 6px; border-radius: 50%; background: #86928e; box-shadow: 0 0 8px currentColor; }
.calendar-legend .ready::before { background: #278969; }.calendar-legend .active::before { background: #3377c8; }.calendar-legend .stock::before { background: #d1a42f; }.calendar-legend .error::before { background: #c9564d; }
.settings-title { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin: 26px 0 18px; }
.settings-title h2 { margin: 4px 0 5px; font-size: 24px; }
.settings-title p:last-child { margin: 0; color: var(--muted); }
.production-settings { display: grid; gap: 18px; padding-bottom: 90px; }
.settings-band { background: var(--paper); border: 1px solid var(--line); border-left: 4px solid var(--accent); padding: 22px; }
.settings-band-title { margin-bottom: 18px; }
.settings-band-title h2 { margin: 4px 0 0; font-size: 18px; }
.settings-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.settings-grid textarea { width: 100%; resize: vertical; min-height: 100px; }
.toggle-field { display: flex; flex-direction: row; align-items: center; align-self: end; gap: 9px; min-height: 43px; padding: 10px 12px; border: 1px solid var(--line); background: #f8faf9; }
.toggle-field input { width: 17px; height: 17px; margin: 0; }
.settings-details { margin-top: 14px; border-top: 1px solid var(--line); }
.settings-details summary { padding: 15px 0 13px; color: var(--accent-dark); font-weight: 750; cursor: pointer; }
.settings-save { position: sticky; bottom: 14px; display: flex; justify-content: flex-end; padding: 12px; border: 1px solid var(--line); background: rgba(246, 248, 247, .96); backdrop-filter: blur(8px); }
.settings-save .primary-button { min-width: 220px; }
.diagnostic-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-top: 28px; border: 1px solid var(--line); background: var(--paper); }
.diagnostic-summary > div { position: relative; min-width: 0; padding: 18px 18px 18px 38px; border-right: 1px solid var(--line); }
.diagnostic-summary > div:last-child { border-right: 0; }
.diagnostic-summary small, .diagnostic-summary strong { display: block; overflow-wrap: anywhere; }
.diagnostic-summary small { color: var(--muted); }
.diagnostic-summary strong { margin-top: 7px; font-size: 13px; }
.diagnostic-light { position: absolute; top: 21px; left: 18px; width: 9px; height: 9px; border-radius: 50%; }
.diagnostic-light.good { background: #39a978; }
.diagnostic-light.bad { background: #c65a52; }
.diagnostic-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border: 1px solid var(--line); background: var(--paper); }
.diagnostic-grid > div { min-width: 0; padding: 18px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.diagnostic-grid > div:nth-child(3n) { border-right: 0; }
.diagnostic-grid > div:nth-last-child(-n+3) { border-bottom: 0; }
.diagnostic-grid span, .diagnostic-grid strong, .diagnostic-grid small { display: block; overflow-wrap: anywhere; }
.diagnostic-grid span, .diagnostic-grid small { color: var(--muted); font-size: 11px; }
.diagnostic-grid strong { margin: 8px 0 4px; }
.backup-line { display: grid; grid-template-columns: 2fr 1fr 1fr; border: 1px solid var(--line); background: var(--paper); }
.backup-line > div { padding: 18px; border-right: 1px solid var(--line); }
.backup-line > div:last-child { border-right: 0; }
.backup-line span, .backup-line strong { display: block; }
.backup-line span { color: var(--muted); font-size: 11px; }
.backup-line strong { margin-top: 7px; overflow-wrap: anywhere; }
.worker-state-line { display: grid; grid-template-columns: 10px auto minmax(0, 1fr); align-items: center; gap: 10px; background: var(--paper); border: 1px solid var(--line); padding: 16px; }
.worker-state-line > span { width: 9px; height: 9px; border-radius: 50%; background: #47bd87; }
.worker-state-line[data-online="false"] > span { background: #c65a52; }
.worker-state-line small { color: var(--muted); text-align: right; }

.auth-page { display: grid; place-items: center; min-height: 100vh; background: var(--sidebar); padding: 24px; }
.auth-panel { width: min(100%, 480px); background: #f6f8f7; border-top: 5px solid var(--yellow); padding: 34px; }
.auth-panel.compact { width: min(100%, 420px); }
.auth-brand { margin-bottom: 36px; }
.auth-brand small { color: var(--muted); }
.auth-panel h1 { margin: 7px 0 0; font-size: 26px; }
.auth-copy { color: var(--muted); line-height: 1.55; }

@media (max-width: 1050px) {
  .app-shell { grid-template-columns: 78px minmax(0, 1fr); }
  .sidebar { padding: 18px 10px; }
  .brand > span:last-child, .nav a:not(.active) { font-size: 0; }
  .nav a { justify-content: center; gap: 0; }
  .nav a.active { font-size: 0; }
  .nav-icon { font-size: 20px; }
  .worker-indicator div, .sidebar-foot form { display: none; }
  .worker-indicator { justify-content: center; }
  .split-layout { grid-template-columns: 1fr; }
  .upload-panel { width: min(100%, 500px); }
}

@media (max-width: 760px) {
  .modal-form-grid { grid-template-columns: 1fr; }
  .modal-form-grid label.wide { grid-column: auto; }
  .modal-actions { flex-direction: column-reverse; }
  .modal-actions button { width: 100%; }
  .stage-item { grid-template-columns: 26px minmax(0, 1fr); }
  .stage-actions { grid-column: 1 / -1; justify-content: flex-start; flex-wrap: wrap; padding-left: 36px; }
  .section-actions { align-items: flex-end; flex-direction: column; }
  .app-shell { display: block; }
  .sidebar { position: static; width: 100%; height: auto; flex-direction: row; align-items: center; gap: 16px; padding: 10px 14px; }
  .brand-mark { width: 34px; height: 34px; }
  .nav { display: flex; margin: 0 0 0 auto; }
  .nav a { padding: 8px; }
  .sidebar-foot { display: none; }
  .main { padding: 0 14px 40px; }
  .topbar { min-height: 78px; }
  .account { display: none; }
  .stats-strip { grid-template-columns: repeat(2, 1fr); }
  .stats-strip > div:nth-child(2) { border-right: 0; }
  .channel-grid { grid-template-columns: 1fr; }
  .section-head { align-items: start; flex-direction: column; }
  .section-note { text-align: left; }
  .storage-hero { align-items: start; flex-direction: column; }
  .storage-grid { grid-template-columns: repeat(2, 1fr); }
  .storage-grid div:nth-child(2) { border-right: 0; }
  .retention-band { grid-template-columns: 1fr; }
  .retention-band > div { border-right: 0; border-bottom: 1px solid var(--line); }
  .retention-band > div:last-child { border-bottom: 0; }
  .upload-policy { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .upload-policy > div:nth-child(2) { border-right: 0; }
  .upload-policy > div:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .storage-filters, .calendar-toolbar { align-items: stretch; grid-template-columns: 1fr; }
  .storage-filters { flex-direction: column; }
  .storage-filters select, .calendar-filter select { width: 100%; }
  .month-calendar { overflow-x: auto; }
  .calendar-weekdays, .calendar-grid { min-width: 805px; }
  .drive-upload-progress { grid-template-columns: 1fr 38px; }
  .drive-upload-progress span { grid-column: 1 / -1; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .wide { grid-column: auto; }
  .archive-row, .archive-actions { align-items: stretch; flex-direction: column; }
  .archive-actions form { justify-content: space-between; }
  .revision-item { grid-template-columns: 1fr; }
  .revision-restore { justify-self: start; }
  .settings-title { align-items: flex-start; flex-direction: column; }
  .settings-grid { grid-template-columns: 1fr; }
  .diagnostic-summary, .diagnostic-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .diagnostic-summary > div:nth-child(2) { border-right: 0; }
  .diagnostic-summary > div:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .diagnostic-grid > div { border-right: 0; border-bottom: 1px solid var(--line); }
  .diagnostic-grid > div:nth-child(odd) { border-right: 1px solid var(--line); }
  .diagnostic-grid > div:nth-last-child(-n+2) { border-bottom: 0; }
  .backup-line { grid-template-columns: 1fr; }
  .backup-line > div { border-right: 0; border-bottom: 1px solid var(--line); }
  .backup-line > div:last-child { border-bottom: 0; }
}
