/* Mobile-first styles for Offliner Configurator */
:root {
  --bg: #0f1419;
  --surface: #1a2332;
  --border: #2d3a4d;
  --text: #e6edf3;
  --text-muted: #8b949e;
  --accent: #58a6ff;
  --accent-hover: #79b8ff;
  --danger: #f85149;
  --success: #3fb950;
  --radius: 12px;
  --touch-min: 48px;
  --accent-rgb: 88, 166, 255;
  --readonly-bg: rgba(0, 0, 0, 0.2);
  --table-header-bg: rgba(0, 0, 0, 0.15);
  --subtle-highlight: rgba(255, 255, 255, 0.06);
  --swatch-edge: rgba(255, 255, 255, 0.25);
  --interval-hour-line: rgba(255, 255, 255, 0.5);
  --day-toggle-bg: rgba(0, 0, 0, 0.18);
  --summary-panel-bg: rgba(0, 0, 0, 0.2);
  --shadow-toast: 0 6px 28px rgba(0, 0, 0, 0.45);
  --shadow-panel: -8px 0 32px rgba(0, 0, 0, 0.35);
  --shadow-dropdown: 0 8px 24px rgba(0, 0, 0, 0.4);
  --shadow-modal: 0 8px 32px rgba(0, 0, 0, 0.4);
  --modal-backdrop: rgba(0, 0, 0, 0.6);
  --menu-backdrop: rgba(0, 0, 0, 0.55);
  color-scheme: dark;
}

html[data-theme="light"] {
  color-scheme: light;
  --bg: #f6f8fa;
  --surface: #ffffff;
  --border: #d0d7de;
  --text: #1f2328;
  --text-muted: #656d76;
  --accent: #0969da;
  --accent-hover: #0550ae;
  --accent-rgb: 9, 105, 218;
  --readonly-bg: rgba(0, 0, 0, 0.06);
  --table-header-bg: rgba(0, 0, 0, 0.04);
  --subtle-highlight: rgba(0, 0, 0, 0.06);
  --swatch-edge: rgba(0, 0, 0, 0.2);
  --interval-hour-line: rgba(0, 0, 0, 0.12);
  --day-toggle-bg: rgba(0, 0, 0, 0.06);
  --summary-panel-bg: rgba(0, 0, 0, 0.04);
  --shadow-toast: 0 6px 28px rgba(31, 35, 40, 0.12);
  --shadow-panel: -8px 0 32px rgba(31, 35, 40, 0.1);
  --shadow-dropdown: 0 8px 24px rgba(31, 35, 40, 0.1);
  --shadow-modal: 0 8px 32px rgba(31, 35, 40, 0.12);
  --modal-backdrop: rgba(31, 35, 40, 0.45);
  --menu-backdrop: rgba(31, 35, 40, 0.4);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
}

.container {
  max-width: 480px;
  margin: 0 auto;
  padding: 24px 20px;
}

.container--wide {
  max-width: 720px;
}

h1 {
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0 0 24px;
  text-align: center;
}

.form-group {
  margin-bottom: 20px;
}

label {
  display: block;
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}

input, select, textarea {
  width: 100%;
  padding: 14px 16px;
  font-size: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  min-height: var(--touch-min);
}

select {
  scrollbar-width: none;
  -ms-overflow-style: none;
}
select::-webkit-scrollbar {
  display: none;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.2);
}

input::placeholder {
  color: var(--text-muted);
}

input.readonly-field,
input[readonly] {
  background: var(--readonly-bg);
  color: var(--text-muted);
  cursor: default;
}

.btn {
  display: inline-block;
  width: 100%;
  padding: 14px 20px;
  font-size: 1rem;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  min-height: var(--touch-min);
  transition: background 0.2s, color 0.2s;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover, .btn-primary:focus {
  background: var(--accent-hover);
}

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--border);
}

