:root {
  --ink: #1c2430;
  --ink-muted: #4b5a6b;
  --bg: #f5f7fb;
  --panel: #ffffff;
  --panel-border: #dbe3ee;
  --panel-elev-shadow: 0 6px 24px rgba(0, 0, 0, .08);
  --brand: #0a6e5a;
  --accent: #146dff;
  --blue: #1673ff;
}
html, body {
  height: 100%;
}
body {
  font-family: Avenir, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  margin: 0;
  background: var(--bg);
  color: var(--ink);
}
.small, small {
  font-size: .875em;
}
input[type="text"], input[type="date"], select, textarea {
  font-family: inherit;
}
input[type="date"] {
  font-variant-numeric: tabular-nums;
}
#output {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 12.5px;
  flex: 1;
  min-height: 220px;
  resize: vertical;
  background: #e9ecef;
  color: var(--ink);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 10px 12px;
}
.page-header {
  background: #333;
  color: #fff;
  padding: 3rem 0 1.5rem;
  margin: 0 0 2rem;
  box-shadow: var(--panel-elev-shadow);
}
.wrapper {
  max-width: 1200px;
  margin: 0 auto;
  padding-inline: 20px;
}
.page-header h1 {
  font-size: 2.25rem;
  line-height: 1.2;
  margin: 0;
}
main {
  padding: 16px;
  display: grid;
  gap: 16px;
  grid-template-columns: 375px 1fr;
  min-height: calc(100vh - 120px);
}
@media (max-width:960px) {
  main {
    grid-template-columns: 1fr;
  }
}
.card {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  box-shadow: var(--panel-elev-shadow);
}
.panel {
  padding: 16px;
}
.panel:first-child {
  padding-bottom: 0;
}
*, *::before, *::after {
  box-sizing: border-box;
}
fieldset {
  background: var(--bg);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 12px;
  margin: 0 0 12px;
}
legend {
  padding: 0 6px;
  margin-left: -6px;
  color: var(--ink-muted);
  font-size: .9rem;
  font-weight: 900;
}
label {
  display: block;
  font-size: .9rem;
  margin: 0 0 6px;
  color: var(--ink-muted);
}
input + label {
  margin-top: 10px;
}
input[type="text"], input[type="date"], textarea, select {
  width: 100%;
  max-width: 100%;
  padding: 10px 8px;
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  outline: none;
}
input[type="text"]:focus, input[type="date"]:focus, textarea:focus, select:focus {
  border-color: #a9c1ff;
  box-shadow: 0 0 0 3px rgba(20, 109, 255, .12);
}
.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
@media (max-width:960px) {
  .row {
    grid-template-columns: 1fr;
  }
}
.help {
  font-size: .85rem;
  color: var(--ink-muted);
  margin-top: 6px;
}
code.inline {
  background: #f1f5fb;
  padding: 2px 6px;
  border-radius: 6px;
  border: 1px solid #e1e8f4;
  color: #0b2a5a;
}
.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}
.btn {
  appearance: none;
  cursor: pointer;
  font-weight: 600;
  border-radius: 12px;
  padding: 10px 14px;
}
.btn:disabled {
  opacity: .5;
  cursor: not-allowed;
}
.btn.pulse {
  outline: 2px solid rgba(40, 167, 69, .35);
  outline-offset: 2px;
}
.btn-primary {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid #1062e6;
  background: #1673ff;
  color: #fff;
  font-size: 18px;
  line-height: 1.2;
  box-shadow: 0 1px 0 rgba(0, 0, 0, .03);
  transition: 0.3s ease;
}
.btn-primary:hover {
  background: #0056b3;
}
.button-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  width: 100%;
}
.btn-medium {
  border: 1px solid var(--panel-border);
  background: #fff;
  color: var(--ink);
  transition: 0.3s ease;
}
.btn-medium:hover {
  background: var(--bg);
}
.icon-btn {
  appearance: none;
  border: 1px solid var(--panel-border);
  background: #fff;
  color: var(--ink);
  border-radius: 10px;
  padding: 8px;
  width: 40px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: 0.3s ease;
}
.icon-btn:hover {
  background: var(--bg);
}
.icon-btn svg {
  width: 18px;
  height: 18px;
}
#config {
  display: flex;
  flex-direction: column;
  height: 100%;
}
#config .footer-actions {
  margin-top: auto;
  position: sticky;
  bottom: -4px;
  background: #fff;
  padding-block: 10px 28px;
  border-top: 1px solid var(--panel-border);
}
section.card.panel:has(#output) {
  display: flex;
  flex-direction: column;
}
table {
  width: 100%;
  border-collapse: collapse;
}
th, td {
  border-bottom: 1px solid var(--panel-border);
  padding: 6px 4px;
  font-size: .9rem;
  vertical-align: middle;
}
th {
  text-align: left;
  color: var(--ink-muted);
  font-weight: 600;
}
.right {
  text-align: right;
}
#checklist {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 1000;
  width: min(420px, calc(100vw - 32px));
  max-height: 40vh;
  overflow-x: hidden;
  overflow-y: auto;
  /*background: #fff;*/
  color: #8a3b00;
  background: #fff6e5;
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  box-shadow: 0 12px 24px rgba(0, 0, 0, .14);
  padding: 12px 16px;
  margin: 0;
  opacity: 0;
  transform: translateY(10px);
  animation: checklist-toast-in .25s ease-out forwards;
  display: none;
}
#checklist.show {
  display: block;
}
#checklist .help {
  margin-top: 6px;
  color: var(--ink-muted);
}
#checklist .close {
  position: absolute;
  right: -6px;
  top: 0;
  color: #999;
  font-size: 2rem;
}
#checklist .close:hover {
  color: #333;
}
#checklist-content p {
  margin-top: 0;
}
@keyframes checklist-toast-in {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@media (prefers-reduced-motion: reduce) {
  #checklist {
    animation: none;
    opacity: 1;
    transform: none;
  }
}
@media (max-width:640px) {
  #checklist {
    right: 12px;
    left: 12px;
    width: auto;
    max-height: 50vh;
  }
}
.inline-warning {
  font-size: .85rem;
  color: #8a3b00;
  background: #fff6e5;
  border: 1px solid #ffe2b3;
  border-radius: 8px;
  padding: 6px 8px;
  margin-top: 6px;
}
.btn.is-success {
  border-color: #16a34a;
  box-shadow: 0 0 0 3px rgba(22, 163, 74, .15);
}
.btn.is-success::after {
  content: " ✓";
  font-weight: 700;
}
#actionAnnouncer {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: #111827;
  color: #fff;
  border-radius: 10px;
  padding: 8px 12px;
  font-size: .9rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
}
#actionAnnouncer.show {
  opacity: 1;
}
/* Schedule settings styles */
.schedule-settings {
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 12px;
  margin: 0 0 12px;
}
.schedule-settings-header {
  padding: 0 6px;
  margin-left: -6px;
  color: var(--ink-muted);
  font-size: .9rem;
  font-weight: 900;
  margin-bottom: 12px;
}
.schedule-settings-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.schedule-setting-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px;
  background: #fff;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.schedule-setting-item:hover {
  background: var(--bg);
  border-color: #a9c1ff;
}
.schedule-setting-content {
  flex: 1;
}
.schedule-setting-title {
  font-weight: 600;
  margin-bottom: 2px;
}
.schedule-setting-count {
  font-size: 0.85rem;
  color: var(--ink-muted);
}
.schedule-setting-icon {
  width: 20px;
  height: 20px;
  color: var(--ink-muted);
}
/* Modal Styles */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay.show {
  display: flex;
}
.modal {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
  width: 100%;
  max-width: 800px;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--panel-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0;
}
.modal-close {
  background: none;
  border: none;
  font-size: 32px;
  color: #999;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-close:hover {
  color: #333;
}
.modal-body {
  padding: 20px 24px;
  flex: 1;
  overflow-y: auto;
}
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--panel-border);
  display: flex;
  gap: 12px;
  justify-content: center;
}
.modal-footer .btn {
  width: auto !important;
  min-width: 100px;
}
.modal-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 20px;
}
.modal-table th, .modal-table td {
  padding: 12px 8px;
  border-bottom: 1px solid var(--panel-border);
  text-align: left;
}
.modal-table th {
  background: var(--bg);
  font-weight: 600;
  color: var(--ink-muted);
}
.modal-table th:first-child {
  width: 25%;
}
.modal-table input[type="date"], .modal-table input[type="text"] {
  margin: 0;
}
.modal-table .delete-col {
  width: 60px;
  text-align: center;
}
.instructions-btn {
  margin-block: 20px 0;
  text-align: center;
}
.add-row-btn, .instructions-btn a {
  background: var(--bg);
  border: 1px solid var(--panel-border);
  color: var(--ink);
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  text-decoration: none !important;
}
.add-row-btn:hover, .instructions-btn a:hover {
  background: #e5e7eb;
}
.validation-error {
  color: #dc2626;
  font-size: 0.85rem;
  margin-top: 4px;
}
.modal-help {
  font-size: 0.85rem;
  color: var(--ink-muted);
  margin-bottom: 16px;
}
/* Scroll hint (left column) */
.scroll-hint {
  text-align: center;
  font-size: 0.9rem;
  color: var(--ink-muted);
  margin: .5rem 0 1.5rem;
  cursor: pointer;
  user-select: none;
  transition: color .2s ease, opacity .2s ease;
}
.scroll-hint:hover {
  color: var(--ink);
}
.scroll-hint.is-hidden {
  opacity: 0;
  pointer-events: none;
}
/* Subtle gradient cue above the sticky footer */
/*#config .footer-actions::before {
  content: "";
  position: sticky;
  display: block;
  top: -10px;
  height: 10px;
  margin-top: -10px;
  background: linear-gradient(to bottom, rgba(245,247,251,0) 0%, rgba(245,247,251,.9) 100%);
}*/


