:root {
  color-scheme: light;
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-soft: #f1f5f9;
  --ink: #111827;
  --muted: #647084;
  --line: #d9dee8;
  --accent: #2563eb;
  --accent-strong: #1744a7;
  --good: #0f7b55;
  --warn: #a75b00;
  --bad: #b42318;
  --shadow: 0 18px 44px rgba(20, 29, 46, 0.11);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.45;
}

button,
input,
select {
  font: inherit;
}

a {
  color: inherit;
}

.shell {
  width: min(1220px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 32px;
}

.topbar {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.brand {
  display: inline-flex;
  gap: 12px;
  align-items: center;
  color: var(--ink);
  text-decoration: none;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 1.35rem;
  line-height: 1.1;
}

.brand small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.94rem;
  font-weight: 650;
}

.mark {
  display: grid;
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 8px;
  background: #050814;
  color: #fff;
  font-size: 1.4rem;
  font-weight: 950;
}

.privacy {
  color: var(--muted);
  font-weight: 850;
}

.tool {
  display: grid;
  grid-template-columns: minmax(0, 0.86fr) minmax(430px, 1fr);
  gap: 16px;
  align-items: start;
}

.panel,
.saved {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.panel {
  padding: 20px;
}

.panel-head {
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(1.45rem, 3vw, 2rem);
  line-height: 1.08;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 10px;
  font-size: 1rem;
}

.grid {
  display: grid;
  gap: 12px;
}

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

label,
legend {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 850;
}

label {
  display: grid;
  gap: 7px;
  margin-bottom: 13px;
}

input,
select {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 0 12px;
  font-weight: 850;
}

input:focus,
select:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  font-weight: 950;
}

button:hover {
  border-color: var(--accent);
  color: var(--accent-strong);
}

#customDaysWrap {
  display: none;
}

#customDaysWrap.visible {
  display: grid;
}

.checks {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 16px 0 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.checks legend {
  grid-column: 1 / -1;
}

.checks label {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 0;
  color: var(--ink);
}

.checks input {
  width: 18px;
  min-height: auto;
  height: 18px;
  accent-color: var(--accent);
}

.deadline-card {
  display: grid;
  gap: 7px;
  padding: 20px;
  border: 1px solid #bed3ff;
  border-radius: 8px;
  background: #eef4ff;
}

.deadline-card span {
  color: var(--accent-strong);
  font-size: 0.8rem;
  font-weight: 950;
  text-transform: uppercase;
}

.deadline-card strong {
  color: var(--accent-strong);
  font-size: clamp(3rem, 8vw, 4.6rem);
  line-height: 0.95;
}

.deadline-card p {
  margin-bottom: 0;
  color: var(--muted);
  font-weight: 800;
}

.deadline-card.danger {
  border-color: #efc8c4;
  background: #fff4f3;
}

.deadline-card.danger span,
.deadline-card.danger strong {
  color: var(--bad);
}

.deadline-card.warn {
  border-color: #eed2a7;
  background: #fff8eb;
}

.deadline-card.warn span,
.deadline-card.warn strong {
  color: var(--warn);
}

.actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.actions button:first-child {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.card,
.script {
  margin-top: 18px;
}

#cardText {
  display: grid;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
}

#cardText div {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
}

#cardText div:last-child {
  border-bottom: 0;
}

#cardText span {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 850;
}

#cardText strong {
  text-align: right;
}

pre {
  min-height: 150px;
  overflow: auto;
  white-space: pre-wrap;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fff;
  color: var(--ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 0.88rem;
}

.saved {
  margin-top: 16px;
}

.saved summary {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  padding: 15px 18px;
  cursor: pointer;
  font-weight: 950;
}

.saved summary::-webkit-details-marker {
  display: none;
}

.saved small {
  color: var(--muted);
  font-weight: 650;
}

#clearSaved {
  padding: 0 12px;
}

#savedCards {
  display: grid;
  gap: 8px;
  padding: 0 18px 18px;
}

.saved-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.saved-row strong,
.saved-row span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.saved-row span {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 850;
}

.empty {
  margin: 0;
  color: var(--muted);
  font-weight: 750;
}

.notes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 16px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.notes p {
  margin-bottom: 0;
}

.notes a {
  color: var(--accent-strong);
  font-weight: 950;
}

@media (max-width: 940px) {
  .tool,
  .notes {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .shell {
    width: min(100% - 20px, 1220px);
    padding-top: 14px;
  }

  .topbar,
  .panel-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .brand strong {
    font-size: 1.14rem;
  }

  .brand small,
  .privacy {
    font-size: 0.86rem;
  }

  .panel {
    padding: 15px;
  }

  .grid.two,
  .checks,
  .actions {
    grid-template-columns: 1fr;
  }

  .panel-head button,
  .actions button {
    width: 100%;
  }

  #cardText div {
    align-items: flex-start;
    flex-direction: column;
  }

  #cardText strong {
    text-align: left;
  }
}
