:root {
  --main: #0b63ce;
  --main-dark: #084b9d;
  --main-soft: #1c8cff;
  --surface: #ffffff;
  --surface-soft: #f8fbff;
  --surface-muted: #f4f6f8;
  --border: #dbe5f0;
  --text: #1f2937;
  --muted: #64748b;
  --shadow: 0 14px 34px rgba(15, 23, 42, 0.08);
}

html { scroll-behavior: smooth; }

body {
  min-height: 100vh;
  background: radial-gradient(circle at top left, #eef5ff 0%, #f7f9fc 42%, #f4f6f8 100%);
  color: var(--text);
}

a { color: var(--main); }
a:hover { color: var(--main-dark); text-decoration: none; }

.container { max-width: 1320px; }

.navbar { box-shadow: 0 10px 30px rgba(15, 23, 42, 0.14); }
.navbar-brand { font-weight: 700; letter-spacing: 0.01em; }
.bg-main { background: linear-gradient(135deg, var(--main) 0%, var(--main-soft) 100%) !important; }
.nav-link { font-weight: 500; opacity: 0.92; }
.navbar-nav .nav-link.active {
  opacity: 1;
  text-decoration: underline;
  text-underline-offset: 0.28rem;
}

.breadcrumb {
  background: rgba(255, 255, 255, 0.84);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.55rem 1rem;
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.05);
}

.card {
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  background: rgba(255, 255, 255, 0.95);
  overflow: hidden;
}
.card-header {
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  color: #0f172a;
}

.btn, .form-control, .custom-select, .form-select {
  transition: all 0.15s ease;
}
.btn {
  border-radius: 10px;
  font-weight: 600;
}
.btn-main {
  background: linear-gradient(135deg, var(--main) 0%, var(--main-soft) 100%);
  color: #fff;
  border: none;
  box-shadow: 0 10px 20px rgba(11, 99, 206, 0.22);
}
.btn-main:hover, .btn-main:focus {
  color: #fff;
  background: linear-gradient(135deg, #0957b5 0%, #1680ef 100%);
  transform: translateY(-1px);
  box-shadow: 0 14px 24px rgba(11, 99, 206, 0.28);
}
.btn-outline-secondary {
  border-color: #cfd8e3;
  color: #334155;
  background: #fff;
}
.btn-outline-secondary:hover, .btn-outline-secondary:focus {
  background: #f8fbff;
  color: #0f172a;
  border-color: #b9c7d8;
}
.form-control:focus, .custom-select:focus, .form-select:focus {
  border-color: #7fb3ff;
  box-shadow: 0 0 0 0.2rem rgba(11, 99, 206, 0.12);
}

.alert {
  border: none;
  border-radius: 14px;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
}

.badge {
  border-radius: 999px;
  padding: 0.45rem 0.7rem;
  font-weight: 700;
}
.badge-soft {
  background: var(--surface-soft);
  color: #0f172a;
  border: 1px solid var(--border);
}

.table { background: transparent; margin-bottom: 0; }
.table thead th {
  border-top: none;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 700;
}
.table td, .table th { vertical-align: middle; }
.table-hover tbody tr:hover {
  background: #eef5ff;
  cursor: pointer;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.35rem 1.5rem;
  margin-bottom: 1rem;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.97), rgba(248, 251, 255, 0.96));
  box-shadow: var(--shadow);
}
.page-header__title {
  margin: 0;
  font-size: clamp(1.35rem, 2.2vw, 1.95rem);
  font-weight: 800;
  color: #0f172a;
}
.page-header__subtitle {
  margin-top: 0.35rem;
  color: var(--muted);
}
.page-header__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.85rem;
}

.stat-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.42rem 0.75rem;
  border-radius: 999px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  color: #0f172a;
  font-weight: 700;
}
.stat-chip__label {
  color: var(--muted);
  font-weight: 500;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}
