:root {
  --ink: #1a2421;
  --ink-soft: #3d4a45;
  --muted: #6b7872;
  --paper: #f3f0e8;
  --paper-2: #e8e4d8;
  --leaf: #1f6b4a;
  --leaf-deep: #134832;
  --accent: #c45c26;
  --line: rgba(26, 36, 33, 0.12);
  --ok: #1f6b4a;
  --danger: #9b2c2c;
  --shadow: 0 18px 50px rgba(26, 36, 33, 0.08);
  --radius: 14px;
  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Source Sans 3", "Segoe UI", sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 17px;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--font-body);
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(31, 107, 74, 0.14), transparent 55%),
    radial-gradient(900px 500px at 100% 0%, rgba(196, 92, 38, 0.12), transparent 50%),
    linear-gradient(180deg, #f7f4ec 0%, var(--paper) 40%, #ebe6da 100%);
}

a {
  color: var(--leaf-deep);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

a:hover {
  color: var(--accent);
}

.shell {
  width: min(1080px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1.25rem 0 3rem;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 2rem;
}

.brand {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.35rem;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-decoration: none;
}

.brand span {
  color: var(--leaf);
}

.nav {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  color: var(--ink-soft);
  font-size: 0.95rem;
}

.hero-title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 2.8rem);
  line-height: 1.1;
  letter-spacing: -0.03em;
  margin: 0 0 0.5rem;
}

.lead {
  color: var(--ink-soft);
  max-width: 42rem;
  margin: 0 0 1.75rem;
  line-height: 1.5;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}

.card {
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-height: 210px;
}

.card h2 {
  font-family: var(--font-display);
  font-size: 1.35rem;
  margin: 0;
}

.card p {
  margin: 0;
  color: var(--ink-soft);
  flex: 1;
}

.meta {
  font-size: 0.85rem;
  color: var(--muted);
}

.btn,
button.btn {
  appearance: none;
  border: none;
  border-radius: 999px;
  padding: 0.65rem 1.1rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  background: var(--leaf);
  color: #fff;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
}

.btn:hover {
  background: var(--leaf-deep);
  color: #fff;
}

.btn-secondary {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.7);
  color: var(--ink);
}

.btn-danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid rgba(155, 44, 44, 0.35);
}

.btn-danger:hover {
  background: rgba(155, 44, 44, 0.08);
  color: var(--danger);
}

.panel {
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem 1.4rem;
  box-shadow: var(--shadow);
}

.panel + .panel {
  margin-top: 1rem;
}

.auth-wrap {
  width: min(440px, 100%);
  margin: 2rem auto 0;
}

.form-stack {
  display: grid;
  gap: 0.9rem;
}

label {
  display: grid;
  gap: 0.35rem;
  font-weight: 600;
  color: var(--ink-soft);
}

.hint {
  font-weight: 400;
  font-size: 0.85rem;
  color: var(--muted);
}

.input,
textarea.input,
input.input,
select.input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.7rem 0.85rem;
  font: inherit;
  background: rgba(255, 255, 255, 0.85);
  color: var(--ink);
}

textarea.input {
  min-height: 8rem;
  resize: vertical;
  line-height: 1.45;
}

.input:focus,
textarea.input:focus {
  outline: 2px solid rgba(31, 107, 74, 0.35);
  border-color: var(--leaf);
}

.errorlist {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--danger);
  font-size: 0.9rem;
}

.messages {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
}

.messages li {
  padding: 0.75rem 1rem;
  border-radius: 10px;
  background: rgba(31, 107, 74, 0.12);
  color: var(--leaf-deep);
  margin-bottom: 0.5rem;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.save-status {
  min-height: 1.4rem;
  font-size: 0.9rem;
  color: var(--ok);
}

.save-status.is-error {
  color: var(--danger);
}

.field-grid {
  display: grid;
  gap: 1rem;
}

.plan-block {
  border-top: 1px solid var(--line);
  padding-top: 1.1rem;
  margin-top: 1.1rem;
}

.plan-block:first-child {
  border-top: none;
  padding-top: 0;
  margin-top: 0;
}

.gauges {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
}

.version-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.55rem;
}