/* Safari-friendly custom select with consistent arrow */

.select-wrap {
  position: relative;
  display: block;
}

/* Remove native styling in Safari/iOS while keeping your look */
.select-wrap select {
  -webkit-appearance: none; /* Safari/iOS */
  appearance: none;
  background-color: #fff;           /* required on iOS when removing appearance */
  border-radius: 10px;              /* you already use 10px—keep it for iOS */
  padding-right: 2.25rem;           /* make room for the custom arrow */
  line-height: 1.2;                 /* avoids clipped text in Safari */
  background-image: none;           /* suppress any UA arrow */
}

/* The arrow */
.select-wrap::after {
  content: "";
  pointer-events: none;
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);

  /* SVG chevron that matches your ink color */
  width: 12px;
  height: 12px;
  background-repeat: no-repeat;
  background-size: 12px 12px;
  background-image: url('data:image/svg+xml;utf8,\
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="%234b5a6b">\
<path d="M4.2 6.2a1 1 0 0 1 1.4 0L8 8.6l2.4-2.4a1 1 0 1 1 1.4 1.4L8.7 10.7a1 1 0 0 1-1.4 0L4.2 7.6a1 1 0 0 1 0-1.4z"/>\
</svg>');
  opacity: .9;
}

/* Use your existing focus style—extend it to the wrapper so the arrow gets the ring too */
.select-wrap:has(select:focus) {
  box-shadow: 0 0 0 3px rgba(20, 109, 255, .12);  /* matches your focus ring */
  border-radius: 12px;                             /* soft ring corners */
}