.metric-card {
  border: 1px solid var(--border);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: var(--shadow);
  padding: 1rem 1.1rem;
}
.metric-card__label {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 0.35rem;
}
.metric-card__value {
  font-size: 1.45rem;
  font-weight: 800;
  color: #0f172a;
}

.table-action-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.gap-2 { gap: 0.5rem; }

.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
}
.empty-state__title {
  font-size: 1.15rem;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 0.5rem;
}
.empty-state__desc {
  color: var(--muted);
  margin-bottom: 1rem;
}

.text-muted { color: var(--muted) !important; }

.action-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}
.action-card {
  display: block;
  padding: 1rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
}
.action-card:hover {
  text-decoration: none;
  transform: translateY(-1px);
}
.action-card__eyebrow {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 0.35rem;
}
.action-card__title {
  font-size: 1.05rem;
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 0.35rem;
}
.action-card__desc {
  color: var(--muted);
}

@media (max-width: 991.98px) {
  .page-header {
    padding: 1rem 1.1rem;
    flex-direction: column;
  }
}


.status-green { background: #e8f7ee; color: #166534; }
.status-yellow { background: #fff7db; color: #92400e; }
.status-red { background: #ffe8e8; color: #b91c1c; }

.legend-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  font-weight: 700;
  border: 1px solid var(--border);
}

.history-toggle {
  min-width: 56px;
  border-radius: 999px;
}

.schedule-grid-note {
  font-size: 0.72rem;
  line-height: 1.25;
  min-height: 1.8rem;
}

.schedule-grid-select {
  min-width: 62px;
  font-size: 0.82rem;
  padding: 0.1rem 0.2rem;
}

.schedule-grid-lock {
  min-width: 62px;
  font-size: 0.76rem;
  padding: 0.08rem 0.2rem;
}

.schedule-day.is-holiday:not(.status-green):not(.status-yellow):not(.status-red) {
  background: #fffaf0;
}

.schedule-day.is-holiday {
  box-shadow: none;
}

.live-save-indicator.is-saving {
  background: #fff7db;
  color: #92400e;
}

.live-save-indicator.is-error {
  background: #ffe8e8;
  color: #b91c1c;
}

.cell-saving {
  opacity: 0.55;
  pointer-events: none;
}

.solver-progress-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.28);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.solver-progress-card {
  width: min(520px, calc(100vw - 2rem));
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 1.25rem;
}

.solver-progress-text {
  min-height: 1.5rem;
}

.help-panel {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  padding: 0.95rem 1.05rem;
  margin-bottom: 1rem;
  border: 1px solid #eadca8;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255, 252, 235, 0.98), rgba(255, 248, 214, 0.94));
  box-shadow: 0 8px 20px rgba(148, 120, 20, 0.06);
}

.help-panel__body {
  flex: 1 1 auto;
  min-width: 0;
}

.help-panel__icon {
  flex: 0 0 2rem;
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  color: #7c5a00;
  background: #fff4bf;
  border: 1px solid #e7cf6d;
}

.help-panel__title {
  font-weight: 800;
  color: #5f4b00;
  margin-bottom: 0.45rem;
}

.help-panel__table {
  display: grid;
  gap: 0.35rem;
}

.help-panel__row {
  display: grid;
  grid-template-columns: minmax(110px, 140px) 1fr;
  gap: 0.85rem;
  padding-top: 0.35rem;
  border-top: 1px dashed rgba(146, 108, 12, 0.18);
}

.help-panel__row:first-child {
  border-top: 0;
  padding-top: 0;
}

.help-panel__cell {
  color: #5f6368;
}

.help-panel__cell--label {
  color: #5f4b00;
}

.help-panel__list {
  margin: 0;
  padding-left: 1.1rem;
  color: #5f6368;
}

.help-panel__list li + li {
  margin-top: 0.18rem;
}

@media (max-width: 767.98px) {
  .help-panel__row {
    grid-template-columns: 1fr;
    gap: 0.2rem;
  }
}