:root {
    --ink: #11211f;
    --muted: #66736f;
    --paper: #fafbfa;
    --surface: #ffffff;
    --line: #d8e0dc;
    --brand: #0d5c52;
    --brand-dark: #08433c;
    --accent: #b58b45;
    --danger: #a43a3a;
    --radius: 14px;
    color: var(--ink);
    font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-synthesis: none;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); }
a { color: var(--brand); text-decoration: none; }
h1, h2, p { margin-top: 0; }
h1 { font-size: clamp(2rem, 5vw, 4.5rem); letter-spacing: -0.045em; line-height: 1.02; }
h2 { font-size: 1.12rem; }
.muted, small { color: var(--muted); }
.brand { align-items: center; display: inline-flex; }
.brand-logo { display: block; height: auto; width: 160px; }
.sidebar .brand-logo { width: 154px; }
.eyebrow { color: var(--accent); display: block; font-size: .72rem; font-weight: 800; letter-spacing: .15em; margin-bottom: .75rem; }
.button, button { align-items: center; background: var(--brand); border: 0; border-radius: 9px; color: white; cursor: pointer; display: inline-flex; font: inherit; font-weight: 700; justify-content: center; min-height: 44px; padding: .7rem 1.05rem; }
.button:hover, button:hover { background: var(--brand-dark); }
.button-quiet { background: transparent; border: 1px solid var(--line); color: var(--ink); }
.button-block { width: 100%; }
.text-link { background: none; color: var(--brand); font-weight: 700; padding: 0; }

.public-header { align-items: center; display: flex; justify-content: space-between; margin: auto; max-width: 1240px; padding: 1.5rem 2rem; }
.hero { align-items: center; display: grid; gap: 4rem; grid-template-columns: 1.15fr .85fr; margin: auto; max-width: 1240px; min-height: 68vh; padding: 4rem 2rem; }
.hero-copy p { color: var(--muted); font-size: 1.2rem; line-height: 1.7; max-width: 660px; }
.lifecycle-card { background: var(--ink); border-radius: 26px; box-shadow: 0 28px 70px rgba(19,33,31,.18); color: white; display: grid; gap: .75rem; padding: 2.5rem; }
.lifecycle-card span { border: 1px solid rgba(255,255,255,.18); border-radius: 9px; padding: .75rem 1rem; }
.lifecycle-card i { color: var(--accent); font-style: normal; text-align: center; transform: rotate(90deg); }
.feature-grid { display: grid; gap: 1px; grid-template-columns: repeat(3, 1fr); margin: auto; max-width: 1240px; padding: 0 2rem 5rem; }
.feature-grid article { background: var(--surface); border: 1px solid var(--line); min-height: 230px; padding: 2rem; }
.feature-grid article span { color: var(--accent); font-weight: 800; }
.feature-grid p { color: var(--muted); line-height: 1.65; }

.auth-page { min-height: 100vh; }
.auth-shell { margin: auto; max-width: 470px; padding: 10vh 1.5rem; }
.auth-shell > .brand { display: inline-block; margin-bottom: 2rem; }
.auth-card, .form-card, .content-card, .table-card, .metric-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 10px 30px rgba(19,33,31,.04); }
.auth-card, .form-card, .content-card { padding: 1.6rem; }
.auth-card h1 { font-size: 2rem; }

