/* ==================== BASE & VARIABLES ==================== */
:root {
  --font-sans: "BIZ UDPGothic", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Meiryo", system-ui, -apple-system, sans-serif;
  --font-mono: "BIZ UDGothic", "Consolas", "SFMono-Regular", "Courier New", monospace;

  /* App Light Surface (Right Pane & Topbar) */
  --bg-app: #eef1f5;
  --bg-card: #ffffff;
  --bg-subtle: #f7f8fa;
  --border-light: #dce1e8;
  --border-strong: #c4ccd8;
  --text-main: var(--custom-planner-text, #1c2430);
  --text-muted: #5d6878;
  --text-faint: #8893a3;

  /* Status Colors (Planner) */
  --c-participate: #0f8a4b;
  --c-participate-bg: #e7f7ee;
  --c-participate-border: #9adab7;

  --c-unapplied: #052e16;
  --c-unapplied-bg: var(--custom-unapplied, #22c55e);
  --c-unapplied-border: color-mix(in srgb, var(--c-unapplied-bg) 72%, #111827);

  --c-general: #0284c7;
  --c-general-bg: #e0f2fe;
  --c-general-border: #7dd3fc;

  --c-staff: #6d28d9;
  --c-staff-bg: #ede9fe;
  --c-staff-border: #c4b5fd;

  --c-considering: #b86800;
  --c-considering-bg: #fff5e0;
  --c-considering-border: #f5ca7a;
  --c-considering-accent: #e08e0b;

  --c-absent: #5c6573;
  --c-absent-bg: #eef0f4;
  --c-absent-border: #cfd5df;
  --c-absent-accent: #8a94a6;

  --c-deadline: #c62839;
  --c-deadline-bg: #fdecee;
  --c-deadline-border: #f3aeb5;

  --c-primary: var(--custom-primary, #1d5bd6);
  --c-primary-hover: color-mix(in srgb, var(--c-primary) 82%, #000000);

  /* Station LED Board Colors (Left Pane) */
  --bezel-bg: #1e232a;
  --bezel-border: #38414e;
  --led-bg: var(--custom-led-bg, #080a0c);
  --led-grid: rgba(255, 255, 255, 0.035);
  --led-amber: var(--custom-led-amber, #ffb326);
  --led-green: #3eff84;
  --led-red: #ff5b64;
  --led-caution: #ff858c;
  --led-white: #e9eef5;
  --led-dim: #6f7a88;
}

/* JFLY (Okabe-Ito) Color Universal Design Mode */
body.cud-mode {
  --c-participate: #03af7a;
  --c-participate-bg: #d8f5ea;
  --c-participate-border: #03af7a;

  --c-unapplied: #111111;
  --c-unapplied-bg: var(--custom-unapplied, #fff100);
  --c-unapplied-border: #804000;

  --c-general: #005aff;
  --c-general-bg: #e0f5ff;
  --c-general-border: #4dc4ff;

  --c-staff: #990099;
  --c-staff-bg: #f7e6f7;
  --c-staff-border: #990099;

  --c-considering: #804000;
  --c-considering-bg: #fff3d6;
  --c-considering-border: #f6aa00;
  --c-considering-accent: #f6aa00;

  --c-absent: #4b5563;
  --c-absent-bg: #e5e7eb;
  --c-absent-border: #9ca3af;
  --c-absent-accent: #9ca3af;

  --c-deadline: #ff4b00;
  --c-deadline-bg: #ffe9df;
  --c-deadline-border: #ff4b00;

  --c-primary: var(--custom-primary, #005aff);
  --c-primary-hover: color-mix(in srgb, var(--c-primary) 82%, #000000);

  --led-amber: var(--custom-led-amber, #f6aa00);
  --led-green: #4dc4ff;
  --led-red: #ff4b00;
  --led-caution: #ff4b00;
}

body.cud-mode .cal-pill.st-absent,
body.cud-mode .schedule-card.st-absent {
  border-left-style: dashed;
}

body[data-font-scale="small"] .led-main-name {
  font-size: 12.5px;
}
body[data-font-scale="small"] .card-title {
  font-size: 13px;
}
body[data-font-scale="large"] .led-main-name {
  font-size: 16px;
}
body[data-font-scale="large"] .card-title {
  font-size: 15.5px;
}

*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: var(--font-sans);
  color: var(--text-main);
  background: var(--bg-app);
  -webkit-font-smoothing: antialiased;
}

.hidden {
  display: none !important;
}

/* ==================== LAYOUT SHELL ==================== */
.app-shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
  min-height: 620px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 18px;
  background: #141920;
  color: #f3f6fa;
  border-bottom: 2px solid #2b3440;
  flex-shrink: 0;
  flex-wrap: wrap;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-icon {
  font-size: 24px;
  line-height: 1;
}

.brand-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.version-badge {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: #ffb326;
  background: rgba(255, 179, 38, 0.14);
  border: 1px solid rgba(255, 179, 38, 0.45);
  border-radius: 999px;
  padding: 1px 8px;
  letter-spacing: 0.04em;
}

.topbar-mini-link {
  appearance: none;
  background: transparent;
  border: none;
  padding: 2px 5px;
  margin: 0;
  font-family: inherit;
  font-size: 11px;
  color: #a6b3c6;
  cursor: pointer;
  border-radius: 4px;
  text-decoration: none;
  transition: color 0.15s, background 0.15s;
}

.topbar-mini-link:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
  text-decoration: underline;
}

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

/* Top Center Info Progress Meter */
.topbar-info-meter {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 auto;
  flex-wrap: wrap;
}

body.hide-top-info-bar .topbar-info-meter {
  display: none;
}

.top-meter-item {
  width: 132px;
  background: var(--custom-top-meter-bg, #1c232d);
  border: 1px solid #323c4a;
  border-radius: 6px;
  padding: 4px 8px 5px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  color: #e6ecf5;
  font-family: var(--font-mono);
}

.top-meter-deadline {
  width: 168px;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s, background 0.15s;
}

.top-meter-deadline:hover {
  border-color: #63748c;
  background: #232c38;
}

.top-meter-deadline.has-deadline {
  border-color: rgba(255, 159, 26, 0.6);
}

.top-meter-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-size: 11px;
  line-height: 1.2;
}

.top-meter-label {
  color: #cbd5e1;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.top-meter-val {
  color: var(--custom-top-meter-val, #ffb326);
  font-weight: 700;
  flex-shrink: 0;
}

.top-meter-track {
  width: 100%;
  height: 5px;
  background: #0b0e12;
  border-radius: 999px;
  overflow: hidden;
}

.top-meter-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  transition: width 0.35s ease;
}

.fill-today {
  background: var(--custom-fill-today, #38bdf8);
}
.fill-month {
  background: var(--custom-fill-month, #3eff84);
}
.fill-deadline {
  background: var(--custom-fill-deadline, #ff9f1a);
}

body.cud-mode .fill-today {
  background: var(--custom-fill-today, #4dc4ff);
}
body.cud-mode .fill-month {
  background: var(--custom-fill-month, #03af7a);
}
body.cud-mode .fill-deadline {
  background: var(--custom-fill-deadline, #ff4b00);
}

/* App Body & Left Collapsible Settings Drawer */
.app-body {
  flex: 1;
  min-height: 0;
  display: flex;
}

.settings-drawer {
  width: 192px;
  flex-shrink: 0;
  background: #1b212a;
  color: #e6ecf5;
  border-left: 1px solid #2e3744;
  display: flex;
  flex-direction: column;
  transition: width 0.18s ease;
  overflow: hidden;
}

.settings-drawer.is-collapsed {
  width: 44px;
}

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  background: #141920;
  border-bottom: 1px solid #2b3440;
  min-height: 38px;
}

.drawer-title {
  font-size: 12px;
  font-weight: 700;
  color: #9ba7b8;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.settings-drawer.is-collapsed .drawer-title {
  display: none;
}

.drawer-toggle-btn {
  width: 24px;
  height: 24px;
  border: 1px solid #3c4654;
  border-radius: 5px;
  background: #252c37;
  color: #eef2f7;
  font-size: 11px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-right: auto;
}
.drawer-toggle-btn:hover {
  background: #333c4a;
}

.drawer-collapsed-rail {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 10px 4px;
}

.settings-drawer.is-collapsed .drawer-collapsed-rail {
  display: flex;
}

.settings-drawer.is-collapsed .drawer-content {
  display: none;
}

.drawer-rail-btn {
  width: 32px;
  height: 32px;
  border: 1px solid #353f4d;
  border-radius: 6px;
  background: #252c37;
  color: #eef2f7;
  font-size: 15px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.drawer-rail-btn:hover {
  background: #333c4a;
}

.drawer-content {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 8px;
  gap: 10px;
  overflow-y: auto;
}

.drawer-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  background: #12161c;
  padding: 3px;
  border-radius: 7px;
  border: 1px solid #2b3440;
}

.drawer-tab {
  border: none;
  background: transparent;
  color: #9ba7b8;
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  padding: 6px 4px;
  border-radius: 5px;
  cursor: pointer;
  white-space: nowrap;
}

.drawer-tab.active {
  background: var(--c-primary);
  color: #fff;
}

.drawer-panel {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.drawer-btn {
  width: 100%;
  justify-content: flex-start;
  text-align: left;
  padding: 7px 10px;
}

.drawer-sep {
  border: none;
  border-top: 1px solid #2f3845;
  margin: 4px 0;
}

/* Main Split Workspace */
.workspace {
  --left-pane-pct: 46%;
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(320px, var(--left-pane-pct)) 10px minmax(340px, 1fr);
  gap: 0;
  padding: 12px;
}

.pane-resizer {
  position: relative;
  cursor: col-resize;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
  user-select: none;
}

.pane-resizer::before {
  content: "";
  width: 4px;
  height: 44px;
  border-radius: 999px;
  background: #c2cbd6;
  transition: background 0.15s, height 0.15s;
}

.pane-resizer:hover::before,
.pane-resizer:focus-visible::before,
.pane-resizer.is-dragging::before {
  background: var(--c-primary);
  height: 76px;
}

body.is-resizing-panes {
  cursor: col-resize;
  user-select: none;
}

.pane {
  min-height: 0;
  display: flex;
  flex-direction: column;
}

/* ==================== BUTTONS & INPUTS ==================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 7px 13px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.05s;
  white-space: nowrap;
}

.btn:active {
  transform: translateY(1px);
}

.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
}

.btn-xs {
  padding: 3px 8px;
  font-size: 11px;
}

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

.btn-accent-red {
  background: #c62839;
  color: #fff;
}
.btn-accent-red:hover {
  background: #a91f2d;
}

.btn-secondary {
  background: #28313e;
  color: #eef2f7;
  border-color: #3f4b5c;
}
.btn-secondary:hover {
  background: #343f4f;
}

/* Secondary inside light modals */
.modal-card .btn-secondary {
  background: #eef1f5;
  color: var(--text-main);
  border-color: var(--border-strong);
}
.modal-card .btn-secondary:hover {
  background: #e2e6ed;
}

.btn-ghost {
  background: transparent;
  color: inherit;
  border-color: rgba(140, 155, 175, 0.35);
}
.btn-ghost:hover {
  background: rgba(140, 155, 175, 0.15);
}

.btn-danger-ghost {
  background: transparent;
  color: #ff7b85;
  border-color: rgba(255, 123, 133, 0.35);
}
.btn-danger-ghost:hover {
  background: rgba(255, 90, 95, 0.15);
}

.modal-card .btn-danger-ghost {
  color: #c62839;
  border-color: #f3aeb5;
}
.modal-card .btn-danger-ghost:hover {
  background: #fdecee;
}

.btn-outline-accent {
  background: #fff8ea;
  color: #a65e00;
  border-color: #f2c66d;
}
.btn-outline-accent:hover {
  background: #ffefcc;
}

.btn-icon {
  width: 30px;
  height: 30px;
  border-radius: 6px;
  border: 1px solid var(--border-strong);
  background: var(--bg-card);
  color: var(--text-main);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
}
.btn-icon:hover {
  background: var(--bg-subtle);
}

.input-sm {
  padding: 5px 9px;
  font-size: 12px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  font-family: inherit;
  background: #fff;
  color: var(--text-main);
}

/* ==================== LEFT PANE: STATION DEPARTURE BOARD ==================== */
.station-bezel {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #252b34 0%, #1a1f26 100%);
  border: 3px solid #3c4654;
  border-radius: 12px;
  padding: 12px;
  box-shadow: 0 10px 28px rgba(10, 14, 20, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  color: #eef2f7;
}

.station-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  background: #12161b;
  border: 1px solid #353f4c;
  border-radius: 8px;
  margin-bottom: 10px;
}

.station-sign {
  display: flex;
  align-items: center;
  gap: 10px;
}

.station-title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: #f4f7fb;
  letter-spacing: 0.04em;
}

.station-clock-box {
  text-align: right;
  font-family: var(--font-mono);
  background: #06080a;
  border: 1px solid #2c3540;
  padding: 4px 10px;
  border-radius: 6px;
}

.live-date {
  font-size: 11px;
  color: var(--led-amber);
  letter-spacing: 0.05em;
}

.live-clock {
  font-size: 16px;
  font-weight: 700;
  color: var(--led-green);
  text-shadow: 0 0 8px rgba(62, 255, 132, 0.35);
  letter-spacing: 0.08em;
}

/* LED Marquee Scroll Bar */
.led-marquee-bar {
  --marquee-duration: 16s;
  background-color: #06080a;
  background-image: radial-gradient(var(--led-grid) 1px, transparent 0);
  background-size: 4px 4px;
  border: 1px solid #2b3440;
  border-radius: 6px;
  padding: 5px 0;
  margin-bottom: 8px;
  overflow: hidden;
  font-family: var(--font-mono);
  box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.85);
}

.led-marquee-track {
  display: inline-block;
  white-space: nowrap;
  padding-left: 100%;
  animation: ledMarquee var(--marquee-duration) linear infinite;
}

.led-marquee-bar:hover .led-marquee-track {
  animation-play-state: paused;
}

.led-marquee-text {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-shadow: 0 0 7px currentColor;
}

@keyframes ledMarquee {
  0% { transform: translateX(0); }
  100% { transform: translateX(-100%); }
}

/* Board Controls */
.board-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 6px 8px;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid #303945;
  border-radius: 7px;
  margin-bottom: 10px;
}

.board-filter-group {
  display: flex;
  align-items: center;
  gap: 5px;
}

.board-control-label {
  font-size: 11px;
  color: #9ba7b8;
  white-space: nowrap;
}

.board-select {
  background: #101419;
  color: #f1f5f9;
  border: 1px solid #404b5a;
  border-radius: 5px;
  padding: 4px 7px;
  font-size: 12px;
  font-family: inherit;
}

.board-toggle-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 10px;
}

.board-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11.5px;
  color: #c5cedb;
  cursor: pointer;
}

/* LED Matrix Screen */
.led-screen {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background-color: var(--led-bg);
  background-image:
    radial-gradient(var(--led-grid) 1px, transparent 0);
  background-size: 4px 4px;
  border: 2px solid #040506;
  box-shadow: inset 0 0 18px rgba(0, 0, 0, 0.9), 0 1px 0 rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  overflow: hidden;
  font-family: var(--font-mono);
}

.led-table-head {
  display: grid;
  grid-template-columns: 88px 110px minmax(0, 1fr) 106px;
  gap: 8px;
  padding: 8px 12px;
  background: #13171d;
  border-bottom: 2px solid #2b333f;
  font-size: 11px;
  font-weight: 700;
  color: #9ba7b5;
  letter-spacing: 0.04em;
}

.led-table-head .col-days {
  text-align: center;
}

.led-table-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 4px 0;
}

/* Custom Dark Scrollbar for LED Board */
.led-table-body::-webkit-scrollbar {
  width: 8px;
}
.led-table-body::-webkit-scrollbar-track {
  background: #0b0e12;
}
.led-table-body::-webkit-scrollbar-thumb {
  background: #2f3845;
  border-radius: 4px;
}

.led-row {
  display: grid;
  grid-template-columns: 88px 110px minmax(0, 1fr) 106px;
  gap: 8px;
  align-items: center;
  padding: 9px 12px;
  border-bottom: 1px dashed #222933;
  cursor: pointer;
  transition: background 0.12s;
}

.led-row:hover {
  background: rgba(255, 179, 38, 0.08);
}

.led-row.is-past {
  opacity: 0.56;
}

.led-row.is-today {
  background: rgba(255, 91, 100, 0.11);
  border-left: 3px solid var(--led-red);
  padding-left: 9px;
}

.led-type-col {
  display: flex;
  flex-direction: column;
  gap: 3px;
  align-items: flex-start;
}

.led-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 3px;
  line-height: 1.25;
  letter-spacing: 0.04em;
  border: 1px solid currentColor;
}

.led-badge-event {
  color: var(--led-amber);
  background: rgba(255, 179, 38, 0.12);
}

.led-badge-deadline {
  color: var(--led-red);
  background: rgba(255, 91, 100, 0.14);
  text-shadow: 0 0 6px rgba(255, 91, 100, 0.4);
}

.led-sub-status {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.led-st-participate {
  color: var(--custom-led-participate, #ffffff);
  text-shadow: 0 0 6px rgba(255, 255, 255, 0.3);
}
.led-st-unapplied {
  background: var(--c-unapplied-bg);
  color: var(--c-unapplied);
  padding: 1px 4px;
  border-radius: 3px;
  font-weight: 800;
}
.led-st-general,
.led-st-staff {
  color: var(--custom-led-green, var(--led-green));
  text-shadow: 0 0 6px rgba(62, 255, 132, 0.35);
}
.led-st-considering {
  color: var(--led-amber);
}
.led-st-absent {
  color: var(--led-dim);
}
.led-st-done {
  color: #5eead4;
}
.led-st-caution {
  color: var(--led-caution);
}

.led-date-col {
  font-size: 13px;
  font-weight: 700;
  color: var(--led-amber);
  text-shadow: 0 0 6px rgba(255, 179, 38, 0.25);
  line-height: 1.3;
}

.led-date-sub {
  display: block;
  font-size: 10.5px;
  color: #9da8b8;
  font-weight: 400;
  text-shadow: none;
}

.led-name-col {
  min-width: 0;
}

.led-name-row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.led-genre-tag {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 700;
  color: #0b1118;
  background: #ffd166;
  border-radius: 3px;
  padding: 1px 6px;
  line-height: 1.3;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.led-main-name {
  appearance: none;
  background: transparent;
  border: none;
  padding: 0;
  margin: 0;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  color: var(--led-white);
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.led-main-name:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.led-row.kind-event.st-participate .led-main-name {
  color: var(--custom-led-participate, #ffffff);
  text-shadow: 0 0 7px rgba(255, 255, 255, 0.25);
}

.led-row.kind-event.st-unapplied .led-main-name {
  background: var(--c-unapplied-bg);
  color: var(--c-unapplied);
  padding: 1px 7px;
  border-radius: 4px;
  font-weight: 800;
  text-shadow: none;
}

.led-row.kind-event.st-general .led-main-name,
.led-row.kind-event.st-staff .led-main-name {
  color: var(--custom-led-green, var(--led-green));
  text-shadow: 0 0 7px rgba(62, 255, 132, 0.28);
}

.led-row.kind-event.st-considering .led-main-name {
  color: var(--led-amber);
  text-shadow: 0 0 7px rgba(255, 179, 38, 0.24);
}

.led-row.kind-event.st-absent .led-main-name {
  color: var(--led-dim);
  text-decoration: line-through;
}

.led-row.kind-deadline .led-main-name {
  color: var(--custom-led-deadline, var(--led-green));
  text-shadow: 0 0 7px rgba(62, 255, 132, 0.28);
}

.led-row.kind-deadline.is-done .led-main-name {
  color: #7e8b99;
  text-decoration: line-through;
  text-shadow: none;
}

.led-meta-line {
  margin-top: 2px;
  font-size: 11px;
  color: #9ba7b8;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.led-days-col {
  text-align: center;
  font-size: 13.5px;
  font-weight: 700;
  white-space: nowrap;
}

.led-days-value {
  display: inline-block;
  line-height: 1.2;
}

.days-today {
  background: var(--custom-led-urgent-bg, #ff9f1a);
  color: #111111;
  font-size: 17px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 4px;
  box-shadow: 0 0 10px rgba(255, 159, 26, 0.55);
  text-shadow: none;
}

body.blink-near-deadline .led-row.is-near-deadline .led-main-name,
body.blink-near-deadline .led-row.is-near-deadline .led-badge-deadline {
  animation: ledPulse var(--blink-cycle, 2s) ease-in-out infinite;
}

body.blink-few-days .led-days-value.is-few-days {
  animation: ledPulse var(--blink-cycle, 2s) ease-in-out infinite;
}

.days-urgent {
  background: var(--custom-led-urgent-bg, #ff9f1a);
  color: #111111;
  font-size: 16px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 4px;
  box-shadow: 0 0 8px rgba(255, 159, 26, 0.45);
  text-shadow: none;
}

.days-soon {
  color: var(--led-amber);
  font-size: 14.5px;
  text-shadow: 0 0 6px rgba(255, 179, 38, 0.35);
}

.days-normal {
  color: var(--led-green);
}

.days-past {
  color: var(--led-dim);
  font-size: 12px;
}

@keyframes ledPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}

.led-empty {
  padding: 40px 20px;
  text-align: center;
  color: #8894a3;
  font-size: 13px;
  line-height: 1.7;
}

.led-footer-ticker {
  padding: 7px 12px;
  background: #10141a;
  border-top: 1px solid #27303c;
  font-size: 11.5px;
  color: var(--led-amber);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ==================== RIGHT PANE: SCHEDULE PLANNER ==================== */
.pane-right {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(20, 30, 45, 0.06);
  overflow: hidden;
}

.planner-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border-light);
  flex-wrap: wrap;
}

.year-nav {
  display: flex;
  align-items: center;
  gap: 6px;
}

.year-select {
  font-family: inherit;
  font-size: 17px;
  font-weight: 800;
  color: var(--text-main);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  padding: 3px 10px;
  background: #fff;
  cursor: pointer;
}

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

/* Year Stats Bar */
.year-stats-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  border-bottom: 1px solid var(--border-light);
  background: #fcfcfd;
  flex-wrap: wrap;
  font-size: 12px;
}

.stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 9px;
  border-radius: 999px;
  font-weight: 700;
  border: 1px solid transparent;
}

.stat-participate {
  background: var(--c-participate-bg);
  color: var(--c-participate);
  border-color: var(--c-participate-border);
}
.stat-unapplied {
  background: var(--c-unapplied-bg);
  color: var(--c-unapplied);
  border-color: var(--c-unapplied-border);
}
.stat-general {
  background: var(--c-general-bg);
  color: var(--c-general);
  border-color: var(--c-general-border);
}
.stat-staff {
  background: var(--c-staff-bg);
  color: var(--c-staff);
  border-color: var(--c-staff-border);
}
.stat-considering {
  background: var(--c-considering-bg);
  color: var(--c-considering);
  border-color: var(--c-considering-border);
}
.stat-absent {
  background: var(--c-absent-bg);
  color: var(--c-absent);
  border-color: var(--c-absent-border);
}
.stat-deadline {
  background: var(--c-deadline-bg);
  color: var(--c-deadline);
  border-color: var(--c-deadline-border);
}
.stat-conflict {
  background: #fff3cd;
  color: #9c5700;
  border-color: #f3c46b;
  cursor: pointer;
}
.stat-conflict:hover {
  background: #ffe9a8;
}

/* Month Tabs & View Switch */
.planner-subbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--border-light);
  background: #fff;
  flex-wrap: wrap;
}

.month-tabs {
  display: flex;
  align-items: center;
  gap: 3px;
  flex-wrap: wrap;
}

.month-tab {
  position: relative;
  border: 1px solid var(--border-light);
  background: var(--bg-subtle);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 5px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.month-tab:hover {
  background: #e9edf3;
  color: var(--text-main);
}

.month-tab.active {
  background: var(--c-primary);
  color: #fff;
  border-color: var(--c-primary);
}

.month-tab .m-count {
  font-size: 10px;
  opacity: 0.85;
}

.month-tab .m-conflict-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #f59e0b;
  display: inline-block;
}

.view-mode-switch {
  display: inline-flex;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  overflow: hidden;
}

.view-tab {
  border: none;
  background: #fff;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 10px;
  cursor: pointer;
}

.view-tab.active {
  background: #1c2430;
  color: #fff;
}

/* Planner Scrollable Body */
.planner-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 10px 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.calendar-split-body {
  --cal-top-pct: 58%;
  overflow: hidden;
  gap: 0;
  padding: 10px 14px 12px;
}

.calendar-top-pane {
  flex: 0 0 var(--cal-top-pct);
  min-height: 140px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-right: 2px;
}

.calendar-resizer {
  flex: 0 0 10px;
  cursor: row-resize;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
  user-select: none;
  margin: 2px 0;
}

.calendar-resizer::before {
  content: "";
  width: 56px;
  height: 4px;
  border-radius: 999px;
  background: #c2cbd6;
  transition: background 0.15s, width 0.15s;
}

.calendar-resizer:hover::before,
.calendar-resizer:focus-visible::before,
.calendar-resizer.is-dragging::before {
  background: var(--c-primary);
  width: 96px;
}

body.is-resizing-cal {
  cursor: row-resize;
  user-select: none;
}

/* Calendar */
.calendar-legend {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 11.5px;
  color: var(--text-muted);
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.dot-participate { background: var(--c-participate); }
.dot-unapplied { background: var(--c-unapplied-bg); border: 1px solid var(--c-unapplied-border); }
.dot-general { background: var(--c-general); }
.dot-staff { background: var(--c-staff); }
.dot-considering { background: var(--c-considering-accent); }
.dot-absent { background: var(--c-absent-accent); }
.dot-deadline { background: var(--c-deadline); }

.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  text-align: center;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-muted);
}

.wk-sun { color: #c62839; }
.wk-sat { color: var(--c-primary); }

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
}

.cal-cell {
  min-height: 82px;
  background: #fff;
  border: 1px solid var(--border-light);
  border-radius: 7px;
  padding: 4px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  cursor: pointer;
  transition: border-color 0.12s, box-shadow 0.12s;
  position: relative;
}

.cal-cell:hover {
  border-color: color-mix(in srgb, var(--c-primary) 55%, #ffffff);
}

.cal-cell.is-other-month {
  background: #f5f7fa;
  opacity: 0.45;
}

.cal-cell.is-today {
  border-color: var(--c-primary);
  background: color-mix(in srgb, var(--c-primary) 5%, #ffffff);
}

.cal-cell.has-overlap {
  background: #fffcf3;
  border-color: #eab308;
}

.cal-cell.is-selected {
  border: 2px solid var(--c-primary);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--c-primary) 18%, transparent);
}

.cal-cell-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2px;
}

.cal-day-num {
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
}
.cal-cell.is-sun .cal-day-num { color: #c62839; }
.cal-cell.is-sat .cal-day-num { color: var(--c-primary); }

.cal-overlap-badge {
  font-size: 9.5px;
  font-weight: 800;
  background: #fef08a;
  color: #854d0e;
  border: 1px solid #eab308;
  border-radius: 4px;
  padding: 0 4px;
  line-height: 1.3;
}

.cal-quick-add {
  opacity: 0;
  border: none;
  background: color-mix(in srgb, var(--c-primary) 12%, #ffffff);
  color: var(--c-primary);
  width: 17px;
  height: 17px;
  border-radius: 4px;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.cal-cell:hover .cal-quick-add {
  opacity: 1;
}

.cal-items {
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
}

.cal-pill {
  font-size: 10.5px;
  font-weight: 600;
  padding: 1px 4px;
  border-radius: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border-left: 3px solid transparent;
}

.cal-pill.st-participate {
  background: var(--c-participate-bg);
  color: var(--c-participate);
  border-left-color: var(--c-participate);
}

.cal-pill.st-unapplied {
  background: var(--c-unapplied-bg);
  color: var(--c-unapplied);
  border-left-color: var(--c-unapplied-border);
}

.cal-pill.st-general {
  background: var(--c-general-bg);
  color: var(--c-general);
  border-left-color: var(--c-general);
}

.cal-pill.st-staff {
  background: var(--c-staff-bg);
  color: var(--c-staff);
  border-left-color: var(--c-staff);
}

.cal-pill.st-considering {
  background: var(--c-considering-bg);
  color: var(--c-considering);
  border-left-color: var(--c-considering-accent);
}

.cal-pill.st-absent {
  background: var(--c-absent-bg);
  color: var(--c-absent);
  border-left-color: var(--c-absent-accent);
  text-decoration: line-through;
}

.cal-pill.kind-deadline {
  background: var(--c-deadline-bg);
  color: var(--c-deadline);
  border-left-color: var(--c-deadline);
}

.cal-pill.kind-deadline.is-done {
  background: #eef2f6;
  color: #64748b;
  border-left-color: #94a3b8;
  text-decoration: line-through;
}

/* Selected Day Panel & Conflict Comparison */
.selected-day-panel {
  flex: 1;
  min-height: 110px;
  overflow-y: auto;
  border: 1px solid var(--border-light);
  border-radius: 9px;
  background: var(--bg-subtle);
  padding: 12px;
}

.day-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.day-panel-title {
  margin: 0;
  font-size: 15px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 8px;
}

.day-panel-actions {
  display: flex;
  gap: 6px;
}

.overlap-alert-banner {
  background: #fff7db;
  border: 1px solid #f0c24b;
  color: #8a4f00;
  border-radius: 6px;
  padding: 7px 11px;
  font-size: 12.5px;
  font-weight: 700;
  margin-bottom: 10px;
}

.cards-compare-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 10px;
}

.schedule-card {
  background: #fff;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 10px 11px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  border-top: 3px solid transparent;
}

.schedule-card.st-participate { border-top-color: var(--c-participate); }
.schedule-card.st-unapplied { border-top-color: var(--c-unapplied-border); }
.schedule-card.st-general { border-top-color: var(--c-general); }
.schedule-card.st-staff { border-top-color: var(--c-staff); }
.schedule-card.st-considering { border-top-color: var(--c-considering-accent); }
.schedule-card.st-absent { border-top-color: var(--c-absent-accent); opacity: 0.82; }
.schedule-card.kind-deadline { border-top-color: var(--c-deadline); }
.schedule-card.kind-deadline.is-done { border-top-color: #94a3b8; opacity: 0.78; }

.card-top-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 6px;
}

.card-kind-tag {
  font-size: 10.5px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 4px;
}

.tag-event {
  background: color-mix(in srgb, var(--c-primary) 10%, #ffffff);
  color: var(--c-primary);
}
.tag-deadline {
  background: var(--c-deadline-bg);
  color: var(--c-deadline);
}

.card-title {
  margin: 0;
  font-size: 14px;
  font-weight: 800;
  color: var(--text-main);
  word-break: break-word;
}

.card-meta {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.card-memo {
  font-size: 11.5px;
  color: #495464;
  background: #f8f9fb;
  border-radius: 5px;
  padding: 5px 7px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* 1-Click Status Switcher on Card */
.card-status-switcher {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.status-switch-btn {
  flex: 1 1 56px;
  border: 1px solid var(--border-strong);
  background: #fff;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 4px;
  border-radius: 5px;
  cursor: pointer;
  white-space: nowrap;
}

.status-switch-btn.active[data-status="participate"] {
  background: var(--c-participate);
  border-color: var(--c-participate);
  color: #fff;
}
.status-switch-btn.active[data-status="unapplied"] {
  background: var(--c-unapplied-bg);
  border-color: var(--c-unapplied-border);
  color: var(--c-unapplied);
}
.status-switch-btn.active[data-status="general"] {
  background: var(--c-general);
  border-color: var(--c-general);
  color: #fff;
}
.status-switch-btn.active[data-status="staff"] {
  background: var(--c-staff);
  border-color: var(--c-staff);
  color: #fff;
}
.status-switch-btn.active[data-status="considering"] {
  background: var(--c-considering-accent);
  border-color: var(--c-considering-accent);
  color: #fff;
}
body.cud-mode .status-switch-btn.active[data-status="considering"] {
  color: #111111;
}
.status-switch-btn.active[data-status="absent"] {
  background: var(--c-absent);
  border-color: var(--c-absent);
  color: #fff;
}

.card-footer-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  margin-top: auto;
  padding-top: 4px;
  border-top: 1px solid #eef1f5;
}

.day-empty-box {
  text-align: center;
  padding: 18px;
  color: var(--text-muted);
  font-size: 12.5px;
}

/* ==================== DAY-BY-DAY LIST VIEW ==================== */
.list-filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 8px 10px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: 8px;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 700;
  color: #9c5700;
  background: #fff7db;
  border: 1px solid #f0c24b;
  padding: 4px 9px;
  border-radius: 999px;
  cursor: pointer;
}

.list-search {
  flex: 1;
  min-width: 170px;
}

.day-list-content {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.day-group-block {
  border: 1px solid var(--border-light);
  border-radius: 9px;
  background: #fff;
  overflow: hidden;
}

.day-group-block.has-overlap {
  border-color: #eab308;
}

.day-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border-light);
}

.day-group-block.has-overlap .day-group-head {
  background: #fff8df;
}

.day-group-date {
  font-size: 13.5px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 8px;
}

.day-group-body {
  padding: 10px;
}

/* ==================== NATIVE TOP-LAYER DIALOGS ==================== */
dialog.modal-dialog {
  padding: 0;
  border: none;
  background: transparent;
  width: min(540px, calc(100vw - 32px));
  max-width: none;
  max-height: 92vh;
  margin: auto;
  overflow: visible;
  opacity: 0;
  transform: translateY(8px) scale(0.985);
  transition: opacity 0.16s ease, transform 0.16s ease, overlay 0.16s allow-discrete, display 0.16s allow-discrete;
}

dialog.modal-dialog[open] {
  opacity: 1;
  transform: translateY(0) scale(1);
}

@starting-style {
  dialog.modal-dialog[open] {
    opacity: 0;
    transform: translateY(8px) scale(0.985);
  }
}

dialog.modal-dialog::backdrop {
  background: rgba(12, 18, 28, 0.56);
  backdrop-filter: blur(2px);
}

dialog.modal-dialog-lg {
  width: min(880px, calc(100vw - 32px));
}

dialog.modal-dialog-xl {
  width: min(960px, calc(100vw - 32px));
}

.modal-card {
  width: 100%;
  max-height: 92vh;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  overscroll-behavior: contain;
}

.modal-card-lg,
.modal-card-xl {
  max-width: none;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 18px;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border-light);
  flex-shrink: 0;
}

.modal-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
}

.modal-close {
  border: none;
  background: transparent;
  font-size: 18px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
}
.modal-close:hover {
  background: #e2e6ed;
}

.modal-mode-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 10px 18px 0;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border-light);
  flex-shrink: 0;
}

.modal-mode-tab {
  border: 1px solid var(--border-light);
  border-bottom: none;
  border-radius: 7px 7px 0 0;
  background: #e9edf3;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  padding: 8px 10px;
  cursor: pointer;
}

.modal-mode-tab.active {
  background: #fff;
  color: var(--text-main);
  border-color: var(--border-strong);
  position: relative;
  top: 1px;
}

.modal-form {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.modal-body {
  flex: 1;
  min-height: 0;
  padding: 16px 18px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 13px;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 18px;
  border-top: 1px solid var(--border-light);
  background: var(--bg-subtle);
  flex-shrink: 0;
}

.modal-footer-right {
  margin-left: auto;
  display: flex;
  gap: 8px;
}

.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.form-group label {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-main);
}

.req {
  color: #c62839;
}

.form-group input[type="text"],
.form-group input[type="date"],
.form-group input[type="number"],
.form-group input[type="datetime-local"],
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  font-family: inherit;
  font-size: 13.5px;
  color: var(--text-main);
  background: #fff;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: 2px solid color-mix(in srgb, var(--c-primary) 25%, transparent);
  border-color: var(--c-primary);
}

.label-with-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

/* Preset Chips inside Event Form */
.preset-chips-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 2px;
}

.chip-btn {
  border: 1px solid #d1d8e3;
  background: #f5f7fa;
  color: #2f3b4c;
  border-radius: 999px;
  padding: 3px 9px;
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
}
.chip-btn:hover {
  background: #e5ecf9;
  border-color: #93b0e8;
  color: #1543a1;
}

.preset-empty-hint {
  font-size: 11px;
  color: var(--text-faint);
}

.quick-fill-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 2px;
}

.quick-fill-label {
  font-size: 11px;
  color: var(--text-muted);
}

.checkbox-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--text-muted);
  cursor: pointer;
}

/* Preset Manager Modal */
.help-text {
  margin: 0;
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.5;
}

.presets-columns {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.preset-panel {
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 12px;
  background: var(--bg-subtle);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.preset-panel h4 {
  margin: 0;
  font-size: 14px;
}

.preset-add-form {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.preset-add-form input {
  padding: 6px 9px;
  border: 1px solid var(--border-strong);
  border-radius: 5px;
  font-family: inherit;
  font-size: 12.5px;
  background: #fff;
}

.preset-manage-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 250px;
  overflow-y: auto;
}

.preset-manage-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: #fff;
  border: 1px solid var(--border-light);
  border-radius: 6px;
  padding: 6px 9px;
  font-size: 12.5px;
}

.preset-item-sub {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
}

/* PDF Modal & Simple Table Style */
.pdf-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 12px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: 8px;
}

.pdf-option {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 700;
}

.pdf-toolbar-actions {
  margin-left: auto;
  display: flex;
  gap: 8px;
}

.pdf-preview-wrapper {
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: #fff;
  padding: 20px;
  max-height: 55vh;
  overflow-y: auto;
}

.pdf-doc-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  border-bottom: 2px solid #222;
  padding-bottom: 8px;
  margin-bottom: 12px;
}

