:root {
  --ink: #17231d;
  --muted: #66736d;
  --paper: #fbfaf6;
  --card: #fff;
  --line: #e4e7e2;
  --green: #12372a;
  --green2: #1f5c47;
  --mint: #dfeee7;
  --amber: #b66a15;
  --red: #aa3e35;
  --shadow: 0 12px 35px rgba(18, 55, 42, 0.09);
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    'Segoe UI',
    sans-serif;
  color: var(--ink);
  background: var(--paper);
}
button,
input,
select,
textarea {
  font: inherit;
}
button {
  cursor: pointer;
}
.hidden {
  display: none !important;
}
.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 20% 10%, #dfeee7, transparent 40%), var(--paper);
}
.login-card {
  width: min(420px, calc(100% - 32px));
  padding: 40px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: #fff;
  box-shadow: var(--shadow);
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: 16px;
  background: var(--green);
  color: #fff;
  font-weight: 800;
  letter-spacing: 0.08em;
}
.brand-mark.small {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  font-size: 13px;
}
.eyebrow {
  margin: 18px 0 4px;
  color: var(--green2);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-weight: 800;
}
.login-card h1,
header h1 {
  margin: 0;
}
.muted,
.form-note {
  color: var(--muted);
}
label {
  display: grid;
  gap: 7px;
  margin: 16px 0 0;
  font-size: 13px;
  font-weight: 700;
}
input,
select,
textarea {
  width: 100%;
  border: 1px solid #d7ddd8;
  border-radius: 10px;
  padding: 11px 12px;
  background: #fff;
  color: var(--ink);
  outline: none;
}
input:focus,
select:focus,
textarea:focus {
  border-color: var(--green2);
  box-shadow: 0 0 0 3px rgba(31, 92, 71, 0.12);
}
button.primary,
.primary {
  border: 0;
  border-radius: 10px;
  background: var(--green);
  color: #fff;
  padding: 12px 16px;
  font-weight: 750;
}
.login-card .primary {
  width: 100%;
  margin-top: 22px;
}
.app-shell {
  display: grid;
  grid-template-columns: 230px 1fr;
  min-height: 100vh;
}
aside {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px 18px;
  background: var(--green);
  color: #fff;
  display: flex;
  flex-direction: column;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 30px;
}
.sidebar-brand strong,
.sidebar-brand small {
  display: block;
}
.sidebar-brand small {
  opacity: 0.65;
  margin-top: 3px;
}
nav {
  display: grid;
  gap: 5px;
}
nav button,
.link-button {
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #d6e3dd;
  text-align: left;
  padding: 11px 13px;
}
nav button:hover,
nav button.active {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}
.link-button {
  margin-top: auto;
}
main {
  min-width: 0;
  padding: 32px clamp(22px, 4vw, 58px);
}
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 28px;
}
header .eyebrow {
  margin-top: 0;
}
.status-pill {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  background: #fff;
  color: var(--muted);
  font-size: 12px;
}
.status-pill span {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #38a169;
  margin-right: 6px;
}
.cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 19px;
  box-shadow: 0 3px 10px rgba(18, 55, 42, 0.025);
}
.metric small {
  display: block;
  color: var(--muted);
  margin-bottom: 8px;
}
.metric strong {
  font-size: 25px;
}
.section-card {
  margin-top: 20px;
}
.toolbar {
  display: flex;
  gap: 10px;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.toolbar h2 {
  margin: 0;
  font-size: 19px;
}
.toolbar-actions {
  display: flex;
  gap: 9px;
}
.secondary {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 9px;
  padding: 10px 13px;
  color: var(--ink);
  display: inline-block;
  font-weight: 650;
  text-decoration: none;
}
.danger {
  color: var(--red);
}
.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
}
table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  font-size: 13px;
}
th,
td {
  padding: 12px 13px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}