form .input { margin-bottom: 1rem; }
label, legend { display: block; font-size: .82rem; font-weight: 750; margin-bottom: .42rem; }
input, select, textarea { background: white; border: 1px solid #cbd5d1; border-radius: 8px; color: var(--ink); font: inherit; min-height: 44px; padding: .65rem .75rem; width: 100%; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(13,92,82,.14); outline: none; }
input[type="checkbox"] { min-height: auto; width: auto; }
fieldset { border: 1px solid var(--line); border-radius: 10px; margin: 0 0 1.25rem; padding: 1rem; }
.checkbox label { display: inline; margin-left: .45rem; }
.error-message, .error { color: var(--danger); font-size: .82rem; }
.message { border: 1px solid var(--line); border-left: 4px solid var(--brand); border-radius: 8px; margin-bottom: 1rem; overflow-wrap: anywhere; padding: .8rem 1rem; }
.message.error { border-left-color: var(--danger); }

.panel-shell { display: grid; grid-template-columns: 250px minmax(0, 1fr); min-height: 100vh; }
.sidebar { background: var(--ink); color: white; padding: 1.6rem 1.25rem; }
.sidebar-kicker { color: #9bb0aa; display: block; font-size: .68rem; letter-spacing: .12em; margin: .65rem 0 2rem; text-transform: uppercase; }
.sidebar-nav { display: grid; gap: .35rem; }
.sidebar-nav a { border-radius: 8px; color: #bed0cb; padding: .72rem .8rem; }
.sidebar-nav a:hover, .sidebar-nav a.is-active { background: rgba(255,255,255,.09); color: white; }
.panel-main { min-width: 0; }
.topbar { align-items: center; background: var(--surface); border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; min-height: 68px; padding: .8rem 1.5rem; }
.topbar strong, .topbar span { display: block; }
.topbar-actions { align-items: center; display: flex; gap: 1.25rem; }
.panel-content { margin: auto; max-width: 1440px; padding: 2rem; }
.page-heading { align-items: flex-start; display: flex; gap: 1.5rem; justify-content: space-between; margin-bottom: 1.5rem; }
.page-heading h1 { font-size: clamp(2rem, 4vw, 3.2rem); margin-bottom: .4rem; }
.page-heading p { color: var(--muted); max-width: 720px; }
.heading-actions { display: flex; flex-wrap: wrap; gap: .65rem; }
.metric-grid, .detail-grid, .form-grid { display: grid; gap: 1rem; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.metric-grid { margin-bottom: 1.5rem; }
.metric-card { padding: 1.3rem; }
.metric-card span { color: var(--muted); display: block; font-size: .82rem; margin-bottom: .55rem; }
.metric-card strong { font-size: 2rem; }
.detail-grid { grid-template-columns: 1fr 1fr; margin-bottom: 1rem; }
.content-card { margin-bottom: 1rem; }
.table-card { overflow: auto; }
table { border-collapse: collapse; width: 100%; }
th, td { border-bottom: 1px solid var(--line); padding: .9rem 1rem; text-align: left; vertical-align: top; }
th { color: var(--muted); font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; }
tbody tr:last-child td { border-bottom: 0; }
.badge, .status { border-radius: 999px; display: inline-flex; font-size: .72rem; font-weight: 750; margin: .12rem .2rem .12rem 0; padding: .3rem .55rem; }
.badge { background: #eef2f0; color: var(--brand); }
.status { background: #edf0ef; color: var(--muted); }
.status-active { background: #e1f3eb; color: #176344; }
.status-pending, .status-invited { background: #fff4d9; color: #7c5b0d; }
.status-verified, .status-approved { background: #e1f3eb; color: #176344; }
.status-declared { background: #e7eef8; color: #244a76; }
.status-rejected, .status-revoked { background: #f8e3e3; color: var(--danger); }
.status-reserved, .status-processing { background: #fff4d9; color: #7c5b0d; }
.status-draft, .status-open, .status-submitted, .status-partially_received { background: #e7eef8; color: #244a76; }
.status-confirmed, .status-reserved, .status-partially_delivered, .status-partially_paid { background: #fff4d9; color: #7c5b0d; }
.status-received, .status-posted, .status-paid, .status-delivered, .status-fulfilled { background: #e1f3eb; color: #176344; }
.status-cancelled, .status-failed, .status-refunded, .status-void { background: #f8e3e3; color: var(--danger); }
.status-partially_refunded { background: #fff0d7; color: #8a5700; }
.status-accepted, .status-diagnosing, .status-approved, .status-in_progress, .status-quality_control { background: #e7eef8; color: #244a76; }
.status-awaiting_approval, .status-ready, .status-returned_to_origin { background: #fff4d9; color: #7c5b0d; }
.status-completed { background: #e1f3eb; color: #176344; }
.status-declined { background: #f8e3e3; color: var(--danger); }
.status-suspended, .status-disabled { background: #f8e3e3; color: var(--danger); }
.clean-list { list-style: none; margin: 0; padding: 0; }
.clean-list li { align-items: center; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; padding: .8rem 0; }
.clean-list li:last-child { border-bottom: 0; }
.empty-state { color: var(--muted); padding: 2rem; text-align: center; }
dl { display: grid; grid-template-columns: 120px 1fr; margin: 0; }
dt, dd { border-bottom: 1px solid var(--line); margin: 0; padding: .55rem 0; }
dt { color: var(--muted); }

@media (max-width: 900px) {
    .hero, .feature-grid, .metric-grid, .form-grid, .detail-grid { grid-template-columns: 1fr; }
    .hero { gap: 2rem; }
    .panel-shell { grid-template-columns: 1fr; }
    .sidebar { position: static; }
    .sidebar-nav { display: flex; flex-wrap: wrap; }
}