.pdf-doc-title {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
  color: #111;
}

.pdf-doc-meta {
  font-size: 11.5px;
  color: #444;
  text-align: right;
}

.pdf-summary-line {
  font-size: 12px;
  color: #222;
  margin-bottom: 10px;
  padding: 6px 10px;
  background: #f5f6f8;
  border: 1px solid #d5d9e0;
}

.pdf-log-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  color: #111;
}

.pdf-log-table th,
.pdf-log-table td {
  border: 1px solid #555;
  padding: 6px 8px;
  text-align: left;
  vertical-align: top;
}

.pdf-log-table th {
  background: #eceff3;
  font-weight: 700;
  white-space: nowrap;
}

.pdf-log-table .col-num {
  text-align: center;
  width: 34px;
}

.import-summary-box {
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 12px;
  font-size: 13px;
  line-height: 1.7;
}

/* Toast */
.toast {
  position: fixed;
  inset: auto 20px 20px auto;
  margin: 0;
  background: #141920;
  color: #f8fafc;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
  border: 1px solid #354050;
  z-index: 2000;
}

/* ==================== PRINT STYLES (PDF OUTPUT) ==================== */
.print-only {
  display: none;
}

@media print {
  @page {
    size: A4 portrait;
    margin: 14mm 12mm;
  }

  body {
    background: #fff !important;
    color: #000 !important;
  }

  .no-print,
  dialog.modal-dialog,
  .toast {
    display: none !important;
  }

  .print-only {
    display: block !important;
  }

  .pdf-log-table thead {
    display: table-header-group;
  }

  .pdf-log-table tr {
    page-break-inside: avoid;
    break-inside: avoid;
  }
}