.pair-choice-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 24px;
}
.pair-choice-buttons .pair-choice-btn {
  margin: 0;
}
.link-back {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.875rem;
  display: inline-block;
  margin-bottom: 16px;
}
.link-back:hover {
  color: var(--accent);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-danger:hover {
  background: #da3633;
}

.btn-small {
  min-height: 40px;
  padding: 8px 14px;
  font-size: 0.875rem;
  width: auto;
}

.links {
  text-align: center;
  margin-top: 24px;
  font-size: 0.9375rem;
}

.links a {
  color: var(--accent);
  text-decoration: none;
}

.links a:hover {
  text-decoration: underline;
}

.links span {
  color: var(--text-muted);
  margin: 0 8px;
}

.error-msg {
  color: var(--danger);
  font-size: 0.875rem;
  margin-top: 8px;
}

.success-msg {
  color: var(--success);
  font-size: 0.875rem;
  margin-top: 8px;
}

/* Toasts (e.g. profile saved feedback) */
.toast-stack {
  position: fixed;
  left: 50%;
  bottom: max(24px, env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  max-width: min(420px, calc(100vw - 32px));
}
.toast {
  pointer-events: auto;
  padding: 12px 18px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-toast);
  font-size: 0.9375rem;
  line-height: 1.4;
  color: var(--text);
  text-align: center;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.28s ease, transform 0.28s ease;
}
.toast--visible {
  opacity: 1;
  transform: translateY(0);
}
.toast--success {
  border-left: 4px solid var(--success);
}
.toast--error {
  border-left: 4px solid var(--danger);
  color: var(--danger);
}

/* Nav */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}

.nav a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

.nav .nav-title-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.nav .title {
  font-weight: 600;
  color: var(--text);
}

.nav .nav-status {
  font-size: 0.75rem;
}

.nav .nav-status .badge {
  margin-left: 0;
}

.nav .nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav .nav-actions .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  height: 40px;
  min-height: 40px;
  padding: 0 14px;
  font-size: 0.875rem;
  line-height: 1;
}

.nav .nav-actions .btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.nav-menu-btn {
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  min-height: 40px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  cursor: pointer;
  flex-shrink: 0;
}

.nav-menu-btn:hover,
.nav-menu-btn:focus-visible {
  border-color: var(--accent);
  outline: none;
}

.nav-menu-bar {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--text);
  border-radius: 1px;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  min-height: 40px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  flex-shrink: 0;
}

.theme-toggle:hover,
.theme-toggle:focus-visible {
  border-color: var(--accent);
  outline: none;
}

.theme-toggle svg {
  display: block;
}

.theme-toggle__icon {
  display: flex;
  align-items: center;
  justify-content: center;
}

html[data-theme="dark"] .theme-toggle__icon--moon,
html[data-theme="light"] .theme-toggle__icon--sun {
  display: none;
}

.theme-toggle--floating {
  position: fixed;
  top: max(12px, env(safe-area-inset-top, 0px));
  right: max(12px, env(safe-area-inset-right, 0px));
  z-index: 300;
}

.app-menu-backdrop {
  position: fixed;
  inset: 0;
  z-index: 450;
  background: var(--menu-backdrop);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.app-menu-backdrop.is-open {
  opacity: 1;
  visibility: visible;
}

.app-menu-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 460;
  width: min(132px, 46vw);
  max-width: 100%;
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-panel);
  transform: translateX(100%);
  transition: transform 0.25s ease;
  display: flex;
  flex-direction: column;
  padding: 12px 10px 18px;
  box-sizing: border-box;
}

.app-menu-panel.is-open {
  transform: translateX(0);
}

.app-menu-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 6px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.app-menu-title {
  font-weight: 600;
  font-size: 0.8125rem;
  line-height: 1.2;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-menu-close {
  width: 36px;
  height: 36px;
  min-height: 36px;
  flex-shrink: 0;
  padding: 0;
  border: none;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-muted);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
}

.app-menu-close:hover,
.app-menu-close:focus-visible {
  color: var(--text);
  outline: none;
  background: var(--subtle-highlight);
}

.app-menu-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.app-menu-list li {
  border-bottom: 1px solid var(--border);
}

.app-menu-list li:last-child {
  border-bottom: none;
}

.app-menu-link {
  display: block;
  width: 100%;
  padding: 16px 4px;
  color: var(--text);
  text-decoration: none;
  font: inherit;
  font-size: 1rem;
  text-align: left;
  background: none;
  border: none;
  cursor: pointer;
  box-sizing: border-box;
}

.app-menu-link:hover,
.app-menu-link:focus-visible {
  color: var(--accent);
  outline: none;
}

.app-menu-profile-item {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px 0 10px;
}

.app-menu-profile-item .app-menu-profile.theme-toggle {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  text-decoration: none;
}

.app-menu-profile.theme-toggle:hover,
.app-menu-profile.theme-toggle:focus-visible {
  border-color: var(--accent);
  color: var(--accent);
  outline: none;
}

.app-menu-theme-item {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px 0 10px;
}

.app-menu-theme-item .app-menu-theme.theme-toggle {
  margin: 0;
  background: var(--bg);
}

.app-menu-logout-item {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px 0 0;
}

.app-menu-logout-item .app-menu-logout.theme-toggle {
  margin: 0;
  background: var(--bg);
  color: var(--danger);
}

