:root {
  --bg: #eef3ef;
  --panel: #fff7ea;
  --panel-strong: #ffffff;
  --ink: #172327;
  --muted: #607075;
  --line: #d6c5ad;
  --green: #28614a;
  --green-dark: #183f33;
  --rust: #b34d2e;
  --rust-dark: #87331f;
  --gold: #f0bc58;
  --blue: #247195;
  --sky: #d9ebf2;
  --shadow: 0 18px 45px rgba(30, 49, 45, 0.18);
  --page-gutter: 20px;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(217, 235, 242, 0.8), rgba(238, 243, 239, 1) 330px),
    var(--bg);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.login-shell {
  display: grid;
  min-height: 100vh;
  padding: 24px;
  place-items: center;
  background:
    linear-gradient(180deg, rgba(20, 35, 39, 0.32), rgba(20, 35, 39, 0.86)),
    url("https://upload.wikimedia.org/wikipedia/commons/4/43/Pikes_Peak_Simese_Twins_GOG.jpg")
      center / cover;
}

.login-panel {
  display: grid;
  width: min(980px, 100%);
  overflow: hidden;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.72fr);
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 8px;
  box-shadow: var(--shadow);
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
}

.login-copy {
  position: relative;
  display: flex;
  min-height: 500px;
  padding: 48px;
  color: white;
  flex-direction: column;
  justify-content: flex-end;
  isolation: isolate;
  background: #87331f;
}

.login-copy::before,
.login-copy::after {
  position: absolute;
  inset: 0;
  content: "";
}

.login-copy::before {
  z-index: -2;
  background: url("https://upload.wikimedia.org/wikipedia/commons/4/43/Pikes_Peak_Simese_Twins_GOG.jpg")
    center / cover;
}

.login-copy::after {
  z-index: -1;
  background:
    linear-gradient(180deg, rgba(23, 35, 39, 0), rgba(23, 35, 39, 0.78)),
    linear-gradient(90deg, rgba(135, 51, 31, 0.18), rgba(24, 63, 51, 0.04));
}

.login-copy h1,
.hero h1 {
  max-width: 760px;
  margin: 0;
  font-size: clamp(2.35rem, 8vw, 5rem);
  line-height: 0.96;
  letter-spacing: 0;
}

.login-copy p:not(.eyebrow),
.hero p:last-child {
  max-width: 620px;
  margin: 18px 0 0;
  font-size: 1.05rem;
  line-height: 1.6;
}

.photo-credit {
  width: fit-content;
  margin-top: 18px;
  color: rgba(255, 255, 255, 0.74);
  font-size: 0.72rem;
  font-weight: 700;
  text-decoration: none;
}

.photo-credit:hover {
  color: white;
  text-decoration: underline;
}

.login-form {
  display: grid;
  gap: 18px;
  align-content: center;
  border-top: 6px solid var(--rust);
  padding: 40px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid #cdb99e;
  border-radius: 8px;
  padding: 11px 12px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.96);
  font-size: 1rem;
}

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

input:focus,
select:focus,
textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(47, 102, 133, 0.18);
  outline: none;
}

.primary-button,
.secondary-button,
.ghost-button,
.tab-button,
.icon-button {
  min-height: 42px;
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 10px 16px;
  font-weight: 800;
}

.primary-button {
  color: white;
  background: var(--rust);
}

.primary-button:hover {
  background: var(--rust-dark);
}

.secondary-button {
  color: var(--green-dark);
  border-color: var(--line);
  background: var(--panel);
}

.ghost-button {
  color: white;
  border-color: rgba(255, 255, 255, 0.56);
  background: rgba(255, 255, 255, 0.12);
}

.form-error {
  min-height: 20px;
  margin: 0;
  color: #a02e20;
  font-size: 0.9rem;
  font-weight: 700;
}

.app-shell {
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(217, 235, 242, 0.82), rgba(238, 243, 239, 1) 380px),
    var(--bg);
}

.hero {
  position: relative;
  min-height: 360px;
  overflow: hidden;
  color: white;
}

.hero-image,
.hero-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.hero-image {
  object-fit: cover;
  object-position: center 45%;
}

.hero-overlay {
  background:
    linear-gradient(180deg, rgba(23, 35, 39, 0.04), rgba(23, 35, 39, 0.78)),
    linear-gradient(90deg, rgba(23, 35, 39, 0.76), rgba(135, 51, 31, 0.16), rgba(23, 35, 39, 0.02));
}

.hero-content {
  position: relative;
  z-index: 1;
  display: flex;
  min-height: inherit;
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 54px 0 70px;
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px;
}

.hero h1 {
  font-size: clamp(2.7rem, 6vw, 4.8rem);
  line-height: 0.98;
}

.hero p:last-child {
  max-width: 680px;
  margin-top: 14px;
}

.hero-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 12px;
  padding-bottom: 5px;
}

.eyebrow,
.toolbar-kicker {
  margin: 0 0 8px;
  color: var(--gold);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0;
}

.status-pill,
.count-pill,
.meta-pill {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  border: 1px solid rgba(255, 255, 255, 0.34);
  border-radius: 999px;
  padding: 6px 11px;
  color: white;
  background: rgba(28, 42, 47, 0.32);
  font-size: 0.82rem;
  font-weight: 800;
  white-space: nowrap;
}

.count-pill,
.meta-pill {
  color: var(--muted);
  border-color: var(--line);
  background: var(--panel);
}

.toolbar,
.tabs,
.dashboard-section {
  width: min(1180px, calc(100% - (var(--page-gutter) * 2)));
  margin-inline: auto;
}

.toolbar {
  display: flex;
  margin-top: -46px;
  position: relative;
  z-index: 2;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px 18px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 12px 30px rgba(39, 51, 48, 0.1);
}