/* ==================== UI SETTINGS & CUD PANEL ==================== */
.cud-panel {
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 12px;
  background: var(--bg-subtle);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cud-toggle-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  font-size: 13.5px;
}

.cud-toggle-row input[type="checkbox"] {
  margin-top: 3px;
  width: 17px;
  height: 17px;
  flex-shrink: 0;
}

.cud-palette-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.cud-swatch {
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  border: 1px solid rgba(0, 0, 0, 0.18);
  font-family: var(--font-mono);
}

.blink-panel {
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 12px;
  background: var(--bg-subtle);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.blink-panel h4 {
  margin: 0;
  font-size: 13.5px;
}

.blink-speed-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 12.5px;
  font-weight: 700;
  margin-top: 2px;
}

.blink-speed-row input[type="range"] {
  flex: 1;
  min-width: 140px;
}

.blink-speed-label {
  font-family: var(--font-mono);
  font-size: 12px;
  background: #fff;
  border: 1px solid var(--border-strong);
  border-radius: 5px;
  padding: 2px 8px;
}

.ui-color-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.ui-color-section {
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 12px;
  background: var(--bg-subtle);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ui-color-section h4 {
  margin: 0 0 2px;
  font-size: 13.5px;
}

.ui-color-section-wide {
  grid-column: 1 / -1;
}

.ui-color-subgrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px;
}