.app-menu-logout.theme-toggle:hover,
.app-menu-logout.theme-toggle:focus-visible {
  border-color: var(--danger);
  color: #ff7b72;
  outline: none;
}

.profile-value {
  margin: 0;
  padding: 14px 16px;
  font-size: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--readonly-bg);
  color: var(--text);
  word-break: break-all;
}

/* Lists */
.list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.list-header h2 {
  font-size: 1.25rem;
  margin: 0;
}

.card-list {
  list-style: none;
  padding: 0;
  margin: 0 0 32px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
}

.card-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.card-actions .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  flex: 1;
  min-width: 80px;
}

.node-devices {
  margin-top: 10px;
  font-size: 0.875rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
}

/* Device badges live here; override global .badge margin-left: 8px */
.node-devices .badge {
  margin-left: 0;
}

.device-status-connected {
  color: var(--success);
}

.device-status-disconnected {
  color: var(--danger);
}

.badge-device-connected {
  background: rgba(63, 185, 80, 0.2);
  color: var(--success);
}

.badge-device-disconnected {
  background: rgba(248, 81, 73, 0.2);
  color: var(--danger);
}

.badge {
  display: inline-block;
  padding: 4px 10px;
  font-size: 0.75rem;
  border-radius: 999px;
  margin-left: 8px;
}

.badge-online {
  background: rgba(63, 185, 80, 0.2);
  color: var(--success);
}

.badge-offline {
  background: rgba(248, 81, 73, 0.2);
  color: var(--danger);
}

.badge-allowance {
  background: rgba(63, 185, 80, 0.2);
  color: var(--success);
}

/* Dashboard: node drawer open/closed (SVG uses currentColor) */
.node-drawer-indicator {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-right: 6px;
  vertical-align: -3px;
}

.node-drawer-indicator svg {
  display: block;
}

.node-drawer-indicator--open {
  color: var(--danger);
}

.node-drawer-indicator--closed {
  color: var(--text-muted);
  opacity: 0.85;
}

.node-drawer-indicator--unknown {
  color: var(--text-muted);
  opacity: 0.85;
}

.section {
  margin-bottom: 32px;
}

.section h2 {
  font-size: 1.125rem;
  color: var(--text-muted);
  margin: 0 0 12px;
}

.empty {
  color: var(--text-muted);
  text-align: center;
  padding: 24px;
}

/* Detail page */
.detail-row {
  margin-bottom: 16px;
}

.detail-row label {
  margin-bottom: 4px;
}

.sub-list {
  list-style: none;
  padding: 0;
  margin: 8px 0 0;
}

.sub-list li {
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.sub-list li:last-child {
  border-bottom: none;
}

/* Data tables */
.data-table-section {
  margin-bottom: 32px;
}

.data-table-section h2 {
  font-size: 1.125rem;
  color: var(--text-muted);
  margin: 0 0 12px;
  font-weight: 600;
}

.data-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
}

table.data-table th,
table.data-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

table.data-table th {
  font-weight: 600;
  color: var(--text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--table-header-bg);
}

table.data-table tr:last-child td {
  border-bottom: none;
}

table.data-table tbody tr:hover td {
  background: rgba(var(--accent-rgb), 0.06);
}

table.data-table td a {
  color: var(--accent);
  text-decoration: none;
}

table.data-table td a:hover {
  text-decoration: underline;
}

table.data-table .empty-row td {
  color: var(--text-muted);
  font-style: italic;
  text-align: center;
  padding: 20px;
}

table.data-table .empty-row:hover td {
  background: var(--surface);
}

/* Center status badge (span.badge) inside table cell */
table.data-table td:has(> .badge) {
  text-align: center;
  vertical-align: middle;
}

/* Center Status column header (child.html: policies + nodes tables) */
#policiesTable th:nth-child(2),
#nodesTable th:nth-child(3) {
  text-align: center;
}

table.data-table .badge {
  display: inline-block;
  padding: 4px 10px;
  font-size: 0.75rem;
  border-radius: 999px;
  margin: 0;
}

/* Keep action buttons (e.g. Rename, Unregister) on one line */
table.data-table td.cell-actions-nowrap {
  white-space: nowrap;
}

/* Reset password */
.reset-note {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 20px;
}

