:root {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #102033;
  background: #eef2f7;
  font-synthesis: none;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: linear-gradient(180deg, #f8fafc 0%, #e9eff6 100%); }
button, input, select { font: inherit; }
button { cursor: pointer; }

.app-shell { width: min(1440px, calc(100% - 32px)); margin: 24px auto 60px; }
.hero {
  display: flex; justify-content: space-between; gap: 24px; align-items: flex-start;
  background: #0f172a; color: white; padding: 28px 30px; border-radius: 22px;
  box-shadow: 0 16px 42px rgba(15, 23, 42, .16);
}
.hero h1 { margin: 3px 0 5px; font-size: clamp(28px, 5vw, 44px); letter-spacing: -.04em; }
.eyebrow { margin: 0; font-size: 12px; font-weight: 800; letter-spacing: .16em; color: #93c5fd; }
.app-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.version {
  font-size: 13px; font-weight: 800; line-height: 1; color: #0f172a;
  background: #f8fafc; padding: 7px 10px; border-radius: 9px;
}
.author {
  font-size: 12px; font-weight: 700; color: #cbd5e1;
  white-space: nowrap;
}

.view { display: none; }
.view.active { display: block; }
.mode-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-top: 24px; }
.mode-card {
  min-height: 150px; display: grid; grid-template-columns: auto 1fr auto; gap: 18px; align-items: center;
  width: 100%; border: 1px solid #dbe3ec; border-radius: 20px; padding: 24px; text-align: left;
  background: #fff; color: #102033; box-shadow: 0 8px 24px rgba(15, 23, 42, .07); transition: .18s ease;
}
.mode-card:not(.disabled):hover { transform: translateY(-2px); border-color: #93c5fd; box-shadow: 0 14px 30px rgba(15, 23, 42, .10); }
.mode-card strong { display: block; font-size: 23px; margin-bottom: 7px; }
.mode-icon { width: 55px; height: 55px; border-radius: 16px; display: grid; place-items: center; background: #eaf3ff; color: #2563eb; font-size: 28px; font-weight: 900; }
.arrow { font-size: 28px; color: #2563eb; }
.badge { padding: 7px 10px; border-radius: 999px; background: #f1f5f9; color: #64748b; font-size: 12px; font-weight: 800; }
.mode-card.disabled { cursor: default; opacity: .72; }

.toolbar { display: flex; align-items: center; gap: 20px; margin: 24px 0 14px; }
.toolbar-title h2 { margin: 0; font-size: 26px; }
.toolbar-title p { margin: 4px 0 0; color: #64748b; }
.ghost-btn, .secondary-btn, .primary-btn {
  border: 0; border-radius: 11px; padding: 11px 15px; font-weight: 750;
}
.ghost-btn { background: #fff; color: #334155; border: 1px solid #dbe3ec; }
.secondary-btn { background: #e2e8f0; color: #1e293b; }
.primary-btn { background: #2563eb; color: white; box-shadow: 0 8px 18px rgba(37, 99, 235, .18); }
.primary-btn:hover { background: #1d4ed8; }

.panel { background: white; border: 1px solid #dbe3ec; border-radius: 18px; padding: 20px; margin-top: 14px; box-shadow: 0 7px 22px rgba(15, 23, 42, .05); }
.upload-panel { padding: 14px; }
.drop-zone {
  min-height: 160px; border: 2px dashed #bfcee0; border-radius: 15px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 6px; background: #f8fafc; color: #334155; transition: .15s ease;
}
.drop-zone:hover, .drop-zone.dragover { background: #eff6ff; border-color: #60a5fa; }
.upload-icon { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 50%; background: #dbeafe; color: #1d4ed8; font-size: 24px; font-weight: 800; }
.drop-zone strong { font-size: 18px; }
.drop-zone small { color: #64748b; }
.file-meta { padding: 12px 4px 2px; color: #475569; font-size: 14px; }

.panel-heading { display: flex; justify-content: space-between; gap: 16px; align-items: center; margin-bottom: 16px; }
.panel-heading h3 { margin: 0; font-size: 21px; }
.panel-heading p { margin: 5px 0 0; color: #64748b; }
.settings-grid { display: grid; grid-template-columns: 180px 240px 1fr; gap: 14px; align-items: end; }
.settings-grid label:not(.check-row) { display: grid; gap: 7px; }
.settings-grid label span { font-size: 13px; font-weight: 750; color: #475569; }
input[type="number"], select { width: 100%; padding: 11px 12px; border: 1px solid #cbd5e1; border-radius: 10px; background: white; color: #0f172a; }
.check-row { display: flex; gap: 9px; align-items: center; padding-bottom: 10px; }
.check-row input { width: 18px; height: 18px; }
.saturday-box { margin: 18px 0; padding: 15px; background: #fff7ed; border: 1px solid #fed7aa; border-radius: 13px; }
.saturday-box p { margin: 4px 0 10px; color: #9a3412; }
.saturday-options { display: flex; gap: 10px; flex-wrap: wrap; }
.saturday-options label { display: flex; align-items: center; gap: 7px; background: white; border: 1px solid #fdba74; border-radius: 999px; padding: 8px 11px; }

.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 16px; }
.stat-card { background: white; border: 1px solid #dbe3ec; border-radius: 15px; padding: 16px; }
.stat-card span { display: block; color: #64748b; font-size: 13px; margin-bottom: 6px; }
.stat-card strong { font-size: 25px; }
.warnings { margin-top: 14px; padding: 14px 16px; border-radius: 14px; background: #fff7ed; border: 1px solid #fed7aa; color: #9a3412; white-space: pre-line; }
.result-heading { align-items: flex-start; }
.button-row { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.table-wrap { overflow: auto; border: 1px solid #e2e8f0; border-radius: 12px; max-height: 62vh; }
table { border-collapse: separate; border-spacing: 0; width: max-content; min-width: 100%; font-size: 13px; }
th, td { padding: 9px 10px; border-right: 1px solid #e2e8f0; border-bottom: 1px solid #e2e8f0; white-space: nowrap; text-align: right; }
th { position: sticky; top: 0; background: #0f172a; color: white; z-index: 2; font-size: 11px; text-align: center; }
td:nth-child(-n+6) { text-align: left; }
tbody tr.group-start td { border-top: 2px solid #94a3b8; }
tbody tr:hover td { background: #f8fafc; }
.footnote { color: #64748b; font-size: 12px; margin: 12px 2px 0; }
.hidden { display: none !important; }
.toast { position: fixed; right: 22px; bottom: 22px; transform: translateY(20px); opacity: 0; pointer-events: none; transition: .2s ease; padding: 12px 16px; border-radius: 10px; background: #0f172a; color: white; box-shadow: 0 10px 28px rgba(15,23,42,.22); }
.toast.show { transform: translateY(0); opacity: 1; }

@media (max-width: 850px) {
  .app-shell { width: min(100% - 20px, 1440px); margin-top: 10px; }
  .hero { padding: 22px; border-radius: 17px; }
  .mode-grid { grid-template-columns: 1fr; }
  .settings-grid, .stats-grid { grid-template-columns: 1fr 1fr; }
  .wide { grid-column: 1 / -1; }
  .toolbar { align-items: flex-start; flex-direction: column; }
  .result-heading { flex-direction: column; }
}

@media (max-width: 520px) {
  .settings-grid, .stats-grid { grid-template-columns: 1fr; }
  .hero { flex-direction: column; }
  .app-meta { align-items: flex-start; }
  .mode-card { grid-template-columns: auto 1fr; }
  .mode-card .arrow, .mode-card .badge { grid-column: 2; justify-self: start; }
}

.install-btn {
  border: 1px solid rgba(255,255,255,.28);
  border-radius: 10px;
  padding: 8px 11px;
  background: rgba(255,255,255,.10);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
}
.install-btn:hover { background: rgba(255,255,255,.17); }
.install-btn.hidden { display: none !important; }