/* Disabled state */
.select-wrap select:disabled {
  color: var(--ink-muted);
  background-color: #f8fafc;
  cursor: not-allowed;
}
.select-wrap:has(select:disabled)::after { opacity: .4; }

/* Optional: high-contrast arrow on hover to match your buttons */
.select-wrap:hover::after { opacity: 1; }


/* Defaults Modal / Chip styles */
#defaultsModal .modal-table { table-layout: fixed; width: 100%; }
#defaultsModal .modal-table th:nth-child(1) { width: auto; }
#defaultsModal .modal-table th:nth-child(2) { width: 10%; text-align: right; }

#defaultsModal .modal-table td.delete-col {
  vertical-align: top;           /* aligns trash with top of input */
  text-align: right;
}

#defaultsModal .defaults-row td { padding-top: 10px; padding-bottom: 12px; }
#defaultsModal .desc-input {
  width: 100%;
  height: 40px;
}

/* Chips row: lock to 7 columns so pills always align neatly */
#defaultsModal .daychips {
  display: grid;
  grid-template-columns: repeat(7, minmax(4.5rem, 1fr));
  gap: 8px;
  margin-top: 10px;
}

#defaultsModal .daychips.invalid {
  border: 1px solid #ef4444; border-radius: 8px; padding: 6px;
}
#defaultsModal .row-error {
  color: #b91c1c; font-size: 12px; margin-top: 6px;
}


/* Base pill */
#defaultsModal .daychip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #d8dde3;
  border-radius: 999px;
  padding: 6px 10px;
  background: #fff;
  cursor: pointer;
  user-select: none;
  min-height: 32px;
}

#defaultsModal .daychip span {
  font-size: 13px;
  line-height: 1;
}

/* Visually hide real checkbox, keep it accessible */
#defaultsModal .daychip input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 1px; height: 1px;
}

/* Hover + focus rings */
#defaultsModal .daychip:hover {
  border-color: #cbd2d8;
  background: #f8fafc;
}
#defaultsModal .daychip:has(input:focus-visible) {
  outline: 2px solid #5b9cff;   /* accessible focus ring */
  outline-offset: 2px;
}

/* Selected state: apply to whole pill */
#defaultsModal .daychip:has(input:checked) {
  background: rgba(99, 102, 241, 0.12);
  border-color: rgba(99,102,241,0.4);
  font-weight: 600;
}

/* Add the • dot before the text when selected */
#defaultsModal .daychip:has(input:checked) span {
  position: relative;
  padding-left: 14px;
}
#defaultsModal .daychip:has(input:checked) span::before {
  content: '•';
  position: absolute;
  left: 0; top: 50%; transform: translateY(-50%);
  font-weight: 700;
  opacity: .9;
}

/* Keep the delete button visually aligned even if the row wraps */
#defaultsModal .icon-btn.delete.align-top { margin-top: 1px; }

.modal-subheader {
  display: flex;
  justify-content: flex-start; 
  align-items: center;
  gap: .5rem;
  margin: .25rem 0 .5rem;
}

.filter-inline {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  font-size: .95rem;
  white-space: nowrap;
}
