:root {
  --bg: #f5efe4;
  --bg-2: #efe4d2;
  --panel: rgba(255, 250, 242, 0.86);
  --panel-strong: rgba(255, 247, 236, 0.96);
  --line: rgba(102, 74, 32, 0.12);
  --ink: #251b12;
  --muted: #756556;
  --accent: #1f6f5d;
  --accent-2: #d4682c;
  --accent-3: #b0372f;
  --shadow: 0 18px 40px rgba(77, 53, 22, 0.1);
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 10px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "IBM Plex Sans KR", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(212, 104, 44, 0.14), transparent 26%),
    radial-gradient(circle at top right, rgba(31, 111, 93, 0.15), transparent 24%),
    linear-gradient(180deg, var(--bg) 0%, #f9f4eb 44%, var(--bg-2) 100%);
}

button,
input,
textarea {
  font: inherit;
}

.page-shell {
  width: min(1700px, calc(100% - 24px));
  margin: 12px auto 18px;
}

.hero {
  display: grid;
  grid-template-columns: 1.5fr 0.9fr;
  gap: 14px;
  margin-bottom: 14px;
}

.compact-hero .hero-copy,
.compact-hero .hero-glass,
.panel,
.summary-card {
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.hero-copy {
  padding: 24px;
  border-radius: 28px;
  background: linear-gradient(135deg, rgba(255, 251, 246, 0.92), rgba(251, 241, 226, 0.92));
  box-shadow: var(--shadow);
}

.hero-copy h1 {
  margin: 8px 0 10px;
  font-family: "Space Grotesk", sans-serif;
  font-size: clamp(1.6rem, 2vw, 2.4rem);
  line-height: 1.05;
}

.eyebrow {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  color: var(--accent);
}

.hero-text {
  margin: 0;
  max-width: 74ch;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.6;
}

.hero-glass {
  display: grid;
  gap: 10px;
  padding: 16px;
  border-radius: 28px;
  background: linear-gradient(160deg, rgba(30, 111, 93, 0.92), rgba(21, 67, 59, 0.82));
  color: #f8f6f0;
  box-shadow: var(--shadow);
}

.hero-stat {
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.08);
}

.hero-stat .label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.76rem;
  color: rgba(248, 246, 240, 0.72);
}

.layout {
  display: grid;
  grid-template-columns: 350px minmax(0, 1fr);
  gap: 14px;
}

.panel,
.sub-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.controls {
  align-self: start;
  position: sticky;
  top: 10px;
  overflow: hidden;
}

.panel-section {
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.panel-section:last-child {
  border-bottom: 0;
}

.section-title-row,
.small-title-row,
.worker-card-top,
.schedule-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.section-title-row {
  margin-bottom: 12px;
}

.section-title-row h2,
.small-title-row h3 {
  margin: 0;
}

.section-title-row h2 {
  font-size: 1rem;
}

.small-title-row h3 {
  font-size: 0.96rem;
}

.subtle,
.mini-summary {
  color: var(--muted);
  font-size: 0.8rem;
}

.field,
.field-grid,
.auto-holiday-grid,
.summary-grid,
.calendar-grid,
.schedule-list,
.worker-stats,
.entry-list,
.date-list,
.visual-grid,
.text-grid {
  display: grid;
  gap: 10px;
}

.rule-editor,
.rule-list {
  display: grid;
  gap: 8px;
}

.priority-editor,
.priority-list {
  display: grid;
  gap: 8px;
}

.field {
  gap: 6px;
}

.two-up,
.compact-auto-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.field span,
.checkbox-field span {
  font-size: 0.82rem;
  color: var(--muted);
}

input[type="date"],
input[type="number"],
input[type="text"],
textarea {
  width: 100%;
  border: 1px solid rgba(102, 74, 32, 0.16);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.82);
  padding: 10px 12px;
  color: var(--ink);
}

textarea {
  resize: vertical;
  min-height: 66px;
}

.primary-button,
.secondary-button,
.ghost-button,
.tab-button,
.danger-button {
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 0.16s ease, background 0.16s ease;
}