.toolbar-kicker {
  color: var(--rust);
}

.search-box {
  width: min(420px, 100%);
}

.tabs {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  margin-top: 18px;
  gap: 6px;
  overflow-x: auto;
  border: 1px solid rgba(135, 51, 31, 0.18);
  border-radius: 8px;
  padding: 6px;
  background: rgba(255, 255, 255, 0.74);
  box-shadow: 0 8px 22px rgba(39, 51, 48, 0.07);
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}

.tab-button {
  min-width: 0;
  color: #4d6266;
  border-color: transparent;
  background: transparent;
}

.tab-button.active,
.tab-button:hover {
  color: white;
  border-color: var(--rust);
  background: var(--rust);
}

.dashboard-section {
  display: none;
  padding: 22px 0 56px;
}

.dashboard-section.active {
  display: block;
}

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

.section-heading h2 {
  margin: 0;
  font-size: 2rem;
  letter-spacing: 0;
}

.entry-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 12px;
  align-items: end;
  border: 1px solid rgba(135, 51, 31, 0.22);
  border-top: 4px solid var(--rust);
  border-radius: 8px;
  padding: 14px;
  background: linear-gradient(180deg, #fffaf1, #fff5e5);
}

.wide-field {
  grid-column: 1 / -1;
}

.reset-form {
  display: none;
}

.entry-form.editing .reset-form {
  display: inline-block;
}

.item-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.item-card {
  display: grid;
  gap: 12px;
  align-content: start;
  min-height: 170px;
  border: 1px solid rgba(40, 97, 74, 0.2);
  border-left: 5px solid var(--green);
  border-radius: 8px;
  padding: 16px;
  background: var(--panel-strong);
  box-shadow: 0 10px 25px rgba(39, 51, 48, 0.08);
}

.item-card.done {
  opacity: 0.68;
}

.item-card.done h3 {
  text-decoration: line-through;
}

.item-card h3 {
  margin: 0;
  font-size: 1.1rem;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.item-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: auto;
}

.icon-button {
  min-height: 36px;
  padding: 8px 11px;
  color: var(--green-dark);
  border-color: rgba(40, 97, 74, 0.24);
  background: #f8fbf5;
}

.danger-button {
  color: #8b2f23;
}

.open-link {
  color: var(--blue);
  font-weight: 800;
  text-decoration: none;
}

.open-link:hover {
  text-decoration: underline;
}

.empty-state {
  display: grid;
  min-height: 145px;
  place-items: center;
  gap: 6px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 24px;
  color: var(--muted);
  text-align: center;
  background: rgba(255, 250, 240, 0.6);
}

.empty-state strong {
  color: var(--ink);
}

@media (max-width: 860px) {
  .login-panel {
    grid-template-columns: 1fr;
  }

  .login-copy {
    min-height: 300px;
    padding: 32px;
  }

  .hero-content,
  .toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .hero-actions {
    justify-content: flex-start;
  }

  .entry-form {
    grid-template-columns: 1fr 1fr;
  }

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

@media (max-width: 560px) {
  :root {
    --page-gutter: 14px;
  }

  body {
    background: var(--bg);
  }

  .login-shell {
    min-height: 100svh;
    padding:
      max(12px, env(safe-area-inset-top))
      12px
      max(12px, env(safe-area-inset-bottom));
    place-items: stretch;
  }

  .login-panel {
    align-self: center;
  }

  .login-form {
    gap: 14px;
    padding: 22px;
  }

  .login-copy {
    min-height: 250px;
    padding: 26px 22px;
    background-position: center;
  }

  .login-copy h1,
  .hero h1 {
    font-size: 2.45rem;
    line-height: 1;
  }

  .login-copy p:last-child,
  .hero p:last-child {
    margin-top: 12px;
    font-size: 1rem;
    line-height: 1.45;
  }

  .hero {
    min-height: 300px;
  }

  .hero-content {
    width: min(1180px, calc(100% - (var(--page-gutter) * 2)));
    padding: max(34px, env(safe-area-inset-top)) 0 58px;
    justify-content: flex-end;
    gap: 14px;
  }

  .hero-actions,
  .ghost-button,
  .status-pill {
    width: 100%;
  }

  .status-pill,
  .ghost-button {
    justify-content: center;
  }

  .toolbar {
    margin-top: -40px;
    gap: 14px;
    padding: 14px;
  }

  .search-box {
    width: 100%;
  }

  .tabs {
    position: sticky;
    top: 0;
    z-index: 5;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px;
    margin-top: 12px;
    padding: 5px;
    overflow: visible;
    background: rgba(238, 243, 239, 0.96);
    backdrop-filter: blur(10px);
  }

  .tab-button {
    min-width: 0;
    min-height: 42px;
    padding: 9px 6px;
    font-size: 0.82rem;
  }

  .dashboard-section {
    padding: 16px 0 calc(34px + env(safe-area-inset-bottom));
  }

  .section-heading {
    gap: 8px;
    margin-bottom: 12px;
  }

  .section-heading h2 {
    font-size: 1.65rem;
  }

  .entry-form {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 14px;
  }

  .item-grid {
    grid-template-columns: 1fr;
    gap: 12px;
    margin-top: 12px;
  }

  .item-card {
    min-height: 0;
    padding: 14px;
  }

  .section-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .primary-button,
  .secondary-button,
  .ghost-button,
  .icon-button {
    min-height: 46px;
  }

  .card-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(92px, 1fr));
  }
}

@media (max-width: 380px) {
  :root {
    --page-gutter: 10px;
  }

  .login-copy h1,
  .hero h1 {
    font-size: 2.08rem;
  }

  .tab-button {
    font-size: 0.8rem;
  }

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

  .section-heading h2 {
    font-size: 1.48rem;
  }
}
