:root {
  --bg: #26231f;
  --surface: #322d27;
  --surface-2: #3b342c;
  --panel: #463c31;
  --line: #6f592d;
  --accent: #c4982e;
  --accent-strong: #e0b64a;
  --text: #f1ddb0;
  --muted: #bfa779;
  --danger: #d47d63;
  --success: #9caf6b;
  --shadow: 0 18px 42px rgba(0, 0, 0, .24);
  --radius: 18px;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(196, 152, 46, .18) 0, transparent 34%),
    linear-gradient(180deg, #1f1c19 0%, var(--bg) 100%);
  color: var(--text);
  font-family: "Segoe UI", Tahoma, sans-serif;
}

body.dialog-open {
  overflow: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

[hidden],
.hidden {
  display: none !important;
}

[hidden] {
  display: none !important;
}

.app {
  max-width: 1160px;
  margin: 0 auto;
  padding: 16px;
  padding-bottom: 40px;
}

.app.narrow {
  max-width: 960px;
}

.hero {
  position: sticky;
  top: 0;
  z-index: 20;
  margin-bottom: 14px;
  padding: 12px;
  border-bottom-left-radius: 20px;
  border-bottom-right-radius: 20px;
  backdrop-filter: blur(12px);
  background: rgba(38, 35, 31, .88);
}

.hero-inner {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  flex-wrap: wrap;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  color: var(--accent-strong);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .14em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: clamp(28px, 5vw, 40px);
  line-height: 1;
  letter-spacing: -.05em;
}

h2 {
  font-size: clamp(22px, 3vw, 28px);
  line-height: 1.05;
  letter-spacing: -.03em;
}

h3 {
  font-size: 18px;
  line-height: 1.1;
  letter-spacing: -.03em;
}

.subtitle {
  margin-top: 9px;
  max-width: 720px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.hero-actions,
.toolbar,
.button-row,
.tag-row,
.section-actions,
.split-inline {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(111, 89, 45, .9);
  background: rgba(196, 152, 46, .18);
  color: var(--text);
  font-size: 11px;
  font-weight: 800;
}

.pill.highlight {
  background: rgba(196, 152, 46, .3);
  color: var(--accent-strong);
}

.card {
  margin-top: 12px;
  padding: 16px;
  border-radius: var(--radius);
  border: 1px solid rgba(111, 89, 45, .9);
  background: linear-gradient(180deg, rgba(59, 52, 44, .95) 0%, rgba(50, 45, 39, .98) 100%);
  box-shadow: var(--shadow);
}

.card.soft {
  background: rgba(34, 30, 26, .82);
}

.section-title {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.section-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.section-copy {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.page-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  align-items: start;
}

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

.row,
.row-3,
.stat-grid,
.feature-grid {
  display: grid;
  gap: 10px;
}

.row {
  grid-template-columns: 1fr;
}

.row-3 {
  grid-template-columns: 1fr;
}

.stat-grid {
  grid-template-columns: 1fr;
}

.feature-grid {
  grid-template-columns: 1fr;
}

.single-stack,
.action-grid,
.help-list {
  display: grid;
  gap: 10px;
}

.single-stack {
  margin-top: 12px;
}

.action-grid {
  grid-template-columns: 1fr;
}

.login-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  align-items: stretch;
}

.brand-panel {
  position: relative;
  overflow: hidden;
}

.brand-panel::before,
.brand-panel::after {
  content: "";
  position: absolute;
  border-radius: 999px;
  filter: blur(2px);
}

.brand-panel::before {
  top: -80px;
  right: -60px;
  width: 220px;
  height: 220px;
  background: radial-gradient(circle, rgba(196, 152, 46, .26), transparent 70%);
}

.brand-panel::after {
  bottom: -100px;
  left: -80px;
  width: 240px;
  height: 240px;
  background: radial-gradient(circle, rgba(224, 182, 74, .14), transparent 72%);
}

.brand-copy {
  position: relative;
  z-index: 1;
}

.brand-copy h2 {
  max-width: 520px;
}

.brand-copy .subtitle {
  max-width: 540px;
}

.highlight-box {
  margin-top: 18px;
  padding: 16px;
  border-radius: 18px;
  border: 1px solid rgba(111, 89, 45, .82);
  background: rgba(34, 30, 26, .72);
}

.highlight-box strong {
  display: block;
  font-size: 15px;
  letter-spacing: -.02em;
}

.highlight-box p {
  margin-top: 7px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.mini-stat {
  padding: 14px;
  border-radius: 16px;
  border: 1px solid rgba(111, 89, 45, .82);
  background: rgba(34, 30, 26, .8);
}

.mini-stat strong {
  display: block;
  font-size: 24px;
  line-height: 1;
  color: var(--accent-strong);
}

.mini-stat span {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

label {
  display: block;
  margin: 12px 0 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
}

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

input,
textarea,
select {
  width: 100%;
  padding: 11px 12px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(34, 30, 26, .96);
  color: var(--text);
  outline: none;
  transition: border-color .18s ease, box-shadow .18s ease;
}

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

input:focus,
textarea:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(196, 152, 46, .16);
}

.input-with-action {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  align-items: end;
}

.input-inline-clear {
  position: relative;
}

.input-inline-clear input {
  padding-right: 48px;
}

.input-clear-button {
  position: absolute;
  top: 50%;
  right: 10px;
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid rgba(255, 193, 69, .4);
  background: rgba(196, 152, 46, .12);
  color: var(--accent-strong);
  transform: translateY(-50%);
}

.input-clear-button:hover,
.input-clear-button:focus-visible {
  background: rgba(196, 152, 46, .22);
  border-color: rgba(255, 193, 69, .72);
}

.input-clear-button:active {
  transform: translateY(-50%) scale(.98);
}

button,
.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 12px;
  border: 0;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 800;
  letter-spacing: .01em;
  transition: transform .12s ease, opacity .12s ease, background .12s ease, border-color .12s ease;
}

button:active,
.button-link:active {
  transform: scale(.98);
}

.primary {
  background: var(--accent);
  color: #2a2418;
}

.secondary {
  background: rgba(196, 152, 46, .18);
  color: var(--accent-strong);
}

.outline {
  background: rgba(196, 152, 46, 0);
  color: var(--text);
  border: 1px solid rgba(255, 193, 69, .76);
}

.danger {
  background: rgba(212, 125, 99, .12);
  color: #f1b49f;
}

.wide {
  width: 100%;
}

.tiny {
  padding: 7px 10px;
  font-size: 11px;
  border-radius: 10px;
}

.notice {
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(111, 89, 45, .82);
  background: rgba(34, 30, 26, .72);
  color: var(--text);
  font-size: 13px;
  line-height: 1.55;
}

.notice.success {
  border-color: rgba(156, 175, 107, .5);
  background: linear-gradient(180deg, rgba(54, 78, 41, .72) 0%, rgba(34, 46, 28, .92) 100%);
}

.notice.warn {
  border-color: rgba(212, 125, 99, .42);
  background: linear-gradient(180deg, rgba(91, 45, 37, .72) 0%, rgba(58, 28, 25, .92) 100%);
}

.hint {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.stat-card {
  padding: 14px;
  border-radius: 16px;
  border: 1px solid rgba(111, 89, 45, .82);
  background: rgba(34, 30, 26, .84);
}

.stat-value {
  font-size: clamp(26px, 4vw, 34px);
  font-weight: 900;
  line-height: 1;
  color: var(--accent-strong);
}

.stat-label {
  margin-top: 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.record-list {
  display: grid;
  gap: 10px;
}

.record {
  padding: 14px;
  border-radius: 16px;
  border: 1px solid rgba(111, 89, 45, .82);
  background: rgba(34, 30, 26, .84);
}

.record.done {
  border-color: rgba(196, 152, 46, .82);
  background: rgba(196, 152, 46, .1);
}

.record-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
}

.record-title {
  font-size: 16px;
  font-weight: 900;
  letter-spacing: -.02em;
}

.record-meta {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.record-footer {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 12px;
}

.tag {
  display: inline-flex;
  align-items: center;
  padding: 5px 8px;
  border-radius: 999px;
  background: rgba(196, 152, 46, .16);
  color: var(--accent-strong);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.tag.empty {
  background: rgba(255, 255, 255, .06);
  color: var(--muted);
}

.empty {
  padding: 24px 14px;
  border-radius: 16px;
  border: 1px dashed rgba(111, 89, 45, .9);
  background: rgba(34, 30, 26, .66);
  color: var(--muted);
  text-align: center;
  line-height: 1.6;
}

.footer-note {
  margin-top: 16px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
  text-align: center;
}

.mono {
  font-family: Consolas, "Courier New", monospace;
}

.toast {
  position: fixed;
  top: max(60px, env(safe-area-inset-top, 0px) + 60px);
  right: max(16px, env(safe-area-inset-right, 0px) + 16px);
  z-index: 170;
  width: min(520px, calc(100vw - 32px));
  padding: 12px 14px;
  border-radius: 14px;
  background: #181614;
  color: var(--text);
  border: 1px solid rgba(111, 89, 45, .9);
  box-shadow: var(--shadow);
  font-size: 13px;
  font-weight: 800;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-16px);
  transition: transform .18s ease, opacity .18s ease;
}

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

.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 130;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(0, 0, 0, .38);
  backdrop-filter: blur(8px);
}

.loading-overlay.show {
  display: flex;
}

.loading-box {
  width: min(100%, 280px);
  padding: 18px;
  border-radius: 20px;
  border: 1px solid rgba(111, 89, 45, .9);
  background: rgba(38, 35, 31, .98);
  text-align: center;
  box-shadow: var(--shadow);
}

.spinner {
  width: 38px;
  height: 38px;
  margin: 0 auto 12px;
  border-radius: 50%;
  border: 4px solid rgba(196, 152, 46, .22);
  border-top-color: var(--accent);
  animation: spin .85s linear infinite;
}

.loading-title {
  font-size: 15px;
  font-weight: 900;
}

.loading-subtitle {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.hidden-transport {
  position: absolute;
  width: 0;
  height: 0;
  opacity: 0;
  pointer-events: none;
}

.save-indicator {
  position: fixed;
  top: max(112px, env(safe-area-inset-top, 0px) + 112px);
  right: max(16px, env(safe-area-inset-right, 0px) + 16px);
  z-index: 171;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid rgba(111, 89, 45, .9);
  background: rgba(24, 22, 20, .96);
  color: var(--text);
  box-shadow: var(--shadow);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .03em;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-12px);
  transition: transform .18s ease, opacity .18s ease, background .18s ease, color .18s ease;
}

.save-indicator.show {
  opacity: 1;
  transform: translateY(0);
}

.save-indicator.active {
  background: rgba(196, 152, 46, .16);
  color: var(--accent-strong);
}

.save-indicator.done {
  background: rgba(54, 78, 41, .92);
  color: #edf7d0;
}

.dialog-overlay {
  position: fixed;
  inset: 0;
  z-index: 148;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(10, 10, 10, .54);
  backdrop-filter: blur(8px);
}

.dialog-overlay.show {
  display: flex;
}

.dialog-card {
  width: min(100%, 720px);
  max-height: min(88vh, 920px);
  overflow: auto;
  padding: 20px;
  border-radius: 22px;
  border: 1px solid rgba(111, 89, 45, .9);
  background: linear-gradient(180deg, rgba(59, 52, 44, .98) 0%, rgba(38, 35, 31, .98) 100%);
  box-shadow: var(--shadow);
}

.dialog-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 12px;
}

.pager {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.page-btn {
  min-width: 40px;
  min-height: 40px;
  border: 1px solid var(--line);
  background: rgba(34, 30, 26, .84);
  color: var(--text);
}

.page-btn.active {
  background: rgba(196, 152, 46, .24);
  border-color: var(--accent);
  color: var(--accent-strong);
}

.help-toggle-btn {
  position: fixed;
  top: max(12px, env(safe-area-inset-top, 0px) + 12px);
  right: max(12px, env(safe-area-inset-right, 0px) + 12px);
  z-index: 150;
  width: 42px;
  height: 42px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid rgba(111, 89, 45, .9);
  background: rgba(24, 22, 20, .94);
  color: var(--accent-strong);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  font-size: 22px;
  font-weight: 900;
  line-height: 1;
}

.help-toggle-btn.active {
  background: var(--accent);
  color: #2a2418;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@media (max-width: 920px) {
  .page-grid,
  .login-grid,
  .stat-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 700px) {
  .row,
  .row-3,
  .feature-grid,
  .action-grid {
    grid-template-columns: 1fr;
  }

  .hero {
    border-radius: 0 0 18px 18px;
  }

  .app {
    padding: 12px;
    padding-bottom: 28px;
  }

  .input-with-action {
    grid-template-columns: 1fr;
  }
}