.primary-button,
.secondary-button,
.ghost-button {
  padding: 10px 14px;
}

.primary-button {
  width: 100%;
  background: linear-gradient(135deg, var(--accent), #184d43);
  color: #fff;
  font-weight: 700;
}

.secondary-button {
  background: rgba(31, 111, 93, 0.1);
  color: var(--accent);
  font-weight: 700;
}

.ghost-button {
  background: rgba(102, 74, 32, 0.06);
  color: var(--ink);
}

.primary-button:hover,
.secondary-button:hover,
.ghost-button:hover,
.tab-button:hover,
.danger-button:hover {
  transform: translateY(-1px);
}

.weekday-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.weekday-option {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.68);
  border: 1px solid rgba(102, 74, 32, 0.08);
  font-size: 0.8rem;
}

.badge,
.date-pill,
.schedule-status,
.worker-chip,
.weekday-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
}

.badge {
  padding: 5px 9px;
  background: rgba(212, 104, 44, 0.12);
  color: var(--accent-2);
  font-size: 0.78rem;
  font-weight: 700;
}

.auto-card,
.entry-item,
.month-card,
.schedule-item,
.worker-card,
.sub-panel {
  padding: 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(102, 74, 32, 0.08);
}

.auto-card h3 {
  margin: 0 0 8px;
  font-size: 0.9rem;
}

.entry-item {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  padding: 10px 12px;
}

.entry-meta {
  display: grid;
  gap: 2px;
}

.entry-meta strong {
  font-size: 0.86rem;
}

.entry-meta span {
  color: var(--muted);
  font-size: 0.76rem;
}

.rule-row {
  display: grid;
  grid-template-columns: 110px 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.74);
  border: 1px solid rgba(102, 74, 32, 0.08);
}

.rule-row select {
  width: 100%;
  border: 1px solid rgba(102, 74, 32, 0.16);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.92);
  padding: 8px 10px;
  color: var(--ink);
  font: inherit;
}

.priority-item {
  display: grid;
  grid-template-columns: 30px 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.74);
  border: 1px solid rgba(102, 74, 32, 0.08);
  cursor: grab;
}

.priority-rank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: rgba(31, 111, 93, 0.12);
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
}

.priority-day {
  font-weight: 600;
  font-size: 0.9rem;
}

.priority-grip {
  color: var(--muted);
  letter-spacing: 0.08em;
  font-size: 1rem;
}

.priority-item.dragging {
  opacity: 0.55;
  cursor: grabbing;
}

.priority-item.drag-over {
  border-color: rgba(31, 111, 93, 0.34);
  box-shadow: inset 0 0 0 1px rgba(31, 111, 93, 0.18);
}

.danger-button {
  padding: 7px 10px;
  background: rgba(176, 55, 47, 0.12);
  color: var(--accent-3);
}

.date-pill,
.worker-chip,
.weekday-pill {
  padding: 6px 9px;
  font-size: 0.76rem;
}

.date-pill {
  background: rgba(31, 111, 93, 0.08);
  color: var(--accent);
}

.summary-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 12px;
}

.summary-card {
  padding: 14px;
}

.summary-label,
.summary-note {
  color: var(--muted);
}

.summary-label {
  margin: 0 0 8px;
  font-size: 0.8rem;
}

.summary-value {
  display: block;
  margin-bottom: 4px;
  font-family: "Space Grotesk", sans-serif;
  font-size: clamp(1.15rem, 1.7vw, 1.8rem);
}

.summary-note {
  font-size: 0.76rem;
}

.result-panel {
  padding: 14px;
}

.tab-switcher {
  display: inline-flex;
  padding: 4px;
  border-radius: 999px;
  background: rgba(37, 27, 18, 0.06);
}

.tab-button {
  padding: 8px 12px;
  background: transparent;
  color: var(--muted);
  font-weight: 600;
}

