:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #070b14;
  color: #e7edf8;
  font-synthesis: none;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background:
    radial-gradient(circle at 70% 0%, rgba(42, 72, 120, 0.18), transparent 38rem),
    #070b14;
}

button, input, select, textarea { font: inherit; }
button, select, input[type="color"], input[type="checkbox"], input[type="range"] { cursor: pointer; }

.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 22px;
  min-height: 76px;
  padding: 12px 22px;
  border-bottom: 1px solid #202b3f;
  background: rgba(10, 16, 29, 0.92);
  backdrop-filter: blur(18px);
}

.brand, .month-navigation, .header-actions, .section-heading, .preview-toolbar {
  display: flex;
  align-items: center;
}

.brand { gap: 12px; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 13px;
  background: linear-gradient(145deg, #f43f5e, #f59e0b);
  box-shadow: 0 12px 28px rgba(244, 63, 94, 0.24);
  color: white;
  font-weight: 900;
}

h1, h2, p { margin: 0; }
.brand h1 { font-size: 15px; letter-spacing: -0.01em; }
.brand p, .preview-toolbar, .export-section p { margin-top: 3px; color: #8190a8; font-size: 12px; }

.month-navigation {
  gap: 6px;
  padding: 5px;
  border: 1px solid #29364d;
  border-radius: 13px;
  background: #111a2a;
}

select, input[type="text"], input[type="number"], textarea {
  border: 1px solid #303d54;
  border-radius: 9px;
  background: #101827;
  color: #edf3ff;
  outline: none;
}
select:focus, input[type="text"]:focus, input[type="number"]:focus, textarea:focus { border-color: #fb7185; box-shadow: 0 0 0 3px rgba(251, 113, 133, 0.12); }
.month-navigation select { min-width: 190px; padding: 8px 10px; border: 0; background: transparent; text-align: center; font-weight: 700; }

.header-actions { justify-content: flex-end; gap: 9px; }
.icon-button, .primary-button, .secondary-button, .text-button, .theme-button {
  border: 0;
  transition: 150ms ease;
}
.icon-button { width: 34px; height: 34px; border-radius: 9px; background: transparent; color: #a9b6ca; }
.icon-button:hover { background: #202c40; color: white; }
.primary-button, .secondary-button {
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 800;
}
.primary-button { background: #e11d48; color: white; box-shadow: 0 9px 24px rgba(225, 29, 72, 0.2); }
.primary-button:hover { background: #f43f5e; transform: translateY(-1px); }
.secondary-button { border: 1px solid #303d54; background: #121b2b; color: #dce6f5; }
.secondary-button:hover { border-color: #485a78; background: #192438; }
.text-button { padding: 5px; background: transparent; color: #93a3ba; font-size: 11px; }
.text-button:hover { color: white; }
.full-width { width: 100%; margin-top: 10px; }

.workspace { display: grid; grid-template-columns: 390px minmax(0, 1fr); height: calc(100vh - 76px); }
.settings-panel {
  overflow: auto;
  padding: 20px;
  border-right: 1px solid #202b3f;
  background: rgba(10, 16, 28, 0.86);
}
.settings-panel section { padding: 0 0 22px; margin: 0 0 22px; border-bottom: 1px solid #1e293b; }
.settings-panel section:last-child { border-bottom: 0; }
.settings-panel h2 { margin-bottom: 12px; color: #f3f7ff; font-size: 13px; letter-spacing: -0.01em; }
.section-heading { justify-content: space-between; }
.eyebrow { display: block; margin-bottom: 4px; color: #fb7185; font-size: 10px; font-weight: 900; letter-spacing: 0.14em; text-transform: uppercase; }

.theme-list { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.theme-button { padding: 10px; border: 1px solid #26344b; border-radius: 11px; background: #101827; color: #becadd; text-align: left; }
.theme-button:hover, .theme-button.active { border-color: #fb7185; background: #182236; color: white; }
.theme-button strong { display: block; margin-bottom: 7px; font-size: 11px; }
.theme-swatches { display: flex; height: 8px; overflow: hidden; border-radius: 99px; }
.theme-swatches i { flex: 1; }

.toggle-grid { display: grid; gap: 7px; }
.toggle-row, .field-row, .range-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 40px;
  color: #bac6d8;
  font-size: 12px;
}
.toggle-row { padding: 8px 10px; border: 1px solid #243149; border-radius: 10px; background: #101827; }
input[type="checkbox"] { width: 17px; height: 17px; accent-color: #e11d48; }
.field-row select { min-width: 145px; padding: 7px 9px; }
.field-row.stacked { align-items: stretch; flex-direction: column; gap: 7px; }
.field-row.stacked input { width: 100%; padding: 9px; }

.color-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.color-grid label, .column-colors label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 40px;
  padding: 7px 9px;
  border: 1px solid #243149;
  border-radius: 10px;
  background: #101827;
  color: #aebbd0;
  font-size: 11px;
}
input[type="color"] { width: 29px; height: 25px; padding: 0; border: 0; border-radius: 7px; background: transparent; }
.column-colors { display: grid; gap: 6px; }

.range-row { align-items: stretch; flex-direction: column; gap: 6px; margin-top: 12px; }
.range-row span { display: flex; justify-content: space-between; }
.range-row output { color: #fb7185; font-family: ui-monospace, monospace; font-weight: 800; }
input[type="range"] { width: 100%; accent-color: #e11d48; }
.weekday-labels { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-top: 10px; }
.weekday-labels label { display: grid; gap: 4px; color: #8190a8; font-size: 10px; }
.weekday-labels input { width: 100%; min-width: 0; padding: 8px; font-size: 11px; }
.export-section { padding: 16px !important; border: 1px solid #2c3a52 !important; border-radius: 14px; background: linear-gradient(145deg, #111b2e, #0e1625); }
.export-section p { line-height: 1.55; }
.section-description { margin: -4px 0 12px; color: #8190a8; font-size: 11px; line-height: 1.5; }
.export-status { min-height: 18px; margin-top: 10px; color: #fda4af; font-size: 11px; text-align: center; }

.preview-area { min-width: 0; overflow: hidden; padding: 18px; background: linear-gradient(135deg, rgba(19, 29, 48, 0.45), rgba(6, 10, 18, 0.7)); }
.preview-toolbar { justify-content: space-between; height: 34px; padding: 0 3px; }
.status-dot { display: inline-block; width: 7px; height: 7px; margin-right: 7px; border-radius: 50%; background: #34d399; box-shadow: 0 0 10px rgba(52, 211, 153, 0.7); }
.preview-stage { display: grid; place-items: center; height: calc(100% - 34px); overflow: auto; padding: 22px; border: 1px solid #202c40; border-radius: 18px; background-color: #050912; background-image: linear-gradient(45deg, #0b1220 25%, transparent 25%), linear-gradient(-45deg, #0b1220 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #0b1220 75%), linear-gradient(-45deg, transparent 75%, #0b1220 75%); background-size: 24px 24px; background-position: 0 0, 0 12px, 12px -12px, -12px 0; }
.svg-preview { width: min(100%, 1280px); aspect-ratio: 16 / 9; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.48); }
.svg-preview svg { display: block; width: 100%; height: 100%; }

.calendar-editor {
  width: min(1120px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  padding: 0;
  overflow: auto;
  border: 1px solid #334155;
  border-radius: 18px;
  background: #0b1220;
  color: #e7edf8;
  box-shadow: 0 30px 100px rgba(0, 0, 0, 0.7);
}
.calendar-editor::backdrop { background: rgba(2, 6, 16, 0.82); backdrop-filter: blur(5px); }
.editor-header {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid #26344b;
  background: rgba(11, 18, 32, 0.96);
}
.editor-header h2 { font-size: 20px; }
.editor-header .icon-button { font-size: 26px; }
.editor-columns { display: grid; grid-template-columns: 0.85fr 1.15fr; gap: 16px; padding: 20px; }
.editor-card { padding: 18px; border: 1px solid #26344b; border-radius: 14px; background: #101827; }
.editor-card h3 { margin: 0 0 6px; color: white; font-size: 14px; }
.editor-card p { margin: 0 0 14px; color: #8190a8; font-size: 11px; line-height: 1.5; }
.editor-date-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.editor-date-row label, .editor-field { display: grid; gap: 6px; margin-bottom: 12px; color: #aebbd0; font-size: 11px; }
.editor-date-row select, .editor-field select, .editor-field input, .editor-field textarea { width: 100%; min-width: 0; padding: 9px; }
.editor-field textarea { resize: vertical; line-height: 1.5; }
.toggle-row.compact { min-height: 36px; margin-bottom: 12px; }
.rule-fields { padding: 12px; margin: 4px 0 14px; border: 1px dashed #334155; border-radius: 11px; background: #0b1220; }
.rule-fields[hidden] { display: none; }
.rule-preview { min-height: 17px; margin: 0 !important; color: #fda4af !important; font-weight: 700; }
.editor-actions { display: flex; gap: 8px; }
.holiday-list-card { margin: 0 20px 20px; }
.holiday-list { display: grid; gap: 7px; margin-top: 14px; }
.holiday-list-item { display: grid; grid-template-columns: 80px minmax(170px, 1fr) minmax(180px, 1fr) auto; align-items: center; gap: 10px; padding: 9px 10px; border: 1px solid #26344b; border-radius: 10px; background: #0b1220; }
.holiday-list-item time { color: #fda4af; font-size: 12px; font-weight: 800; }
.holiday-list-item strong { min-width: 0; font-size: 12px; }
.holiday-list-item small { color: #8190a8; font-size: 10px; }
.holiday-item-actions { display: flex; gap: 5px; }
.small-button { padding: 6px 8px; border: 1px solid #334155; border-radius: 7px; background: #172033; color: #dce6f5; font-size: 10px; cursor: pointer; }
.small-button:hover { border-color: #fb7185; }
.small-button.danger, .text-button.danger { color: #fda4af; }
.editor-status { position: sticky; bottom: 0; min-height: 38px; padding: 11px 22px; border-top: 1px solid #26344b; background: rgba(11, 18, 32, 0.97); color: #fda4af; font-size: 11px; }

@media (max-width: 1050px) {
  .app-header { grid-template-columns: 1fr auto; }
  .month-navigation { order: 3; grid-column: 1 / -1; justify-self: center; }
  .workspace { grid-template-columns: 330px minmax(0, 1fr); height: calc(100vh - 132px); }
}

@media (max-width: 760px) {
  .app-header { position: static; display: flex; flex-wrap: wrap; }
  .brand { flex: 1 1 100%; }
  .month-navigation, .header-actions { flex: 1 1 auto; }
  .workspace { display: flex; flex-direction: column; height: auto; }
  .settings-panel { order: 2; overflow: visible; border-right: 0; }
  .preview-area { min-height: 65vw; }
  .header-actions .secondary-button { display: none; }
  .editor-columns { grid-template-columns: 1fr; }
  .holiday-list-item { grid-template-columns: 70px 1fr auto; }
  .holiday-list-item small { grid-column: 1 / -1; grid-row: 2; }
}