/* Protection policy: weekday interval bars (15-min slots) */
.interval-editor {
  margin-top: 16px;
}
.interval-editor-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.interval-editor-toolbar-label {
  font-size: 0.875rem;
  color: var(--text-muted);
}
.interval-brush-dropdown {
  position: relative;
}
.interval-brush-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 8px 12px;
}
.interval-brush-btn .interval-brush-swatch {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  flex-shrink: 0;
  border: 1px solid var(--swatch-edge);
}
.interval-brush-chevron {
  font-size: 0.625rem;
  opacity: 0.8;
  margin-left: 2px;
}
.interval-brush-dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 4px;
  min-width: 180px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-dropdown);
  z-index: 50;
  padding: 4px 0;
}
.interval-brush-dropdown-menu[aria-hidden="true"] {
  display: none !important;
}
.interval-brush-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  font-size: 0.9375rem;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  color: var(--text);
}
.interval-brush-option:hover,
.interval-brush-option:focus {
  background: rgba(var(--accent-rgb), 0.15);
  outline: none;
}
.interval-brush-option .swatch {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  flex-shrink: 0;
  border: 1px solid var(--swatch-edge);
}
.interval-editor-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
  margin-bottom: 12px;
  font-size: 0.8125rem;
  color: var(--text-muted);
}
.interval-editor-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.interval-editor-legend .swatch {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  flex-shrink: 0;
}
.swatch--quiet { background: #c53030; }
.swatch--accounted { background: #276749; }
.swatch--not-accounted { background: #2b6cb0; }
.interval-day-bars-wrap {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-bottom: 8px;
  position: relative;
  touch-action: pan-x pan-y pinch-zoom;
  user-select: none;
}
.interval-day-header-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}
.interval-day-header-spacer {
  flex-shrink: 0;
  width: 52px;
  padding-right: 6px;
  box-sizing: border-box;
}
.interval-day-header-cell {
  flex: 1;
  min-width: 0;
}
.interval-allowance-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}
.interval-allowance-label {
  flex-shrink: 0;
  width: 52px;
  padding-right: 6px;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  text-align: right;
  box-sizing: border-box;
}
.interval-allowance-row .interval-allowance-wrap {
  flex: 1;
  min-width: 0;
  margin-bottom: 0;
}
.interval-allowance-wrap {
  width: 100%;
  margin-bottom: 6px;
  flex-shrink: 0;
}
.interval-allowance-select {
  width: 100%;
  min-width: 0;
  min-height: 32px;
  padding: 2px 4px;
  font-size: 0.50rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  box-sizing: border-box;
}
.interval-allowance-select:focus {
  outline: none;
  border-color: var(--accent);
}
.interval-allowance-select:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.interval-bars-row {
  display: flex;
  flex-direction: row;
  gap: 6px;
  align-items: flex-start;
  position: relative;
}
.interval-time-axis {
  flex-shrink: 0;
  width: 52px;
  padding-top: 0px;
  padding-right: 6px;
  box-sizing: border-box;
  touch-action: pan-x pan-y pinch-zoom;
}
.interval-time-axis-inner {
  position: relative;
  height: 576px;
  text-align: right;
  touch-action: pan-x pan-y pinch-zoom;
}
.interval-time-label {
  position: absolute;
  right: 0;
  transform: translateY(-50%);
  font-size: 0.6875rem;
  color: var(--text-muted);
  white-space: nowrap;
  touch-action: pan-x pan-y pinch-zoom;
}
.interval-hour-lines {
  position: absolute;
  left: 58px;
  right: 0;
  top: 0px;
  height: 576px;
  pointer-events: none;
  touch-action: none;
  z-index: 1;
}
.interval-hour-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--interval-hour-line);
  transform: translateZ(0);
}
.interval-current-time-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: #805ad5;
  transform: translateY(-50%);
  z-index: 2;
  pointer-events: none;
}
.interval-day-column {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  min-width: 0;
  position: relative;
  z-index: 0;
  touch-action: none;
}
.interval-day-column .day-label,
.interval-day-header-row .day-label {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1;
  min-height: 36px;
  color: var(--text-muted);
  margin-bottom: 6px;
  flex-shrink: 0;
  box-sizing: border-box;
}
.interval-day-column .day-label.day-unlock-toggle,
.interval-day-header-row .day-label.day-unlock-toggle {
  display: flex;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--day-toggle-bg);
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 5px;
  width: 100%;
  min-width: 0;
  overflow: hidden;
}
.interval-day-column .day-label .day-name,
.interval-day-header-row .day-label .day-name {
  line-height: 1;
  display: inline-block;
}
.interval-day-column .day-label .day-name.badge,
.interval-day-header-row .day-label .day-name.badge {
  margin-left: 0;
  padding: 0;
  background: none;
  border-radius: 0;
  color: var(--success);
}
.interval-day-column .day-label.day-unlock-toggle.is-unlocked,
.interval-day-header-row .day-label.day-unlock-toggle.is-unlocked {
  border-color: var(--accent);
  color: var(--text);
  background: rgba(var(--accent-rgb), 0.2);
}
.interval-day-column .day-label.day-unlock-toggle.is-locked,
.interval-day-header-row .day-label.day-unlock-toggle.is-locked {
  opacity: 0.88;
}
.interval-day-column .day-label.day-unlock-toggle:focus,
.interval-day-header-row .day-label.day-unlock-toggle:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(var(--accent-rgb), 0.3);
}
.day-unlock-state {
  position: relative;
  width: 10px;
  height: 12px;
  opacity: 0.92;
  flex-shrink: 0;
  margin-top: 1px;
}
.day-unlock-state::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 0;
  width: 7px;
  height: 6px;
  border: 1.4px solid currentColor;
  border-bottom: none;
  border-radius: 6px 6px 0 0;
  transform: translateX(-50%);
}
.day-unlock-state::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 7px;
  border: 1.4px solid currentColor;
  border-radius: 2px;
}
.day-unlock-state.is-unlocked::before {
  left: calc(50% + 2px);
}
.interval-day-bar {
  width: 100%;
  height: 576px;
  display: flex;
  flex-direction: column;
  min-width: 0;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface);
  touch-action: none;
}
.interval-slot {
  flex: 1;
  min-height: 2px;
  cursor: pointer;
  transition: opacity 0.15s, filter 0.15s;
}
.interval-slot:hover {
  opacity: 0.9;
  filter: brightness(1.15);
}
.interval-slot:active {
  filter: brightness(1.3);
}
.interval-slot--quiet { background: #c53030; }
.interval-slot--accounted { background: #276749; }
.interval-slot--not-accounted { background: #2b6cb0; }
.interval-day-column--locked .interval-day-bar {
  opacity: 0.52;
  touch-action: pan-x pan-y pinch-zoom;
}
.interval-day-column--locked {
  touch-action: pan-x pan-y pinch-zoom;
}
.interval-day-column--locked .interval-slot {
  cursor: not-allowed;
}
.interval-editor-actions {
  margin-top: 16px;
  display: flex;
  gap: 10px;
  align-items: center;
}
.interval-editor-actions .error-msg { margin-top: 0; }

.interval-summary-wrap {
  margin-top: 20px;
  padding: 14px 16px;
  background: var(--summary-panel-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.interval-summary-label {
  display: block;
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.interval-summary {
  font-size: 0.9375rem;
  line-height: 1.5;
  color: var(--text-muted);
  white-space: pre-wrap;
  word-break: break-word;
}

/* Modal (e.g. Bonus Time on dashboard) */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: var(--modal-backdrop);
  cursor: pointer;
}
.modal-dialog {
  position: relative;
  width: 100%;
  max-width: 360px;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-modal);
}
.modal-dialog h3 {
  margin: 0 0 8px;
  font-size: 1.25rem;
}
.modal-desc {
  margin: 0 0 16px;
  font-size: 0.875rem;
  color: var(--text-muted);
}
.modal-dialog label {
  display: block;
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.modal-select {
  width: 100%;
  margin-bottom: 20px;
}
.modal-input {
  width: 100%;
  margin-bottom: 20px;
}
.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}
.modal-actions .btn {
  width: auto;
  min-width: 100px;
}

/* ---- Page boot & in-app navigation (MPA) -------------------------------- */

html.offliner-boot-pending {
  overflow: hidden;
}
html.offliner-boot-pending body {
  overflow: hidden;
  opacity: 0;
}

html.offliner-boot-pending::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 2147482647;
  background: var(--bg);
  pointer-events: none;
}

html.offliner-boot-pending::after {
  content: '';
  position: fixed;
  left: 50%;
  top: 50%;
  width: 40px;
  height: 40px;
  margin: -20px 0 0 -20px;
  z-index: 2147482648;
  border-radius: 50%;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  animation: offliner-boot-spin 0.65s linear infinite;
  pointer-events: none;
  box-sizing: border-box;
}

@keyframes offliner-boot-spin {
  to {
    transform: rotate(360deg);
  }
}

html.offliner-page-ready:not(.offliner-nav-leaving) body {
  opacity: 1;
  transition: opacity 0.32s ease-out;
}

html.offliner-nav-leaving body {
  opacity: 0;
  transition: opacity 0.2s ease-in;
}

@media (prefers-reduced-motion: reduce) {
  html.offliner-boot-pending::after {
    animation: none;
    border-top-color: var(--accent);
    opacity: 0.85;
  }
  html.offliner-page-ready:not(.offliner-nav-leaving) body,
  html.offliner-nav-leaving body {
    transition: none;
  }
}
