:root {
  --ink: #18302d;
  --muted: #61726f;
  --line: #dce6e3;
  --paper: #ffffff;
  --canvas: #f4f7f6;
  --green-950: #063b35;
  --green-800: #0b5f54;
  --green-650: #158274;
  --green-100: #ddf3ee;
  --amber: #e8a01d;
  --amber-soft: #fff3d8;
  --red: #b73e45;
  --red-soft: #fdebed;
  --shadow: 0 16px 42px rgba(13, 55, 49, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--canvas);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--canvas); }
body { margin: 0; min-height: 100vh; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.login-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(320px, 0.9fr) minmax(420px, 1.1fr);
  background: var(--paper);
}

.login-brand {
  padding: clamp(2rem, 6vw, 5.5rem);
  color: white;
  background:
    radial-gradient(circle at 10% 85%, rgba(39, 181, 155, .38), transparent 34%),
    linear-gradient(145deg, #052f2b 0%, #075348 58%, #0a7868 100%);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}
.login-brand::after {
  content: "";
  width: 420px;
  height: 420px;
  position: absolute;
  right: -240px;
  top: -100px;
  border: 74px solid rgba(255,255,255,.06);
  border-radius: 50%;
}
.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border: 1px solid rgba(255,255,255,.4);
  border-radius: 14px;
  font-size: 1.25rem;
  font-weight: 800;
  background: rgba(255,255,255,.1);
  backdrop-filter: blur(8px);
}
.brand-lockup { display: flex; align-items: center; gap: .9rem; font-weight: 700; letter-spacing: -.01em; }
.login-copy { max-width: 540px; position: relative; z-index: 1; }
.eyebrow { font-size: .74rem; letter-spacing: .14em; text-transform: uppercase; font-weight: 800; color: var(--green-650); }
.login-brand .eyebrow { color: #9fe3d5; }
.login-copy h1 { font-size: clamp(2.5rem, 5vw, 4.8rem); line-height: .98; letter-spacing: -.055em; margin: 1rem 0 1.25rem; }
.login-copy p { font-size: 1.06rem; line-height: 1.7; color: rgba(255,255,255,.76); max-width: 480px; }
.login-foot { color: rgba(255,255,255,.6); font-size: .84rem; }
.login-panel { display: grid; place-items: center; padding: 2rem; }
.login-box { width: min(420px, 100%); }
.login-box h2 { font-size: 2rem; letter-spacing: -.04em; margin: .65rem 0 .5rem; }
.login-box > p { color: var(--muted); margin: 0 0 2rem; line-height: 1.6; }

.field { display: grid; gap: .48rem; margin-bottom: 1rem; }
.field label { font-size: .82rem; font-weight: 750; color: #38504c; }
.field input, .field select, .field textarea, .input {
  width: 100%;
  border: 1px solid #cfdcd9;
  border-radius: 11px;
  background: white;
  color: var(--ink);
  padding: .82rem .9rem;
  outline: none;
  transition: border .15s, box-shadow .15s;
}
.field textarea { min-height: 100px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus, .input:focus {
  border-color: var(--green-650);
  box-shadow: 0 0 0 3px rgba(21,130,116,.12);
}
.help { color: var(--muted); font-size: .78rem; line-height: 1.5; }

.button {
  appearance: none;
  border: 0;
  border-radius: 10px;
  min-height: 42px;
  padding: .72rem 1rem;
  font-weight: 760;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  transition: transform .15s, background .15s, opacity .15s;
}
.button:hover { transform: translateY(-1px); }
.button:disabled { opacity: .55; cursor: wait; transform: none; }
.button-primary { background: var(--green-800); color: white; }
.button-primary:hover { background: var(--green-950); }
.button-secondary { background: var(--green-100); color: var(--green-800); }
.button-ghost { background: transparent; border: 1px solid var(--line); color: var(--ink); }
.button-danger { background: var(--red-soft); color: var(--red); }
.button-block { width: 100%; }
.error-box, .success-box { padding: .8rem .9rem; border-radius: 10px; margin: .75rem 0; font-size: .86rem; line-height: 1.45; }
.error-box { color: #842f35; background: var(--red-soft); border: 1px solid #f1c8cc; }
.success-box { color: #075c50; background: var(--green-100); border: 1px solid #b9e3da; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 248px 1fr; }
.sidebar {
  background: var(--green-950);
  color: white;
  padding: 1.4rem 1rem;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.sidebar .brand-lockup { padding: .3rem .45rem 1.6rem; }
.nav-label { color: rgba(255,255,255,.45); font-size: .66rem; text-transform: uppercase; letter-spacing: .14em; font-weight: 800; margin: 1.1rem .7rem .45rem; }
.nav { display: grid; gap: .22rem; }
.nav a { display: flex; gap: .72rem; align-items: center; padding: .72rem .78rem; border-radius: 9px; color: rgba(255,255,255,.72); font-size: .88rem; font-weight: 620; }
.nav a:hover { color: white; background: rgba(255,255,255,.08); }
.nav-icon { width: 20px; text-align: center; opacity: .8; }
.sidebar-user { margin-top: auto; border-top: 1px solid rgba(255,255,255,.12); padding: 1rem .5rem 0; }
.sidebar-user strong { display: block; font-size: .84rem; }
.sidebar-user span { display: block; color: rgba(255,255,255,.55); font-size: .72rem; margin-top: .2rem; }
.logout-button { margin-top: .8rem; color: rgba(255,255,255,.68); background: none; border: 0; padding: 0; font-size: .76rem; }

.main { min-width: 0; }
.topbar { height: 70px; background: rgba(255,255,255,.92); border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; padding: 0 clamp(1rem, 3vw, 2.5rem); position: sticky; top: 0; z-index: 5; backdrop-filter: blur(12px); }
.topbar-title { font-weight: 780; letter-spacing: -.02em; }
.topbar-context { font-size: .76rem; color: var(--muted); }
.content { padding: clamp(1.2rem, 3vw, 2.5rem); max-width: 1500px; margin: 0 auto; }
.page-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; margin-bottom: 1.6rem; }
.page-heading h1 { margin: .3rem 0 0; font-size: clamp(1.75rem, 3vw, 2.6rem); letter-spacing: -.045em; }
.page-heading p { color: var(--muted); margin: .45rem 0 0; }

.lot-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.lot-card { background: var(--paper); border: 1px solid var(--line); border-radius: 16px; padding: 1.25rem; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.lot-card::after { content: ""; position: absolute; right: -32px; top: -34px; width: 110px; height: 110px; border-radius: 50%; background: var(--green-100); opacity: .6; }
.lot-card-head { display: flex; justify-content: space-between; gap: .8rem; position: relative; z-index: 1; }
.lot-number { font-weight: 820; font-size: 1.05rem; }
.tag { display: inline-flex; align-items: center; border-radius: 999px; padding: .28rem .55rem; background: #edf3f1; color: #516662; font-size: .66rem; font-weight: 750; }
.tag-green { background: var(--green-100); color: var(--green-800); }
.tag-amber { background: var(--amber-soft); color: #8d5a00; }
.next-label { color: var(--muted); font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 760; margin: 1.4rem 0 .45rem; }
.next-name { font-size: 1.22rem; line-height: 1.25; font-weight: 820; letter-spacing: -.025em; min-height: 3rem; }
.lot-meta { display: flex; justify-content: space-between; align-items: center; margin-top: 1.25rem; padding-top: .9rem; border-top: 1px solid var(--line); color: var(--muted); font-size: .75rem; }

.section { margin-top: 1.6rem; }
.section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: .8rem; }
.section-head h2 { margin: 0; font-size: 1.08rem; letter-spacing: -.025em; }
.text-link { color: var(--green-800); font-size: .78rem; font-weight: 740; }
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 8px 26px rgba(13,55,49,.05); }
.panel-pad { padding: 1.25rem; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; color: var(--muted); font-size: .68rem; text-transform: uppercase; letter-spacing: .06em; font-weight: 780; padding: .82rem 1rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: .88rem 1rem; border-bottom: 1px solid #edf1f0; font-size: .82rem; vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
.cell-title { font-weight: 740; color: var(--ink); }
.cell-sub { display: block; color: var(--muted); font-size: .7rem; margin-top: .18rem; }
.empty { text-align: center; padding: 3rem 1rem; color: var(--muted); }

.form-layout { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(270px, .75fr); gap: 1rem; align-items: start; }
.form-section { padding: 1.25rem; }
.form-section h2 { font-size: 1rem; margin: 0 0 1.1rem; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
.vehicle-list { display: grid; gap: .55rem; max-height: 320px; overflow: auto; padding-right: .2rem; }
.vehicle-option { border: 1px solid var(--line); background: white; border-radius: 10px; padding: .75rem; text-align: left; width: 100%; color: var(--ink); }
.vehicle-option:hover, .vehicle-option.selected { border-color: var(--green-650); background: #f1faf7; }
.vehicle-option strong { display: block; font-size: .8rem; }
.vehicle-option span { color: var(--muted); font-size: .7rem; }
.summary-list { display: grid; gap: .75rem; }
.summary-item { display: flex; justify-content: space-between; gap: 1rem; font-size: .78rem; }
.summary-item span:first-child { color: var(--muted); }
.summary-item strong { text-align: right; }
.notice { border-left: 3px solid var(--amber); background: var(--amber-soft); color: #6e4a0c; padding: .8rem .9rem; font-size: .76rem; line-height: 1.5; border-radius: 0 8px 8px 0; }

.stats-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .75rem; }
.stat { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 1rem; }
.stat span { color: var(--muted); font-size: .7rem; }
.stat strong { display: block; font-size: 1.55rem; letter-spacing: -.04em; margin-top: .25rem; }
.admin-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 1rem; }
.audit-entry { padding: .8rem 0; border-bottom: 1px solid var(--line); font-size: .78rem; }
.audit-entry:last-child { border: 0; }
.audit-entry p { margin: .2rem 0; }
.audit-entry time { color: var(--muted); font-size: .68rem; }

.mobile-nav { display: none; }

@media (max-width: 1050px) {
  .lot-grid { grid-template-columns: 1fr 1fr; }
  .lot-card:last-child { grid-column: 1 / -1; }
  .form-layout { grid-template-columns: 1fr; }
  .stats-row { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 760px) {
  .login-page { grid-template-columns: 1fr; }
  .login-brand { min-height: 300px; padding: 2rem; }
  .login-copy h1 { font-size: 2.7rem; }
  .login-foot { display: none; }
  .app-shell { display: block; padding-bottom: 64px; }
  .sidebar { display: none; }
  .mobile-nav { display: grid; grid-template-columns: repeat(4,1fr); position: fixed; bottom: 0; left: 0; right: 0; z-index: 20; background: white; border-top: 1px solid var(--line); box-shadow: 0 -8px 24px rgba(13,55,49,.08); }
  .mobile-nav a { padding: .7rem .3rem; text-align: center; color: var(--muted); font-size: .65rem; }
  .mobile-nav span { display: block; font-size: 1rem; margin-bottom: .15rem; }
  .topbar { height: 58px; }
  .content { padding: 1rem; }
  .page-heading { align-items: flex-start; flex-direction: column; }
  .page-heading .button { width: 100%; }
  .lot-grid { grid-template-columns: 1fr; }
  .lot-card:last-child { grid-column: auto; }
  .form-grid, .admin-grid { grid-template-columns: 1fr; }
  .stats-row { grid-template-columns: 1fr 1fr; }
}