.color-picker-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12.5px;
  background: #fff;
  border: 1px solid var(--border-light);
  border-radius: 6px;
  padding: 5px 9px;
}

.color-picker-row input[type="color"] {
  width: 34px;
  height: 24px;
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  padding: 0;
  background: none;
  cursor: pointer;
}

.about-list {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.about-row {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 10px;
  align-items: center;
  padding: 7px 10px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: 6px;
  font-size: 13px;
}

.about-row dt {
  font-weight: 700;
  color: var(--text-muted);
}

.about-row dd {
  margin: 0;
  color: var(--text-main);
}

/* ==================== HELP DIALOG ==================== */
.help-toc-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 8px 18px;
  background: #f1f4f9;
  border-bottom: 1px solid var(--border-light);
  flex-shrink: 0;
}

.help-toc-label {
  font-size: 11.5px;
  font-weight: 800;
  color: var(--text-muted);
}

.help-toc-links {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.help-toc-btn {
  border: 1px solid var(--border-strong);
  background: #fff;
  color: var(--text-main);
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  cursor: pointer;
}

.help-toc-btn:hover {
  background: #e6eefc;
  border-color: var(--c-primary);
  color: var(--c-primary);
}

.help-modal-body {
  gap: 20px;
  padding: 18px 22px;
}

.help-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  scroll-margin-top: 10px;
}