.tab-button.active {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 6px 18px rgba(77, 53, 22, 0.08);
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.visual-grid,
.text-grid {
  grid-template-columns: 1fr;
}

.compact-calendar-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.month-card h3 {
  margin: 0 0 10px;
  font-family: "Space Grotesk", sans-serif;
  font-size: 0.94rem;
}

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

.month-header span {
  text-align: center;
  color: var(--muted);
  font-size: 0.7rem;
}

.day-cell {
  min-height: 58px;
  padding: 6px 4px;
  border-radius: 12px;
  background: rgba(245, 239, 228, 0.76);
  border: 1px solid transparent;
  display: grid;
  align-content: start;
  gap: 2px;
}

.day-cell.empty {
  background: transparent;
}

.day-cell.workday {
  border-color: rgba(31, 111, 93, 0.16);
  background: rgba(31, 111, 93, 0.09);
}

.day-cell.holiday {
  border-color: rgba(212, 104, 44, 0.16);
  background: rgba(212, 104, 44, 0.11);
}

.day-number {
  font-weight: 700;
  font-size: 0.8rem;
}

.day-caption {
  color: var(--muted);
  font-size: 0.66rem;
  line-height: 1.2;
}

.compact-schedule-list {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.schedule-item,
.worker-card {
  gap: 10px;
}

.schedule-top strong,
.worker-card-top h3 {
  font-size: 0.9rem;
}

.schedule-status {
  padding: 6px 9px;
  font-size: 0.74rem;
  font-weight: 700;
}

.schedule-status.work {
  background: rgba(31, 111, 93, 0.1);
  color: var(--accent);
}

.schedule-status.holiday {
  background: rgba(212, 104, 44, 0.12);
  color: var(--accent-2);
}

.worker-chip-row,
.weekday-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.worker-chip {
  background: rgba(37, 27, 18, 0.06);
}

.compact-worker-stats {
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.bar-track {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: rgba(102, 74, 32, 0.08);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), #52a38f);
}

.weekday-pill {
  background: rgba(212, 104, 44, 0.1);
  color: #8b4a20;
}

.text-output {
  margin: 0;
  padding: 12px;
  min-height: 220px;
  max-height: 460px;
  overflow: auto;
  border-radius: 14px;
  background: #f8f5ef;
  border: 1px solid rgba(102, 74, 32, 0.08);
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.78rem;
  line-height: 1.5;
  white-space: pre-wrap;
}

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

.mini-button {
  padding: 7px 10px;
  font-size: 0.76rem;
}

.rich-text-output {
  color: #433326;
}

.rich-text-output .section-line {
  display: block;
  margin: 10px 0 6px;
  color: #1f6f5d;
  font-weight: 700;
}

.rich-text-output .date-line {
  display: block;
  color: #4d3e31;
}

.rich-text-output .date-part {
  color: #1f6f5d;
  font-weight: 700;
}

.rich-text-output .value-part {
  color: #5a493b;
}

.rich-text-output .holiday-line {
  color: #b45722;
}

.rich-text-output .summary-line {
  display: block;
  color: #705f50;
}

.rich-text-output .stat-line {
  display: block;
  color: #5b4c3f;
}

.rich-text-output .label-part {
  color: #d4682c;
  font-weight: 700;
}

.rich-text-output .name-part {
  color: #1f6f5d;
  font-weight: 700;
}

.rich-text-output .warning-line {
  display: block;
  color: #b0372f;
  font-weight: 600;
}

.empty-state {
  padding: 16px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.58);
  color: var(--muted);
  text-align: center;
  font-size: 0.82rem;
}

.error-text {
  min-height: 1.1em;
  margin: 8px 0 0;
  color: var(--accent-3);
  font-size: 0.82rem;
}

@media (max-width: 1180px) {
  .hero,
  .layout,
  .summary-grid,
  .compact-auto-grid,
  .two-up {
    grid-template-columns: 1fr;
  }

  .controls {
    position: static;
  }
}

@media (max-width: 760px) {
  .page-shell {
    width: min(100% - 16px, 100%);
  }

  .rule-row,
  .compact-schedule-list,
  .compact-worker-stats,
  .compact-calendar-grid,
  .text-grid {
    grid-template-columns: 1fr;
  }

  .compact-inline-form,
  .workday-form {
    grid-template-columns: 1fr;
  }
}