th {
  background: #f4f6f3;
  color: #526159;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
tr:last-child td {
  border-bottom: 0;
}
.badge {
  display: inline-block;
  border-radius: 999px;
  padding: 4px 8px;
  background: var(--mint);
  color: var(--green2);
  font-size: 11px;
  font-weight: 800;
}
.badge.warn {
  background: #fff0d8;
  color: var(--amber);
}
.badge.danger {
  background: #fbe4e1;
  color: var(--red);
}
.empty {
  padding: 32px;
  text-align: center;
  color: var(--muted);
}
.header-status {
  display: flex;
  align-items: center;
  gap: 9px;
}
.version-pill {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 10px;
  background: #fff;
  color: var(--green2);
  font-size: 11px;
  font-weight: 800;
}
.first-run {
  margin-bottom: 18px;
  padding: 24px;
  border: 1px solid #bdd8ca;
  background: linear-gradient(135deg, #f4fbf7, #fff);
}
.first-run h2 {
  margin: 12px 0 6px;
}
.first-run p {
  max-width: 780px;
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}
.first-run ol {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 28px;
  margin: 20px 0 0;
  padding-left: 20px;
  color: var(--muted);
  font-size: 13px;
}
.first-run-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 18px;
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 14px;
}
.form-grid .full {
  grid-column: 1/-1;
}
.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  margin-top: 22px;
}
.line-builder {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr auto;
  gap: 8px;
  align-items: end;
  margin: 18px 0;
}
.line-list {
  border: 1px solid var(--line);
  border-radius: 10px;
  margin-top: 12px;
}
.line-row {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  gap: 14px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  align-items: center;
}
.line-row:last-child {
  border-bottom: 0;
}
.icon-btn {
  border: 0;
  background: transparent;
  color: var(--red);
  font-size: 18px;
}
.totals {
  margin-left: auto;
  width: min(300px, 100%);
  display: grid;
  gap: 7px;
  margin-top: 15px;
}
.total-row {
  display: flex;
  justify-content: space-between;
}
.total-row.grand {
  font-weight: 800;
  font-size: 18px;
  border-top: 1px solid var(--line);
  padding-top: 9px;
}
dialog {
  border: 0;
  border-radius: 18px;
  padding: 0;
  width: min(760px, calc(100% - 30px));
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.25);
}
dialog::backdrop {
  background: rgba(13, 27, 21, 0.55);
}
#dialog-body {
  padding: 26px;
}
#dialog-body h2 {
  margin: 0 0 6px;
}
#toast {
  position: fixed;
  right: 24px;
  top: 22px;
  z-index: 10;
  max-width: 360px;
}
.toast {
  background: var(--green);
  color: #fff;
  padding: 12px 16px;
  border-radius: 10px;
  box-shadow: var(--shadow);
}
.toast.error {
  background: var(--red);
}
.notice {
  border-left: 4px solid var(--amber);
  background: #fff8ea;
  padding: 13px 15px;
  border-radius: 8px;
  color: #6e4a1d;
  margin-bottom: 18px;
}
.search {
  max-width: 290px;
}
.row-actions button,
.row-actions a {
  border: 0;
  background: transparent;
  color: var(--green2);
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
}
.detail-cards {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 18px 0;
}
.detail-cards .card {
  padding: 14px;
}
.detail-cards .metric strong {
  font-size: 18px;
}
.customer-profile {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin: 18px 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fafbf9;
}
.customer-profile h3 {
  margin: 0 0 10px;
}
.customer-profile p {
  margin: 6px 0;
  color: var(--muted);
}
dialog:has(.detail-cards),
dialog:has(.customer-profile) {
  width: min(1000px, calc(100% - 30px));
}
#settings-form {
  max-width: 900px;
}
@media (max-width: 900px) {
  .cards {
    grid-template-columns: repeat(2, 1fr);
  }
  .app-shell {
    grid-template-columns: 78px 1fr;
  }
  .sidebar-brand div,
  nav button {
    font-size: 0;
  }
  .sidebar-brand {
    justify-content: center;
  }
  nav button:before {
    font-size: 12px;
    content: attr(data-view);
    text-transform: capitalize;
  }
  .status-pill {
    display: none;
  }
}
@media (max-width: 620px) {
  main {
    padding: 20px 14px;
  }
  .app-shell {
    display: block;
  }
  aside {
    position: static;
    width: 100%;
    height: auto;
    display: block;
    padding: 12px;
  }
  .sidebar-brand {
    display: none;
  }
  nav {
    display: flex;
    overflow: auto;
  }
  nav button:before {
    content: none;
  }
  nav button {
    font-size: 12px;
    white-space: nowrap;
  }
  .link-button {
    display: none;
  }
  .cards {
    grid-template-columns: 1fr 1fr;
  }
  .first-run ol {
    grid-template-columns: 1fr;
  }
  .detail-cards,
  .customer-profile {
    grid-template-columns: 1fr;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
  .line-builder {
    grid-template-columns: 1fr 1fr;
  }
  .line-builder label:first-child {
    grid-column: 1/-1;
  }
  header {
    margin-top: 12px;
  }
}