.help-section-title {
  margin: 0;
  font-size: 15px;
  font-weight: 800;
  padding-bottom: 5px;
  border-bottom: 2px solid var(--border-light);
}

.help-lead-box {
  background: #f5f8ff;
  border: 1px solid #c9dafc;
  border-radius: 8px;
  padding: 10px 13px;
  font-size: 13px;
  line-height: 1.65;
}

.help-lead-box p,
.help-lead-desc {
  margin: 0;
  font-size: 13px;
  color: var(--text-main);
}

.help-step-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.help-step-card {
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 11px 13px;
  background: var(--bg-subtle);
}

.help-step-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.help-step-badge {
  background: var(--c-primary);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 999px;
}

.help-step-title {
  margin: 0;
  font-size: 13.5px;
  font-weight: 800;
}

.help-step-card ul,
.help-plain-list {
  margin: 0;
  padding-left: 18px;
  font-size: 12.5px;
  line-height: 1.65;
  color: var(--text-main);
}

.help-tip-box {
  margin-top: 8px;
  display: flex;
  align-items: flex-start;
  gap: 7px;
  background: #fff8e6;
  border: 1px solid #f2ca6b;
  border-radius: 6px;
  padding: 7px 10px;
  font-size: 12px;
  line-height: 1.55;
}

