:root {
  --bg: #f4f1eb;
  --surface: #fffdf9;
  --surface-strong: #ffffff;
  --text: #211d1a;
  --muted: #756c65;
  --border: #ddd6cc;
  --border-strong: #c9bfb3;
  --accent: #c94d1a;
  --accent-dark: #9f3510;
  --accent-soft: #f7e5db;
  --sage: #667c4f;
  --sage-soft: #e9eee2;
  --danger: #a6342b;
  --nav: #171b1a;
  --nav-muted: #a9b0ac;
  --shadow-sm: 0 1px 2px rgba(35, 27, 21, .05), 0 8px 24px rgba(35, 27, 21, .05);
  --shadow-lg: 0 24px 70px rgba(35, 27, 21, .12);
  --radius: 10px;
  --font: "Trebuchet MS", "Gill Sans", sans-serif;
  --font-display: Georgia, "Times New Roman", serif;
}

* { box-sizing: border-box; }

html { background: var(--bg); color: var(--text); }

body {
  min-width: 320px;
  background-color: var(--bg);
  background-image:
    linear-gradient(rgba(41, 34, 29, .025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(41, 34, 29, .025) 1px, transparent 1px);
  background-size: 42px 42px;
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
}

a { color: var(--accent-dark); text-underline-offset: 3px; }
a:hover { color: var(--accent); }

.nav {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 1000;
  display: flex;
  width: 248px;
  min-height: 100dvh;
  flex-direction: column;
  padding: 28px 18px 22px;
  background: var(--nav);
  color: #fff;
  box-shadow: 8px 0 32px rgba(14, 18, 17, .12);
}

.nav-brand {
  display: block;
  margin: 0 10px 34px;
  color: #fff;
  font-family: var(--font-display);
  font-size: 27px;
  line-height: 1;
  text-decoration: none;
  letter-spacing: -.7px;
}

.nav-brand span { color: #ed6b2f; }

.nav-right,
.nav-links {
  display: flex;
  min-height: 0;
  flex: 1;
  flex-direction: column;
}

.nav-project {
  display: block;
  margin: 0 8px 22px;
  padding: 0 8px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, .12);
}

.nav-project-label {
  display: block;
  margin-bottom: 4px;
  color: var(--nav-muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
}

.nav-project-name {
  display: block;
  overflow: hidden;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-link {
  display: flex;
  min-height: 44px;
  align-items: center;
  gap: 9px;
  margin: 2px 0;
  padding: 10px 13px;
  border: 0;
  border-radius: 7px;
  color: #d7dcda;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  transition: background-color .18s ease, color .18s ease, transform .18s ease;
}

.nav-link:hover,
.nav-link:focus-visible {
  background: rgba(255, 255, 255, .08);
  color: #fff;
  transform: translateX(2px);
}

.nav-link.active {
  background: #2b261f;
  color: #ff7a38;
  box-shadow: inset 3px 0 0 #ed621f;
}

.nav-links form { display: contents !important; }
.nav-links > .nav-link[style*="display:flex"] { margin-top: auto; }

.nav-toggle { display: none; }

main,
.site-footer { margin-left: 248px; }

main { min-height: calc(100dvh - 100px); }

.container {
  width: min(1180px, calc(100% - 64px));
  margin-inline: auto;
}

.page { padding-block: clamp(42px, 6vw, 76px); }

.page-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 34px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--border);
}

.page-title {
  color: var(--text);
  font-family: var(--font-display);
  font-size: clamp(32px, 4.2vw, 51px);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -1.5px;
}

.page-subtitle {
  margin-top: 8px;
  color: var(--muted);
  font-size: 15px;
}

.grid-2,
.grid-3 {
  display: grid;
  gap: 14px;
}

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

.card {
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(255, 253, 249, .94);
  box-shadow: var(--shadow-sm);
}

.grid-3 > .card {
  position: relative;
  min-height: 142px;
  padding: 24px 24px 20px;
  overflow: hidden;
}

.grid-3 > .card::after {
  position: absolute;
  inset: auto 0 0;
  height: 3px;
  background: var(--accent);
  content: "";
  transform: scaleX(.2);
  transform-origin: left;
  transition: transform .25s ease;
}

.grid-3 > .card:hover::after { transform: scaleX(1); }

.grid-3 > .card > div:last-child:not(.card-title) {
  margin-top: 14px;
  color: var(--text);
  font-family: var(--font-display);
  font-size: 38px;
  font-weight: 700;
  line-height: 1;
}

.card-title {
  margin-bottom: 18px;
  color: var(--text);
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  line-height: 1.25;
}

.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 14px;
}

.table th {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border-strong);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .75px;
  text-align: left;
  text-transform: uppercase;
}

.table td {
  padding: 16px;
  border-bottom: 1px solid var(--border);
  color: #3c342f;
  vertical-align: middle;
}