.version-list li {
  display: grid;
  gap: 0.55rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--line);
}

.version-list li:last-child {
  border-bottom: none;
}

.layout-split {
  display: grid;
  grid-template-columns: 1.7fr 0.9fr;
  gap: 1rem;
}

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

  .site-header {
    flex-direction: column;
    align-items: flex-start;
  }
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th,
.table td {
  text-align: left;
  padding: 0.65rem 0.4rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.table th {
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 600;
}

.empty {
  color: var(--muted);
  font-style: italic;
}

.readonly-block {
  white-space: pre-wrap;
  line-height: 1.5;
  color: var(--ink-soft);
  background: rgba(255, 255, 255, 0.45);
  border-radius: 10px;
  padding: 0.85rem 1rem;
  border: 1px solid var(--line);
}

.footer-note {
  margin-top: 2.5rem;
  color: var(--muted);
  font-size: 0.85rem;
}

.hwlp-title {
  font-family: var(--font-display);
  font-size: 1.3rem;
  margin: 0;
  min-width: 5.5rem;
}

.hwlp-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.hwlp-row-readonly {
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--line);
}

.hwlp-readonly-list .hwlp-row-readonly:last-child {
  border-bottom: none;
}

.hwlp-hint {
  margin: 0.45rem 0 0.35rem;
}

.hwlp-stepper,
.hwlp-bar {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex: 1;
  min-width: 12rem;
}

.hwlp-bar-track {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.28rem;
  flex: 1;
  min-width: 9rem;
}

.hwlp-bar-seg {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--paper-2);
  height: 0.85rem;
  border-radius: 4px;
  padding: 0;
  margin: 0;
  display: block;
  width: 100%;
}

button.hwlp-bar-seg {
  cursor: pointer;
}

button.hwlp-bar-seg:hover {
  filter: brightness(0.97);
}

.hwlp-bar-seg.is-on {
  border-color: transparent;
  background: var(--hwlp-tone, var(--leaf));
}

.hwlp-level-1 { --hwlp-tone: #9b2c2c; }
.hwlp-level-2 { --hwlp-tone: #c45c26; }
.hwlp-level-3 { --hwlp-tone: #c4a026; }
.hwlp-level-4 { --hwlp-tone: #6b8f3a; }
.hwlp-level-5 { --hwlp-tone: #1f6b4a; }

.hwlp-bar-value {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--ink-soft);
  min-width: 2.4rem;
}

.hwlp-details {
  margin-top: 0.55rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.4);
  padding: 0.35rem 0.75rem 0.55rem;
}

.hwlp-details summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--ink-soft);
  padding: 0.35rem 0;
  list-style: none;
}

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

.hwlp-details summary::before {
  content: "▸ ";
  color: var(--muted);
}

.hwlp-details[open] summary::before {
  content: "▾ ";
}

.hwlp-details .input,
.hwlp-details .readonly-block {
  margin-top: 0.45rem;
}

.version-item {
  display: grid;
  gap: 0.55rem;
  align-items: start;
}

.version-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: start;
}

.version-edit {
  position: relative;
}

.version-edit > summary {
  list-style: none;
}

.version-edit > summary::-webkit-details-marker {
  display: none;
}

.version-edit-form {
  display: grid;
  gap: 0.4rem;
  margin-top: 0.4rem;
  min-width: 12rem;
}

.inline-rename {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}

.inline-rename .input {
  min-width: 12rem;
  width: auto;
}

.gauge-readout {
  display: inline-block;
  margin: 0.25rem 0 0.45rem;
  font-weight: 600;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}

.gauge-track {
  height: 0.55rem;
  border-radius: 999px;
  background: var(--paper-2);
  overflow: hidden;
  border: 1px solid var(--line);
}

.gauge-fill {
  height: 100%;
  border-radius: inherit;
  transition: width 120ms ease;
}

.gauge-fill.is-current {
  background: var(--leaf);
}

.gauge-fill.is-target {
  background: var(--accent);
}
