:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #171914;
  background: #f5f5f1;
  font-synthesis: none;
}

* { box-sizing: border-box; }

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background: #f5f5f1;
}

button, input, select, textarea { font: inherit; }
button { color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: #171914;
  font-size: 14px;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-decoration: none;
}

.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: #171914;
  color: #fff;
  font-size: 12px;
  letter-spacing: -0.02em;
}

.eyebrow {
  margin: 0 0 10px;
  color: #78816d;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.16em;
}

.button, .icon-button, .text-button, .add-button, .entry-action, .close-button {
  border: 0;
  cursor: pointer;
}

.button {
  min-height: 42px;
  border-radius: 10px;
  padding: 10px 15px;
  font-weight: 750;
}

.button-dark { background: #171914; color: #fff; }
.button-light { border: 1px solid #dcddd7; background: #fff; color: #33362f; }
.button:disabled { opacity: 0.55; cursor: wait; }

.auth-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px 20px;
  background:
    radial-gradient(circle at 15% 15%, rgba(196, 219, 166, 0.35), transparent 32%),
    radial-gradient(circle at 85% 85%, rgba(223, 211, 180, 0.45), transparent 30%),
    #f5f5f1;
}

.auth-card {
  width: min(100%, 430px);
  padding: 34px;
  border: 1px solid #e0e1db;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 24px 70px rgba(31, 34, 27, 0.1);
}

.auth-brand { margin-bottom: 38px; }
.auth-card h1 { margin: 0; font-size: clamp(28px, 6vw, 38px); letter-spacing: -0.045em; line-height: 1.04; }
.auth-intro { margin: 12px 0 28px; color: #696d64; line-height: 1.6; }

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  margin-bottom: 24px;
  border-radius: 11px;
  background: #eff0eb;
}

.tab {
  border: 0;
  border-radius: 8px;
  padding: 10px;
  background: transparent;
  color: #74786f;
  font-weight: 700;
  cursor: pointer;
}

.tab[aria-selected="true"] {
  background: #fff;
  color: #171914;
  box-shadow: 0 1px 5px rgba(25, 28, 21, 0.1);
}

.auth-form, .exercise-form { display: grid; gap: 16px; }

label {
  display: grid;
  gap: 7px;
  font-size: 13px;
  font-weight: 700;
}

input, select, textarea {
  width: 100%;
  border: 1px solid #d8dad3;
  border-radius: 9px;
  padding: 11px 12px;
  outline: none;
  background: #fff;
  color: #171914;
}

textarea { resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus {
  border-color: #59644b;
  box-shadow: 0 0 0 3px rgba(89, 100, 75, 0.12);
}

.field-hint { margin: -8px 0 0; color: #7e8279; font-size: 12px; }
.form-message { min-height: 20px; margin: 14px 0 0; color: #b42318; font-size: 13px; text-align: center; }

.app-shell { min-height: 100vh; }

.topbar {
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 max(24px, calc((100vw - 1500px) / 2));
  border-bottom: 1px solid #dedfd9;
  background: rgba(250, 250, 247, 0.94);
  backdrop-filter: blur(14px);
}

.account-actions { display: flex; align-items: center; gap: 8px; }
.user-pill { padding: 8px 12px; border-radius: 999px; background: #e8eadf; font-size: 13px; font-weight: 750; }
.text-button { padding: 9px; background: transparent; color: #65695f; font-size: 13px; font-weight: 700; }
.text-button:hover { color: #171914; }

.planner { width: min(100%, 1548px); margin: 0 auto; padding: 52px 24px 60px; }

.planner-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 38px;
}

.planner-heading h1 { margin: 0; font-size: clamp(34px, 5vw, 62px); letter-spacing: -0.055em; line-height: 0.98; }
.planner-intro { max-width: 610px; margin: 15px 0 0; color: #696d64; font-size: 16px; line-height: 1.6; }
.week-summary { min-width: 145px; padding: 18px 20px; border: 1px solid #dfe0da; border-radius: 14px; background: #fff; }
.week-summary strong { display: block; font-size: 28px; letter-spacing: -0.04em; }
.week-summary span { color: #777b72; font-size: 12px; }

.routine-toolbar {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-top: 1px solid #dedfd9;
}

.routine-toolbar > div { display: flex; align-items: baseline; gap: 10px; }
.routine-toolbar strong { font-size: 14px; }
.routine-toolbar span { color: #858980; font-size: 12px; }
.button-light:hover { background: #f0f1ec; }
.scroll-hint { display: none; justify-self: end; margin: 0; color: #858980; font-size: 12px; }

.calendar-wrap { overflow-x: auto; padding: 2px 0 20px; }
.calendar { min-width: 1050px; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid #dedfd9; border-radius: 16px; overflow: hidden; background: #dedfd9; gap: 1px; }

.day-column { min-height: 430px; display: flex; flex-direction: column; padding: 16px 13px; background: #fafaf7; }
.day-column.today {
  position: relative;
  z-index: 1;
  background: #f3f5ea;
  box-shadow: inset 0 0 0 2px #6f7d59;
}
.day-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; padding-bottom: 13px; border-bottom: 1px solid #e5e6e0; }
.day-heading { min-width: 0; }
.day-name { margin: 0; font-size: 17px; font-weight: 800; letter-spacing: -0.025em; }
.today .day-name { color: #53603f; }
.day-subheading {
  max-width: 100%;
  margin: 4px 0 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: #667153;
  font-size: 11px;
  font-weight: 750;
  line-height: 1.35;
  text-align: left;
  overflow-wrap: anywhere;
  cursor: pointer;
}
.day-subheading.empty { color: #a0a39b; font-weight: 600; }
.day-subheading:hover { color: #171914; }
.add-button { width: 32px; height: 32px; border-radius: 9px; background: #e9ebe3; font-size: 21px; line-height: 1; }
.add-button:hover { background: #171914; color: #fff; }

.entries { display: grid; align-content: start; gap: 9px; padding-top: 13px; }
.empty-day { margin: 22px 4px; color: #a0a39b; font-size: 12px; line-height: 1.45; }
.entry { position: relative; padding: 13px; border: 1px solid #e0e1db; border-radius: 11px; background: #fff; box-shadow: 0 3px 10px rgba(30, 33, 26, 0.035); }
.entry-name { max-width: calc(100% - 28px); margin: 0; font-size: 13px; font-weight: 800; line-height: 1.35; overflow-wrap: anywhere; }
.entry-meta { margin: 7px 0 0; color: #677255; font-size: 11px; font-weight: 750; }
.entry-notes { margin: 7px 0 0; color: #7d8178; font-size: 11px; line-height: 1.45; overflow-wrap: anywhere; }
.entry-actions { position: absolute; top: 8px; right: 7px; display: flex; }
.entry-action { width: 25px; height: 25px; padding: 0; border-radius: 7px; background: transparent; color: #969990; font-size: 14px; }
.entry-action:hover { background: #eff0eb; color: #171914; }

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 10;
  max-width: min(360px, calc(100vw - 44px));
  margin: 0;
  padding: 12px 16px;
  border-radius: 10px;
  background: #171914;
  color: #fff;
  font-size: 13px;
  box-shadow: 0 14px 35px rgba(23, 25, 20, 0.2);
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: 160ms ease;
}

.toast.visible { opacity: 1; transform: translateY(0); }

dialog {
  width: min(92vw, 480px);
  padding: 0;
  border: 0;
  border-radius: 18px;
  box-shadow: 0 30px 90px rgba(20, 23, 17, 0.25);
}

dialog::backdrop { background: rgba(21, 24, 18, 0.5); backdrop-filter: blur(3px); }
.exercise-form { padding: 27px; }
.dialog-heading { display: flex; align-items: start; justify-content: space-between; gap: 20px; margin-bottom: 2px; }
.dialog-heading h2 { margin: 0; font-size: 25px; letter-spacing: -0.04em; }
.close-button { width: 34px; height: 34px; border-radius: 9px; background: #f0f1ec; font-size: 23px; line-height: 1; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.optional { color: #95988f; font-size: 11px; font-weight: 500; }
.dialog-message { margin: -4px 0; text-align: left; }
.dialog-actions { display: grid; grid-template-columns: 1fr 1.5fr; gap: 10px; margin-top: 2px; }

@media (max-width: 760px) {
  .topbar { height: 64px; padding: 0 18px; }
  .brand > span:last-child { display: none; }
  .planner { padding: 36px 18px 44px; }
  .planner-heading { align-items: start; }
  .planner-intro { font-size: 14px; }
  .week-summary { display: none; }
  .routine-toolbar { padding: 12px 0; }
  .routine-toolbar > div { display: grid; gap: 3px; }
  .scroll-hint { display: block; }
  .calendar { min-width: 1400px; grid-template-columns: repeat(7, 200px); }
  .day-column { min-height: 390px; }
}

@media (max-width: 460px) {
  .auth-card { padding: 27px 22px; }
  .auth-brand { margin-bottom: 30px; }
  .user-pill { max-width: 135px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .dialog-actions { grid-template-columns: 1fr; }
  .dialog-actions .button-light { order: 2; }
}