.table tbody tr { transition: background-color .16s ease; }
.table tbody tr:hover { background: #faf5ee; }
.table tbody tr:last-child td { border-bottom: 0; }

.form-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.form-group { margin-bottom: 19px; }

.form-label {
  display: block;
  margin-bottom: 7px;
  color: #39312c;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .2px;
}

.form-control {
  width: 100%;
  min-height: 45px;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  outline: 0;
  background: #fff;
  color: var(--text);
  font: 14px/1.4 var(--font);
  transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
}

textarea.form-control { min-height: 116px; resize: vertical; }

.form-control:hover { border-color: #a99d91; }
.form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(201, 77, 26, .13);
}

.form-hint,
.text-muted { color: var(--muted) !important; }

.form-check {
  display: flex;
  min-height: 38px;
  align-items: flex-start;
  gap: 10px;
}

.form-check input { accent-color: var(--accent); }

.btn {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border: 1px solid transparent;
  border-radius: 7px;
  font: 700 13px/1 var(--font);
  text-decoration: none;
  transition: transform .15s ease, box-shadow .15s ease, background-color .15s ease;
}

.btn:hover { transform: translateY(-1px); }
.btn:focus-visible { outline: 3px solid rgba(201, 77, 26, .25); outline-offset: 2px; }
.btn-rust { background: var(--accent); color: #fff; box-shadow: 0 7px 17px rgba(159, 53, 16, .18); }
.btn-rust:hover { background: var(--accent-dark); color: #fff; }
.btn-outline { border-color: var(--border-strong); background: #fff; color: var(--text); }
.btn-outline:hover { border-color: #9f9185; background: #f8f4ee; color: var(--text); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { min-height: 34px; padding: 8px 12px; font-size: 12px; }

.alert {
  margin-bottom: 20px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-left-width: 4px;
  border-radius: 7px;
  background: #fff;
}
.alert-success { border-left-color: var(--sage); background: var(--sage-soft); }
.alert-error { border-left-color: var(--danger); background: #f9e8e5; }
.alert-info { border-left-color: #56798b; background: #eaf1f4; }

.site-footer {
  padding: 30px 0;
  border-top: 1px solid var(--border);
  background: rgba(244, 241, 235, .88);
  color: var(--muted);
}

.site-footer__inner {
  display: flex;
  width: min(1180px, calc(100% - 64px));
  margin-inline: auto;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.site-footer__links { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.site-footer a { color: var(--muted); font-size: 12px; text-decoration: none; }
.site-footer a:hover { color: var(--accent-dark); }

@media (prefers-reduced-motion: no-preference) {
  .page-header,
  .grid-3 > .card,
  .page > .card {
    animation: rise-in .45s both;
  }
  .grid-3 > .card:nth-child(2) { animation-delay: .06s; }
  .grid-3 > .card:nth-child(3) { animation-delay: .12s; }
  @keyframes rise-in {
    from { opacity: 0; transform: translateY(9px); }
    to { opacity: 1; transform: translateY(0); }
  }
}

@media (max-width: 900px) {
  .nav {
    position: sticky;
    inset: 0;
    width: 100%;
    min-height: 66px;
    height: auto;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
  }
  .nav-brand { margin: 0; font-size: 24px; }
  .nav-toggle {
    display: grid;
    width: 42px;
    height: 38px;
    place-content: center;
    gap: 5px;
    border: 1px solid rgba(255, 255, 255, .18);
    border-radius: 7px;
    background: transparent;
  }
  .nav-toggle-bar { display: block; width: 19px; height: 2px; background: #fff; }
  .nav-right {
    position: absolute;
    inset: 66px 0 auto;
    display: none;
    max-height: calc(100dvh - 66px);
    overflow-y: auto;
    padding: 18px;
    background: var(--nav);
    box-shadow: var(--shadow-lg);
  }
  .nav-right.open { display: flex; }
  .nav-project { margin-bottom: 12px; }
  main,
  .site-footer { margin-left: 0; }
  .container { width: min(100% - 32px, 760px); }
  .page { padding-block: 34px 54px; }
  .page-title { font-size: clamp(30px, 9vw, 42px); }
  .grid-3 { grid-template-columns: 1fr; }
  .grid-3 > .card { min-height: 112px; }
  .site-footer__inner { width: calc(100% - 32px); align-items: flex-start; flex-direction: column; }
}

@media (max-width: 620px) {
  .grid-2,
  .form-row { grid-template-columns: 1fr; }
  .page-header { align-items: flex-start; flex-direction: column; }
  .card { padding: 19px; }
  .table { display: block; overflow-x: auto; }
  .flex.gap-1 { flex-wrap: wrap; }
  .btn { width: 100%; }
  .nav-link { min-height: 46px; }
}