.help-alert-box {
  background: #fff5f5;
  border: 1px solid #f3b3b8;
  border-radius: 8px;
  padding: 11px 13px;
  font-size: 12.5px;
  line-height: 1.65;
}

.help-alert-head {
  font-weight: 800;
  color: #b4232c;
  margin-bottom: 5px;
}

.help-alert-box p {
  margin: 4px 0;
}

.help-faq-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.help-faq-item {
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 9px 12px;
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 12.5px;
  line-height: 1.55;
}

.help-faq-q,
.help-faq-a {
  display: flex;
  align-items: flex-start;
  gap: 7px;
}

.help-faq-q {
  font-weight: 700;
}

.faq-badge {
  flex-shrink: 0;
  width: 19px;
  height: 19px;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
}

.faq-badge.q { background: var(--c-primary); }
.faq-badge.a { background: #0f8a4b; }

.help-terms-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.help-terms-card {
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 10px 12px;
  background: var(--bg-subtle);
}

.help-terms-card h5 {
  margin: 0 0 4px;
  font-size: 13px;
}

.help-terms-card p {
  margin: 0;
  font-size: 12px;
  line-height: 1.55;
  color: var(--text-muted);
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 1060px) {
  .app-shell {
    height: auto;
    min-height: 100vh;
  }
  .workspace {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .pane-resizer,
  .calendar-resizer {
    display: none;
  }
  .calendar-split-body {
    overflow-y: auto;
    gap: 10px;
  }
  .calendar-top-pane,
  .selected-day-panel {
    flex: none;
    overflow: visible;
  }
  .led-screen {
    min-height: 380px;
    max-height: 520px;
  }
}

@media (max-width: 640px) {
  .form-row-2,
  .presets-columns,
  .ui-color-grid,
  .help-terms-grid {
    grid-template-columns: 1fr;
  }
  .led-table-head,
  .led-row {
    grid-template-columns: 74px 92px minmax(0, 1fr) 68px;
    font-size: 11px;
  }
}
