:root {
  --bg: #f0f3f1;
  --bg-elevated: #f7f9f7;
  --surface: #ffffff;
  --ink: #0e1c14;
  --ink-soft: #3d5246;
  --muted: #6b7c72;
  --line: #e2e8e3;
  --line-strong: #cfd8d2;
  --brand: #165c38;
  --brand-deep: #0a2f1d;
  --brand-mid: #1f7a4c;
  --brand-light: #2d9b62;
  --brand-tint: rgba(22, 92, 56, 0.07);
  --accent: #b8941f;
  --accent-soft: #f5edd4;
  --danger: #c0392b;
  --danger-bg: #fdf2f1;
  --warning: #b45309;
  --warning-bg: #fffbeb;
  --success: #0f766e;
  --success-bg: #ecfdf8;
  --info: #1d4ed8;
  --info-bg: #eff6ff;
  --shadow-xs: 0 1px 2px rgba(14, 28, 20, 0.04);
  --shadow-sm: 0 2px 8px rgba(14, 28, 20, 0.05);
  --shadow: 0 4px 20px rgba(14, 28, 20, 0.06);
  --shadow-lg: 0 16px 48px rgba(14, 28, 20, 0.1);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --sidebar: 264px;
  --topbar-h: 64px;
  --font-display: "Instrument Serif", "Fraunces", Georgia, serif;
  --font-body: "DM Sans", "Manrope", system-ui, sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-font-smoothing: antialiased; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
}
body.auth-body {
  background: #071f14;
}
body.auth-body::before {
  display: none;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  background:
    radial-gradient(ellipse 80% 50% at 100% -20%, rgba(22, 92, 56, 0.06), transparent 50%),
    radial-gradient(ellipse 60% 40% at 0% 100%, rgba(184, 148, 31, 0.04), transparent 45%),
    linear-gradient(180deg, #f5f7f5 0%, var(--bg) 100%);
}

a { color: var(--brand); text-decoration: none; transition: color .15s var(--ease); }
a:hover { color: var(--brand-deep); }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; }
code {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.84em;
  background: var(--bg-elevated);
  padding: 0.12em 0.4em;
  border-radius: 4px;
  color: var(--brand-deep);
}

/* ??? Shell ??? */
.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar) 1fr;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--brand-deep);
  color: #e6f0ea;
  overflow: hidden;
  z-index: 50;
}
.sidebar::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(165deg, rgba(31, 122, 76, 0.35) 0%, transparent 42%),
    radial-gradient(ellipse 80% 50% at 0% 100%, rgba(184, 148, 31, 0.12), transparent 50%);
  pointer-events: none;
}
.sidebar-inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 1.15rem 0.85rem 1rem;
  overflow: hidden;
}
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  margin: 0 -0.25rem;
  padding: 0 0.25rem 0.5rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.15) transparent;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.35rem 0.55rem 1.15rem;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  margin-bottom: 0.85rem;
  flex-shrink: 0;
  text-decoration: none;
  color: inherit;
}
.brand:hover { color: inherit; }
.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: linear-gradient(145deg, #d4b44a 0%, #b8941f 50%, #2d9b62 100%);
  display: grid;
  place-items: center;
  font-family: var(--font-body);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #0a2f1d;
  font-size: 0.95rem;
  box-shadow: 0 4px 14px rgba(0,0,0,0.25), inset 0 1px 0 rgba(255,255,255,0.35);
  flex-shrink: 0;
}
.brand-text strong {
  display: block;
  font-family: var(--font-body);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 1.15;
}
.brand-text span {
  font-size: 0.68rem;
  opacity: 0.55;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 500;
}

.nav-section {
  margin: 1rem 0 0.4rem;
  padding: 0 0.7rem;
  font-size: 0.65rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 600;
  color: rgba(230, 240, 234, 0.38);
}
.nav-section:first-child { margin-top: 0.15rem; }

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.55rem 0.75rem;
  margin-bottom: 2px;
  border-radius: 9px;
  color: rgba(230, 240, 234, 0.78);
  font-size: 0.88rem;
  font-weight: 500;
  transition: background .18s var(--ease), color .18s var(--ease), box-shadow .18s var(--ease);
  position: relative;
}
.nav-link:hover {
  background: rgba(255,255,255,0.07);
  color: #fff;
}
.nav-link.active {
  background: rgba(255,255,255,0.1);
  color: #fff;
  box-shadow: inset 3px 0 0 var(--accent);
}
.nav-link svg {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  opacity: 0.75;
  stroke-width: 1.75;
}
.nav-link.active svg, .nav-link:hover svg { opacity: 1; }

.sidebar-footer {
  flex-shrink: 0;
  padding-top: 0.85rem;
  margin-top: 0.5rem;
  border-top: 1px solid rgba(255,255,255,0.08);
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.5rem 0.55rem;
  border-radius: 10px;
  color: inherit;
  transition: background .15s;
}
.sidebar-user:hover { background: rgba(255,255,255,0.06); color: #fff; }
.sidebar-user img {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid rgba(255,255,255,0.2);
}
.sidebar-user strong { display: block; font-size: 0.82rem; font-weight: 600; line-height: 1.2; }
.sidebar-user small { font-size: 0.7rem; opacity: 0.55; }

/* ??? Main / Topbar ??? */
.main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0 1.5rem;
  background: rgba(255,255,255,0.88);
  backdrop-filter: blur(16px) saturate(1.2);
  border-bottom: 1px solid var(--line);
  box-shadow: var(--shadow-xs);
}

.search-form {
  flex: 1;
  max-width: 440px;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0 0.35rem 0 0.9rem;
  height: 40px;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.search-form:focus-within {
  border-color: rgba(22, 92, 56, 0.4);
  box-shadow: 0 0 0 3px rgba(22, 92, 56, 0.08);
  background: #fff;
}
.search-form svg { opacity: 0.4; flex-shrink: 0; }
.search-form input {
  border: 0;
  background: transparent;
  outline: none;
  width: 100%;
  color: var(--ink);
  font-size: 0.9rem;
}
.search-form input::placeholder { color: var(--muted); }
.search-form button {
  border: 0;
  background: var(--brand);
  color: #fff;
  border-radius: 7px;
  height: 30px;
  padding: 0 0.85rem;
  font-weight: 600;
  font-size: 0.8rem;
  cursor: pointer;
  flex-shrink: 0;
  transition: background .15s;
}
.search-form button:hover { background: var(--brand-deep); }

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}
.topbar-clock {
  display: none;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.75rem;
  border-radius: 8px;
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 0.78rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
@media (min-width: 1100px) {
  .topbar-clock { display: inline-flex; }
}

.icon-btn {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  display: grid;
  place-items: center;
  color: var(--ink-soft);
  cursor: pointer;
  transition: border-color .15s, background .15s, color .15s;
}
.icon-btn:hover {
  border-color: var(--line-strong);
  background: var(--bg-elevated);
  color: var(--brand);
}
.icon-btn .dot {
  position: absolute;
  top: 5px;
  right: 5px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 0.62rem;
  font-weight: 700;
  display: grid;
  place-items: center;
  box-shadow: 0 0 0 2px #fff;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.2rem 0.55rem 0.2rem 0.2rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
  color: inherit;
}
.user-chip:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-sm);
  color: inherit;
}
.user-chip img, .avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--brand);
}
.user-chip strong { display: block; font-size: 0.84rem; font-weight: 600; line-height: 1.15; color: var(--ink); }
.user-chip small { color: var(--muted); font-size: 0.7rem; }

.content {
  padding: 1.5rem 1.75rem 2.75rem;
  max-width: 1440px;
  width: 100%;
  margin: 0 auto;
  animation: contentIn .4s var(--ease) both;
}
@keyframes contentIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

/* ??? Typography / Page head ??? */
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.4rem;
  flex-wrap: wrap;
}
.page-head h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.55rem, 2.2vw, 1.95rem);
  font-weight: 400;
  letter-spacing: -0.02em;
  color: var(--ink);
  line-height: 1.15;
}
.page-head p {
  margin: 0.3rem 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}
.page-head-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
}
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 0.35rem;
  font-weight: 500;
}
.breadcrumb span { opacity: 0.45; }
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--brand); }

/* ??? Grid ??? */
.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-dash { grid-template-columns: 1.55fr 1fr; }
.grid-dash-bottom { grid-template-columns: 1.25fr 1fr 1fr; }
.gap-lg { gap: 1.15rem; }
.mb-1 { margin-bottom: 1rem; }
.mb-lg { margin-bottom: 1.15rem; }

/* ??? Cards ??? */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
  transition: box-shadow .2s var(--ease), border-color .2s var(--ease);
}
.card:hover { box-shadow: var(--shadow-sm); }
.card-body { padding: 1.15rem 1.25rem; }
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.9rem 1.25rem;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #fafbfa 0%, #fff 100%);
}
.card-head h2, .card-head h3 {
  margin: 0;
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.card-head a {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--brand);
}
.card-head a:hover { text-decoration: underline; }

/* Stats */
.stat {
  padding: 1.1rem 1.2rem;
  background: var(--surface);
  position: relative;
  overflow: hidden;
}
.stat::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--brand), var(--brand-light));
  opacity: 0.85;
}
.stat.stat-accent::after { background: linear-gradient(90deg, var(--accent), #d4b44a); }
.stat.stat-warn::after { background: linear-gradient(90deg, #c2410c, #ea580c); }
.stat .label {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.stat .value {
  margin-top: 0.4rem;
  font-family: var(--font-body);
  font-size: 1.7rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.stat .meta {
  margin-top: 0.3rem;
  color: var(--muted);
  font-size: 0.8rem;
}
.stat .meta a { font-weight: 600; }

/* Hero dashboard */
.hero-dash {
  position: relative;
  overflow: hidden;
  min-height: 200px;
  border: 0;
  background: var(--brand-deep);
  color: #f0f7f3;
  box-shadow: var(--shadow);
}
.hero-dash::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(125deg, rgba(10, 47, 29, 0.97) 0%, rgba(22, 92, 56, 0.88) 48%, rgba(184, 148, 31, 0.5) 100%),
    repeating-linear-gradient(-45deg, transparent, transparent 12px, rgba(255,255,255,0.015) 12px, rgba(255,255,255,0.015) 24px);
}
.hero-dash::after {
  content: "";
  position: absolute;
  width: 280px;
  height: 280px;
  border-radius: 50%;
  right: -60px;
  bottom: -100px;
  background: radial-gradient(circle, rgba(184, 148, 31, 0.35), transparent 65%);
  animation: floatOrb 10s ease-in-out infinite alternate;
}
@keyframes floatOrb {
  from { transform: translate(0, 0); }
  to { transform: translate(-24px, -16px); }
}
.hero-dash .card-body {
  position: relative;
  z-index: 1;
  padding: 1.5rem 1.6rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 200px;
}
.hero-dash .eyebrow {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  opacity: 0.7;
  margin-bottom: 0.55rem;
}
.hero-dash h2 {
  margin: 0 0 0.45rem;
  font-family: var(--font-display);
  font-size: clamp(1.55rem, 2.5vw, 2.15rem);
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1.15;
  max-width: 16ch;
}
.hero-dash p {
  margin: 0;
  max-width: 42ch;
  opacity: 0.78;
  line-height: 1.55;
  font-size: 0.92rem;
}
.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 1.15rem;
}
.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.32rem 0.7rem;
  border-radius: 999px;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.12);
  font-size: 0.75rem;
  font-weight: 500;
  backdrop-filter: blur(4px);
}
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.15rem;
}
.btn-on-dark {
  background: #fff !important;
  color: var(--brand-deep) !important;
  border: 0 !important;
  box-shadow: 0 4px 14px rgba(0,0,0,0.15) !important;
}
.btn-on-dark-ghost {
  background: transparent !important;
  color: #fff !important;
  border: 1px solid rgba(255,255,255,0.3) !important;
}
.btn-on-dark-ghost:hover {
  background: rgba(255,255,255,0.1) !important;
  color: #fff !important;
}

/* Lists */
.list { list-style: none; margin: 0; padding: 0; }
.list-item {
  display: flex;
  gap: 0.85rem;
  align-items: flex-start;
  padding: 0.8rem 0;
  border-bottom: 1px solid var(--line);
  transition: background .12s;
}
.list-item:last-child { border-bottom: 0; padding-bottom: 0; }
.list-item:first-child { padding-top: 0; }
.list-item h4 {
  margin: 0 0 0.2rem;
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.3;
}
.list-item h4 a { color: var(--ink); }
.list-item h4 a:hover { color: var(--brand); }
.list-item p {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.45;
}
.list-item-icon {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: var(--brand-tint);
  color: var(--brand);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  font-size: 0.75rem;
  font-weight: 700;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border: 0;
  border-radius: 9px;
  padding: 0.58rem 1.05rem;
  font: inherit;
  font-weight: 650;
  font-size: 0.875rem;
  cursor: pointer;
  transition: transform .12s var(--ease), box-shadow .15s, background .15s, border-color .15s, filter .15s;
  white-space: nowrap;
  text-decoration: none;
  line-height: 1.2;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--brand);
  color: #fff;
  box-shadow: 0 1px 2px rgba(14, 28, 20, 0.08), 0 4px 12px rgba(22, 92, 56, 0.22);
}
.btn-primary:hover {
  background: var(--brand-deep);
  color: #fff;
  filter: none;
}
.btn-secondary {
  background: #fff;
  color: var(--ink-soft);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-xs);
}
.btn-secondary:hover {
  background: var(--bg-elevated);
  border-color: var(--line-strong);
  color: var(--ink);
}
.btn-danger {
  background: var(--danger);
  color: #fff;
}
.btn-danger:hover { filter: brightness(1.05); color: #fff; }
.btn-sm {
  padding: 0.38rem 0.7rem;
  font-size: 0.78rem;
  border-radius: 7px;
}
.btn-ghost {
  background: transparent;
  color: var(--brand);
  border: 1px solid transparent;
}
.btn-ghost:hover { background: var(--brand-tint); }

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.18rem 0.55rem;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.3;
}
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-info { background: var(--info-bg); color: var(--info); }
.badge-muted { background: #f1f3f2; color: var(--muted); }
.badge-urgent { background: #fee2e2; color: #b91c1c; }

/* Tables */
.table-wrap { overflow-x: auto; }
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
table.data th, table.data td {
  padding: 0.8rem 1.1rem;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
table.data th {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  font-weight: 700;
  background: #f8faf8;
  white-space: nowrap;
}
table.data tbody tr {
  transition: background .12s;
}
table.data tbody tr:hover td { background: #f9fbf9; }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data td strong a { color: var(--ink); }
table.data td strong a:hover { color: var(--brand); }

/* Forms */
.form-grid { display: grid; gap: 0.95rem; }
.form-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
label.field {
  display: grid;
  gap: 0.38rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink-soft);
}
label.field input,
label.field select,
label.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 0.65rem 0.85rem;
  font: inherit;
  font-weight: 400;
  color: var(--ink);
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
label.field input:hover,
label.field select:hover,
label.field textarea:hover {
  border-color: var(--line-strong);
}
label.field input:focus,
label.field select:focus,
label.field textarea:focus {
  outline: none;
  border-color: rgba(22, 92, 56, 0.5);
  box-shadow: 0 0 0 3px rgba(22, 92, 56, 0.1);
}
label.field textarea { min-height: 120px; resize: vertical; }

/* Alerts */
.alert {
  padding: 0.85rem 1.05rem;
  border-radius: 10px;
  margin-bottom: 1.1rem;
  font-size: 0.9rem;
  border: 1px solid transparent;
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  animation: contentIn .35s var(--ease) both;
}
.alert-success { background: var(--success-bg); color: #0f5c48; border-color: #99f6e4; }
.alert-error { background: var(--danger-bg); color: #9b2c2c; border-color: #fecaca; }
.alert-info { background: var(--info-bg); color: #1e40af; border-color: #bfdbfe; }

.empty {
  text-align: center;
  padding: 2.5rem 1.25rem;
  color: var(--muted);
  font-size: 0.92rem;
}
.empty-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 0.85rem;
  border-radius: 12px;
  background: var(--bg-elevated);
  display: grid;
  place-items: center;
  color: var(--muted);
  opacity: 0.7;
}

.progress {
  height: 6px;
  border-radius: 999px;
  background: var(--bg);
  overflow: hidden;
}
.progress > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--brand), var(--brand-light));
  border-radius: inherit;
  transition: width .45s var(--ease);
}

.chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.chip {
  padding: 0.28rem 0.7rem;
  border-radius: 999px;
  background: var(--bg-elevated);
  color: var(--ink-soft);
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid var(--line);
  transition: background .15s, color .15s, border-color .15s;
}
a.chip:hover, .chip.active {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}

.system-tile {
  display: flex;
  gap: 0.85rem;
  align-items: center;
  padding: 1rem 1.05rem;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: var(--surface);
  transition: transform .18s var(--ease), box-shadow .18s var(--ease), border-color .18s;
  color: inherit;
}
.system-tile:hover {
  transform: translateY(-2px);
  border-color: rgba(22, 92, 56, 0.25);
  box-shadow: var(--shadow);
  color: inherit;
}
.system-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--brand-tint);
  color: var(--brand);
  font-weight: 800;
  font-size: 0.9rem;
  flex-shrink: 0;
}
.system-tile strong {
  display: block;
  font-size: 0.9rem;
  font-weight: 650;
  color: var(--ink);
}
.system-tile .sub {
  color: var(--muted);
  font-size: 0.78rem;
  margin-top: 0.1rem;
}

/* Quick links row under hero */
.quick-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.15rem;
}
.quick-action {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.85rem 1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: inherit;
  box-shadow: var(--shadow-xs);
  transition: border-color .15s, box-shadow .15s, transform .15s var(--ease);
}
.quick-action:hover {
  border-color: rgba(22, 92, 56, 0.28);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
  color: inherit;
}
.quick-action .qa-icon {
  width: 38px;
  height: 38px;
  border-radius: 9px;
  background: var(--brand-tint);
  color: var(--brand);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.quick-action strong {
  display: block;
  font-size: 0.85rem;
  font-weight: 650;
  color: var(--ink);
}
.quick-action span {
  font-size: 0.72rem;
  color: var(--muted);
}

/* KPI strip */
.kpi-strip .stat .value {
  font-size: 1.45rem;
}
.kpi-delta {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--success);
  margin-left: 0.35rem;
}

/* News article cards */
.news-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  transition: transform .18s var(--ease), box-shadow .18s;
}
.news-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.news-card .card-body { flex: 1; display: flex; flex-direction: column; }
.news-card h3 {
  margin: 0.35rem 0 0.5rem;
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 400;
  line-height: 1.25;
  letter-spacing: -0.01em;
}
.news-card h3 a { color: var(--ink); }
.news-card h3 a:hover { color: var(--brand); }
.news-card .excerpt {
  color: var(--muted);
  margin: 0 0 auto;
  font-size: 0.88rem;
  line-height: 1.5;
  flex: 1;
}
.news-card .meta-row {
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--line);
  font-size: 0.78rem;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
}

/* Auth page ? dedicated login experience */
.auth-page {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(0, 0.88fr);
  background: #fff;
}
.auth-visual {
  position: relative;
  overflow: hidden;
  background: #071f14;
  color: #f2f8f4;
  padding: clamp(1.75rem, 4vw, 3rem) clamp(1.75rem, 4.5vw, 3.5rem);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 100vh;
  min-height: 100dvh;
}
.auth-visual-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(155deg, #061911 0%, #0c3422 42%, #165c38 78%, #8a7020 118%);
}
.auth-visual-bg .auth-grid {
  position: absolute;
  inset: 0;
  opacity: 0.18;
  background-image:
    linear-gradient(rgba(255,255,255,0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.05) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 80% 70% at 40% 40%, #000 20%, transparent 75%);
}
.auth-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(2px);
}
.auth-orb-a {
  width: min(52vw, 480px);
  height: min(52vw, 480px);
  right: -12%;
  bottom: -18%;
  background: radial-gradient(circle, rgba(184, 148, 31, 0.45) 0%, transparent 68%);
  animation: authOrbA 14s ease-in-out infinite alternate;
}
.auth-orb-b {
  width: min(40vw, 360px);
  height: min(40vw, 360px);
  left: -10%;
  top: 10%;
  background: radial-gradient(circle, rgba(45, 155, 98, 0.35) 0%, transparent 70%);
  animation: authOrbB 11s ease-in-out infinite alternate;
}
@keyframes authOrbA {
  from { transform: translate(0, 0) scale(1); }
  to { transform: translate(-28px, -20px) scale(1.06); }
}
@keyframes authOrbB {
  from { transform: translate(0, 0); }
  to { transform: translate(20px, 24px); }
}

.auth-visual-content,
.auth-visual-footer {
  position: relative;
  z-index: 1;
}

.auth-logo {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-bottom: clamp(2.5rem, 8vh, 4.5rem);
  animation: authRise 0.7s var(--ease) both;
}
.auth-logo .brand-mark {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  font-size: 1.05rem;
}
.auth-logo .brand-text strong {
  letter-spacing: 0.12em;
  font-size: 1.1rem;
}
.auth-logo .brand-text span {
  opacity: 0.55;
  letter-spacing: 0.16em;
}

.auth-hero-copy {
  max-width: 22ch;
  animation: authRise 0.75s 0.08s var(--ease) both;
}
.auth-kicker {
  margin: 0 0 0.85rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(242, 248, 244, 0.55);
}
.auth-hero-copy h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(3.2rem, 7.5vw, 5.4rem);
  font-weight: 400;
  letter-spacing: -0.03em;
  line-height: 0.92;
  color: #fff;
}
.auth-tagline {
  margin: 0.85rem 0 1.15rem;
  font-family: var(--font-display);
  font-style: italic;
  font-size: clamp(1.25rem, 2.2vw, 1.55rem);
  font-weight: 400;
  color: #e8c95a;
  letter-spacing: -0.01em;
}
.auth-hero-copy .lead {
  margin: 0;
  max-width: 36ch;
  font-size: 1rem;
  line-height: 1.65;
  color: rgba(242, 248, 244, 0.72);
}

.auth-stats {
  list-style: none;
  margin: clamp(2.2rem, 6vh, 3.5rem) 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  max-width: 420px;
  animation: authRise 0.8s 0.16s var(--ease) both;
}
.auth-stats li {
  padding: 0.9rem 0.85rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(8px);
}
.auth-stats strong {
  display: block;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  margin-bottom: 0.15rem;
}
.auth-stats span {
  font-size: 0.72rem;
  color: rgba(242, 248, 244, 0.55);
  font-weight: 500;
}

.auth-visual-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
  justify-content: space-between;
  margin-top: 2.5rem;
  font-size: 0.75rem;
  color: rgba(242, 248, 244, 0.42);
  font-weight: 500;
  animation: authRise 0.85s 0.2s var(--ease) both;
}

@keyframes authRise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

/* Right panel */
.auth-panel {
  display: grid;
  place-items: center;
  padding: clamp(1.5rem, 4vw, 2.5rem);
  background:
    radial-gradient(ellipse 90% 60% at 100% 0%, rgba(22, 92, 56, 0.06), transparent 50%),
    radial-gradient(ellipse 70% 50% at 0% 100%, rgba(184, 148, 31, 0.05), transparent 45%),
    #f3f6f3;
}
.auth-panel-inner {
  width: min(100%, 420px);
  background: #fff;
  border: 1px solid rgba(226, 232, 227, 0.95);
  border-radius: 20px;
  padding: clamp(1.6rem, 3.5vw, 2.25rem) clamp(1.5rem, 3.2vw, 2.2rem);
  box-shadow:
    0 1px 2px rgba(14, 28, 20, 0.03),
    0 20px 50px rgba(14, 28, 20, 0.08);
  animation: authRise 0.55s 0.1s var(--ease) both;
}

.auth-mobile-brand {
  display: none;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 1.35rem;
}
.auth-mobile-brand .brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  font-size: 0.9rem;
}
.auth-mobile-brand strong {
  font-size: 1rem;
  letter-spacing: 0.1em;
  color: var(--brand-deep);
}

.auth-card-head h2 {
  margin: 0 0 0.4rem;
  font-family: var(--font-display);
  font-size: clamp(1.7rem, 3vw, 2rem);
  font-weight: 400;
  letter-spacing: -0.025em;
  color: var(--ink);
  line-height: 1.15;
}
.auth-card-head .sub {
  margin: 0 0 1.55rem;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
}

.auth-alert { margin-bottom: 1.15rem; }

.auth-demo-box {
  margin-bottom: 1.25rem;
  padding: 0.9rem 1rem;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(22, 92, 56, 0.07), rgba(184, 148, 31, 0.08));
  border: 1px solid rgba(22, 92, 56, 0.18);
}
.auth-demo-title {
  margin: 0 0 0.65rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--brand);
}
.auth-demo-creds {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
}
.auth-demo-creds .auth-demo-label {
  display: block;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 0.2rem;
}
.auth-demo-creds strong {
  display: block;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--brand-deep);
  font-family: ui-monospace, "Cascadia Code", monospace;
  word-break: break-all;
  line-height: 1.3;
}
.auth-demo-more {
  margin: 0.7rem 0 0;
  font-size: 0.72rem;
  color: var(--muted);
  line-height: 1.4;
}

.auth-form {
  display: grid;
  gap: 1.05rem;
}
.auth-field {
  display: grid;
  gap: 0.42rem;
}
.auth-label {
  font-size: 0.8rem;
  font-weight: 650;
  color: var(--ink-soft);
}
.auth-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.auth-input-icon {
  position: absolute;
  left: 0.9rem;
  color: var(--muted);
  pointer-events: none;
  opacity: 0.7;
  transition: color .15s, opacity .15s;
}
.auth-input-wrap input {
  width: 100%;
  height: 48px;
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 0 2.75rem 0 2.7rem;
  font: inherit;
  font-size: 0.92rem;
  color: var(--ink);
  background: #fafbfa;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.auth-input-wrap input::placeholder {
  color: #9aab9f;
}
.auth-input-wrap input:hover {
  border-color: var(--line-strong);
  background: #fff;
}
.auth-input-wrap input:focus {
  outline: none;
  border-color: rgba(22, 92, 56, 0.55);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(22, 92, 56, 0.1);
}
.auth-input-wrap:focus-within .auth-input-icon {
  color: var(--brand);
  opacity: 1;
}

.auth-toggle-pass {
  position: absolute;
  right: 0.45rem;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.auth-toggle-pass:hover {
  background: var(--bg-elevated);
  color: var(--brand-deep);
}

.auth-form-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: -0.15rem;
}
.auth-check {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
  color: var(--ink-soft);
  cursor: pointer;
  user-select: none;
  font-weight: 500;
}
.auth-check input {
  width: 16px;
  height: 16px;
  accent-color: var(--brand);
  cursor: pointer;
}

.auth-submit {
  width: 100%;
  height: 48px;
  margin-top: 0.25rem;
  font-size: 0.95rem;
  border-radius: 11px;
  gap: 0.55rem;
}
.auth-submit svg {
  transition: transform .2s var(--ease);
}
.auth-submit:hover svg {
  transform: translateX(3px);
}

.auth-trust {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.65rem 1.15rem;
  margin-top: 1.25rem;
  padding-top: 1.15rem;
  border-top: 1px solid var(--line);
}
.auth-trust span {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.01em;
}
.auth-trust svg { opacity: 0.65; flex-shrink: 0; }

.auth-page .demo-hint {
  margin-top: 1.15rem;
  padding: 0;
  border: 0;
}
.auth-page .demo-hint summary {
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.55rem;
  border-radius: 9px;
  transition: color .15s, background .15s;
}
.auth-page .demo-hint summary::-webkit-details-marker { display: none; }
.auth-page .demo-hint summary:hover,
.auth-page .demo-hint[open] summary {
  color: var(--brand);
  background: var(--brand-tint);
}
.auth-page .demo-hint[open] summary { margin-bottom: 0.65rem; }

.auth-page .demo-list {
  display: grid;
  gap: 0.45rem;
}
.demo-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  background: #fafbfa;
  border-radius: 10px;
  padding: 0.6rem 0.75rem;
  cursor: pointer;
  transition: border-color .15s, background .15s, transform .12s;
  font: inherit;
}
.demo-chip:hover {
  border-color: rgba(22, 92, 56, 0.35);
  background: #fff;
  transform: translateY(-1px);
}
.demo-chip span {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--brand-deep);
}
.demo-chip code {
  font-size: 0.72rem;
  background: transparent;
  padding: 0;
  color: var(--muted);
  font-weight: 500;
}
.demo-pass-note {
  margin: 0.35rem 0 0;
  text-align: center;
  font-size: 0.75rem;
  color: var(--muted);
}
.demo-pass-note strong {
  color: var(--ink-soft);
  font-family: ui-monospace, monospace;
  font-weight: 650;
}

.auth-help {
  margin: 1.15rem 0 0;
  text-align: center;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.45;
}
.auth-help a {
  font-weight: 600;
}

.mobile-toggle {
  display: none;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 9px;
  width: 40px;
  height: 40px;
  min-width: 40px;
  min-height: 40px;
  cursor: pointer;
  place-items: center;
  color: var(--ink-soft);
  flex-shrink: 0;
}

.overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(10, 20, 14, 0.48);
  z-index: 55;
  backdrop-filter: blur(2px);
}
.overlay.show { display: block; }

/* Section title in content */
.section-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 0.75rem;
}

/* Profile photo ring */
.avatar-lg {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid #fff;
  box-shadow: 0 0 0 1px var(--line), var(--shadow-sm);
}

/* Details/edit dropdown polish */
details summary {
  list-style: none;
  cursor: pointer;
}
details summary::-webkit-details-marker { display: none; }

/* Responsive */
@media (max-width: 1200px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .quick-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-dash, .grid-dash-bottom { grid-template-columns: 1fr; }
}
@media (max-width: 960px) {
  .auth-page {
    grid-template-columns: 1fr;
  }
  .auth-visual {
    min-height: auto;
    padding: 1.5rem 1.35rem 1.75rem;
  }
  .auth-logo { margin-bottom: 1.35rem; }
  .auth-hero-copy { max-width: none; }
  .auth-hero-copy h1 { font-size: clamp(2.4rem, 10vw, 3.2rem); }
  .auth-stats { max-width: none; margin-top: 1.5rem; }
  .auth-visual-footer { margin-top: 1.5rem; }
  .auth-panel {
    padding: 0 1rem 2rem;
    margin-top: -1.25rem;
    background: transparent;
    place-items: start center;
  }
  .auth-panel-inner {
    box-shadow: 0 16px 40px rgba(14, 28, 20, 0.12);
  }
}
@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(88vw, var(--sidebar));
    transform: translateX(-105%);
    transition: transform .28s var(--ease);
    z-index: 60;
  }
  .sidebar.open { transform: none; box-shadow: var(--shadow-lg); }
  .mobile-toggle { display: grid; }
  .grid-2, .grid-3, .form-grid.two { grid-template-columns: 1fr; }
  .topbar { padding: 0 1rem; }
  .content { padding: 1.1rem 1rem 2rem; }
  .user-chip span { display: none; }
  .quick-actions { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
  .quick-actions { grid-template-columns: 1fr; }
  .grid-4 { grid-template-columns: 1fr; }
  .auth-stats { grid-template-columns: 1fr; }
  .auth-panel-inner { padding: 1.35rem 1.15rem; border-radius: 16px; }
  .auth-input-wrap input { padding-right: 2.6rem; }
}

/* Print */
@media print {
  .sidebar, .topbar, .btn, .app-footer, .skip-link { display: none !important; }
  .app-shell { display: block; }
  .content { max-width: none; padding: 0; }
}

/* ???????????????????????????????????????????
   Professional system layer (v2)
   ??????????????????????????????????????????? */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  background: var(--brand-deep);
  color: #fff;
  padding: 0.65rem 1rem;
  border-radius: 0 0 8px 0;
  font-weight: 650;
  font-size: 0.85rem;
}
.skip-link:focus {
  left: 0;
}

.app-body .main {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
.app-body .content {
  flex: 1;
}

.brand {
  text-decoration: none;
  color: inherit;
}
.brand:hover { color: inherit; }

.sidebar-env {
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(230, 240, 234, 0.38);
  font-weight: 600;
  padding: 0 0.55rem 0.55rem;
}
.sidebar-user-meta {
  min-width: 0;
}
.sidebar-user-meta strong,
.sidebar-user-meta small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.55rem;
  padding: 0.85rem 1.75rem 1.15rem;
  border-top: 1px solid var(--line);
  background: rgba(255,255,255,0.65);
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 500;
}
.app-footer strong {
  color: var(--ink-soft);
  font-weight: 700;
  letter-spacing: 0.04em;
}
.app-footer-sep { opacity: 0.45; }
.app-footer-right {
  margin-left: auto;
  opacity: 0.85;
}

/* denser, more enterprise tool surface */
.app-body {
  background: #eef1ef;
}
.app-body::before {
  background:
    radial-gradient(ellipse 90% 45% at 100% -10%, rgba(22, 92, 56, 0.05), transparent 55%),
    linear-gradient(180deg, #f4f6f4 0%, #eef1ef 100%);
}

.topbar {
  height: 60px;
  box-shadow: 0 1px 0 rgba(14, 28, 20, 0.04);
}

.card {
  border-radius: 14px;
  border-color: #dde5df;
  box-shadow: 0 1px 2px rgba(14, 28, 20, 0.035);
}
.card:hover {
  box-shadow: 0 4px 16px rgba(14, 28, 20, 0.055);
}

.stat .value {
  letter-spacing: -0.04em;
}

.btn {
  letter-spacing: -0.01em;
}
.btn-primary {
  background: linear-gradient(180deg, #1c6b42 0%, var(--brand) 100%);
}
.btn-primary:hover {
  background: var(--brand-deep);
}

/* panel + toolbar for filters (docs, news?) */
.panel-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  align-items: end;
  margin-bottom: 1rem;
}
.panel-toolbar .field { flex: 1; min-width: 160px; }

/* document table polish */
table.data th {
  position: sticky;
  top: 0;
  z-index: 1;
}
.doc-title {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}
.doc-icon {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: var(--brand-tint);
  color: var(--brand);
  display: grid;
  place-items: center;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  flex-shrink: 0;
  text-transform: uppercase;
}

/* people cards */
.person-card .card-body {
  padding: 1.15rem;
}
.person-card:hover {
  border-color: rgba(22, 92, 56, 0.22);
  transform: translateY(-1px);
  transition: transform .15s var(--ease), border-color .15s, box-shadow .15s;
}

/* error pages */
.error-page {
  max-width: 480px;
  margin: 3rem auto;
  text-align: center;
}
.error-page .error-code {
  font-family: var(--font-display);
  font-size: 4.5rem;
  line-height: 1;
  color: var(--brand);
  margin: 0 0 0.5rem;
  letter-spacing: -0.03em;
}
.error-page h1 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.6rem;
  margin: 0 0 0.5rem;
}
.error-page p {
  color: var(--muted);
  margin: 0 0 1.5rem;
}

/* article reading */
.article-body {
  font-size: 1.02rem;
  line-height: 1.75;
  color: var(--ink-soft);
  max-width: 72ch;
}
.article-body p { margin: 0 0 1rem; }

/* focus visible system */
:focus-visible {
  outline: 2px solid rgba(22, 92, 56, 0.55);
  outline-offset: 2px;
}
button:focus:not(:focus-visible),
a:focus:not(:focus-visible) {
  outline: none;
}

/* selection */
::selection {
  background: rgba(22, 92, 56, 0.18);
  color: var(--ink);
}

@media (max-width: 900px) {
  .app-footer {
    padding: 0.75rem 1rem 1rem;
  }
  .app-footer-right {
    margin-left: 0;
    width: 100%;
  }
}

.site-banner {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.75rem 1rem;
  margin-bottom: 1.1rem;
  border-radius: 11px;
  background: linear-gradient(90deg, rgba(22, 92, 56, 0.1), rgba(184, 148, 31, 0.1));
  border: 1px solid rgba(22, 92, 56, 0.18);
  color: var(--brand-deep);
  font-size: 0.9rem;
  font-weight: 550;
  line-height: 1.45;
}
.site-banner svg {
  flex-shrink: 0;
  margin-top: 0.15rem;
  color: var(--brand);
}
.app-footer a {
  color: var(--muted);
  font-weight: 600;
}
.app-footer a:hover { color: var(--brand); }


/* -------------------------------------------
   RESPONSIVE SYSTEM ? all devices (v3)
   ------------------------------------------- */

/* Base fluidity */
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
img, video, canvas, svg {
  max-width: 100%;
  height: auto;
}
.table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
table.data {
  min-width: 560px;
}
.main, .content, .card, .page-head {
  min-width: 0;
}
.topbar-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}
.topbar-brand-mobile {
  display: none;
  align-items: center;
  gap: 0.45rem;
  color: inherit;
  text-decoration: none;
}
.topbar-brand-mobile:hover { color: inherit; }
.topbar-brand-mobile strong {
  font-size: 0.88rem;
  letter-spacing: 0.06em;
  color: var(--brand-deep);
}
.brand-mark-sm {
  width: 32px !important;
  height: 32px !important;
  border-radius: 8px !important;
  font-size: 0.8rem !important;
}
.logout-form { margin: 0; }
.user-chip-text { min-width: 0; }

/* Safe areas (notch / home indicator) */
@supports (padding: env(safe-area-inset-bottom)) {
  .app-footer {
    padding-bottom: calc(0.85rem + env(safe-area-inset-bottom));
  }
  .sidebar {
    padding-left: env(safe-area-inset-left);
  }
}

/* ??? Large tablet / small laptop ??? */
@media (max-width: 1200px) {
  :root { --sidebar: 240px; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .quick-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-dash,
  .grid-dash-bottom { grid-template-columns: 1fr; }
  .content { padding: 1.25rem 1.25rem 2rem; }
}

/* ??? Tablet ??? */
@media (max-width: 1024px) {
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero-dash .card-body { min-height: 180px; padding: 1.25rem; }
  .stat .value { font-size: 1.45rem; }
  .page-head h1 { font-size: clamp(1.35rem, 3.5vw, 1.75rem); }
}

/* ??? Auth stack ??? */
@media (max-width: 960px) {
  .auth-page {
    grid-template-columns: 1fr;
    min-height: 100dvh;
  }
  .auth-visual {
    min-height: auto;
    min-height: unset;
    height: auto;
    padding: 1.35rem 1.25rem 1.5rem;
    padding-top: max(1.35rem, env(safe-area-inset-top));
  }
  .auth-logo { margin-bottom: 1.1rem; }
  .auth-hero-copy { max-width: none; }
  .auth-hero-copy h1 {
    font-size: clamp(2.2rem, 11vw, 3rem);
  }
  .auth-tagline { font-size: 1.15rem; }
  .auth-hero-copy .lead { font-size: 0.92rem; max-width: none; }
  .auth-stats {
    max-width: none;
    margin-top: 1.25rem;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .auth-visual-footer {
    margin-top: 1.25rem;
    font-size: 0.7rem;
  }
  .auth-panel {
    padding: 0 0.85rem calc(1.5rem + env(safe-area-inset-bottom));
    margin-top: -1rem;
    background: transparent;
    place-items: start stretch;
    width: 100%;
  }
  .auth-panel-inner {
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
    box-shadow: 0 16px 40px rgba(14, 28, 20, 0.12);
  }
}

/* ??? Mobile app shell ??? */
@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(88vw, 280px);
    max-width: 100%;
    height: 100dvh;
    transform: translateX(-105%);
    transition: transform .28s var(--ease);
    z-index: 60;
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }
  .mobile-toggle {
    display: grid !important;
    place-items: center;
    flex-shrink: 0;
  }
  .topbar-brand-mobile { display: inline-flex; }

  .topbar {
    height: auto;
    min-height: 56px;
    flex-wrap: wrap;
    gap: 0.55rem;
    padding: 0.55rem 0.75rem;
    padding-top: max(0.55rem, env(safe-area-inset-top));
    align-items: center;
  }
  .topbar-left { order: 1; }
  .topbar-actions { order: 2; margin-left: auto; }
  .search-form {
    order: 3;
    flex: 1 1 100%;
    max-width: none;
    width: 100%;
    height: 40px;
  }
  .search-form button {
    padding: 0 0.7rem;
    font-size: 0.78rem;
  }
  .topbar-clock { display: none !important; }
  .user-chip-text { display: none; }
  .user-chip {
    padding: 0.15rem;
    border-radius: 50%;
  }
  .btn-logout {
    padding: 0.4rem 0.55rem;
    font-size: 0.75rem;
  }

  .grid-2,
  .grid-3,
  .form-grid.two { grid-template-columns: 1fr !important; }

  .content {
    padding: 1rem 0.85rem 1.75rem;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  .page-head {
    flex-direction: column;
    align-items: stretch;
    gap: 0.85rem;
    margin-bottom: 1rem;
  }
  .page-head-actions {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
  }
  .page-head-actions .btn {
    flex: 1 1 auto;
    min-height: 42px;
  }

  .quick-actions {
    grid-template-columns: 1fr 1fr;
    gap: 0.55rem;
  }
  .quick-action {
    padding: 0.75rem 0.7rem;
  }
  .quick-action strong { font-size: 0.8rem; }
  .quick-action span { font-size: 0.68rem; }

  .card-head {
    flex-wrap: wrap;
    gap: 0.4rem;
    padding: 0.8rem 1rem;
  }
  .card-body { padding: 1rem; }

  .hero-dash .card-body {
    min-height: auto;
    padding: 1.2rem 1.1rem;
  }
  .hero-dash h2 {
    font-size: clamp(1.35rem, 6vw, 1.75rem);
    max-width: none;
  }
  .hero-actions {
    width: 100%;
  }
  .hero-actions .btn {
    flex: 1 1 auto;
    justify-content: center;
  }

  .stat .value { font-size: 1.35rem; }
  .kpi-strip .stat .value { font-size: 1.25rem; }

  .app-footer {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
    padding: 0.85rem 1rem 1.1rem;
    font-size: 0.72rem;
  }
  .app-footer-right {
    margin-left: 0;
    width: 100%;
  }
  .app-footer-sep { display: none; }

  .site-banner {
    font-size: 0.85rem;
    padding: 0.7rem 0.85rem;
  }

  /* Touch-friendly targets */
  .nav-link {
    min-height: 44px;
    padding: 0.7rem 0.8rem;
  }
  .icon-btn {
    width: 42px;
    height: 42px;
  }
  .btn {
    min-height: 42px;
  }
  .btn-sm {
    min-height: 36px;
  }

  /* Forms full width */
  label.field input,
  label.field select,
  label.field textarea,
  .auth-input-wrap input {
    font-size: 16px; /* avoid iOS zoom */
  }

  /* Tables scroll with shadow hint */
  .table-wrap {
    margin: 0 -0.15rem;
    padding-bottom: 0.25rem;
  }
  table.data th,
  table.data td {
    padding: 0.7rem 0.75rem;
    font-size: 0.82rem;
  }

  /* System tiles stack nicely */
  .grid.grid-4 .system-tile,
  .card-body .grid-4 {
    /* parent already 1 col from grid-4 @ 480; at 900 use 2 */
  }
}

/* ??? Phablet / large phone ??? */
@media (max-width: 640px) {
  .grid-4 { grid-template-columns: 1fr !important; }
  .quick-actions { grid-template-columns: 1fr; }
  .auth-stats { grid-template-columns: 1fr; gap: 0.5rem; }
  .auth-stats li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
  }
  .auth-stats span { margin: 0; }

  .auth-demo-creds {
    grid-template-columns: 1fr;
  }
  .auth-mobile-brand { display: none; }

  .topbar-brand-mobile strong {
    max-width: 7.5rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .doc-title {
    flex-direction: row;
  }
  .person-card .card-body {
    flex-wrap: wrap;
  }

  .hero-meta {
    gap: 0.35rem;
  }
  .pill {
    font-size: 0.7rem;
    padding: 0.28rem 0.55rem;
  }

  .error-page {
    margin: 2rem auto;
    padding: 0 0.5rem;
  }
  .error-page .error-code { font-size: 3.5rem; }
}

/* ??? Small phones ??? */
@media (max-width: 480px) {
  .content {
    padding: 0.85rem 0.7rem 1.5rem;
  }
  .page-head h1 {
    font-size: 1.35rem;
    line-height: 1.2;
  }
  .page-head p { font-size: 0.85rem; }
  .breadcrumb {
    font-size: 0.72rem;
    flex-wrap: wrap;
  }

  .auth-panel-inner {
    padding: 1.2rem 1rem;
    border-radius: 14px;
  }
  .auth-card-head h2 { font-size: 1.45rem; }
  .auth-submit { height: 46px; }
  .auth-visual h1,
  .auth-hero-copy h1 { font-size: clamp(2rem, 12vw, 2.5rem); }

  .search-form {
    padding-left: 0.65rem;
  }
  .search-form button {
    height: 28px;
  }

  table.data { min-width: 480px; }

  .btn-logout {
    min-width: 44px;
  }
}

/* ??? Very small (foldables / old phones) ??? */
@media (max-width: 360px) {
  .topbar-brand-mobile strong { display: none; }
  .quick-action .qa-icon { width: 32px; height: 32px; }
  .stat .value { font-size: 1.2rem; }
  .auth-stats { gap: 0.4rem; }
}

/* ??? Landscape phone ??? */
@media (max-height: 500px) and (orientation: landscape) {
  .auth-visual {
    padding: 1rem 1.25rem;
  }
  .auth-stats { display: none; }
  .auth-hero-copy h1 { font-size: 1.8rem; }
  .auth-logo { margin-bottom: 0.6rem; }
  .sidebar { height: 100vh; }
}

/* ??? Large desktop comfort ??? */
@media (min-width: 1440px) {
  .content {
    max-width: 1480px;
    padding-left: 2rem;
    padding-right: 2rem;
  }
  .search-form { max-width: 520px; }
}

/* ??? Hover only on fine pointers ??? */
@media (hover: none) {
  .card:hover { box-shadow: var(--shadow-xs); }
  .system-tile:hover {
    transform: none;
  }
  .quick-action:hover {
    transform: none;
  }
  .nav-link:hover {
    transform: none;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Chart containers */
.card-body canvas {
  max-width: 100% !important;
  height: auto !important;
}
.form-actions-mobile {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
@media (max-width: 900px) {
  .form-grid.two { gap: 0.85rem; }
  details[open] form {
    width: 100%;
    max-width: 100%;
  }
  /* stacked KPI hero sidebar on dashboard was grid of stats */
  .grid-dash > .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}
@media (max-width: 480px) {
  .grid-dash > .grid {
    grid-template-columns: 1fr !important;
  }
}


/* -------------------------------------------
   LOGIN CENTRALIZADO
   ------------------------------------------- */
.auth-page--centered {
  display: flex !important;
  grid-template-columns: unset !important;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 1.5rem 1rem;
  padding-top: max(1.5rem, env(safe-area-inset-top));
  padding-bottom: max(1.5rem, env(safe-area-inset-bottom));
  position: relative;
  overflow-x: hidden;
  overflow-y: auto;
  background: #071f14;
}

.auth-page--centered .auth-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(155deg, #061911 0%, #0c3422 42%, #165c38 78%, #6b5820 120%);
  z-index: 0;
}
.auth-page--centered .auth-bg .auth-grid {
  position: absolute;
  inset: 0;
  opacity: 0.16;
  background-image:
    linear-gradient(rgba(255,255,255,0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.05) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 70% 60% at 50% 50%, #000 10%, transparent 70%);
}
.auth-page--centered .auth-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(2px);
}
.auth-page--centered .auth-orb-a {
  width: min(70vw, 520px);
  height: min(70vw, 520px);
  right: -10%;
  bottom: -15%;
  background: radial-gradient(circle, rgba(184, 148, 31, 0.4) 0%, transparent 68%);
  animation: authOrbA 14s ease-in-out infinite alternate;
}
.auth-page--centered .auth-orb-b {
  width: min(55vw, 400px);
  height: min(55vw, 400px);
  left: -8%;
  top: 5%;
  background: radial-gradient(circle, rgba(45, 155, 98, 0.32) 0%, transparent 70%);
  animation: authOrbB 11s ease-in-out infinite alternate;
}

.auth-center {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 440px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: authRise 0.55s var(--ease) both;
}

.auth-brand-top {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.85rem;
  margin-bottom: 0.85rem;
  color: #f0f7f3;
}
.auth-brand-top .brand-mark {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  font-size: 1.2rem;
  box-shadow: 0 8px 24px rgba(0,0,0,0.28), inset 0 1px 0 rgba(255,255,255,0.35);
}
.auth-brand-top .brand-text {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
}
.auth-brand-top .brand-text strong {
  font-size: 1.35rem;
  letter-spacing: 0.14em;
  font-weight: 700;
  color: #fff;
}
.auth-brand-top .brand-text span {
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0.65;
  font-weight: 500;
  max-width: 28ch;
}

.auth-headline {
  margin: 0 0 1.35rem;
  text-align: center;
  font-family: var(--font-display);
  font-style: italic;
  font-size: clamp(1.05rem, 2.5vw, 1.25rem);
  color: #e8c95a;
  font-weight: 400;
  line-height: 1.35;
  max-width: 28ch;
}

.auth-page--centered .auth-panel-inner {
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
  background: #fff;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 20px;
  padding: clamp(1.5rem, 3.5vw, 2.15rem) clamp(1.35rem, 3vw, 2rem);
  box-shadow:
    0 1px 2px rgba(0,0,0,0.06),
    0 24px 56px rgba(0,0,0,0.28);
  animation: none;
}

.auth-page--centered .auth-card-head {
  text-align: center;
}
.auth-page--centered .auth-card-head h2 {
  margin: 0 0 0.35rem;
}
.auth-page--centered .auth-card-head .sub {
  margin: 0 0 1.35rem;
}

.auth-page--centered .auth-trust {
  justify-content: center;
}
.auth-page--centered .auth-demo-creds {
  text-align: left;
}
.auth-page--centered .auth-help {
  text-align: center;
}

.auth-footer-centered {
  margin: 1.25rem 0 0;
  text-align: center;
  font-size: 0.72rem;
  color: rgba(240, 247, 243, 0.5);
  font-weight: 500;
  line-height: 1.45;
  max-width: 36ch;
}

@media (max-width: 480px) {
  .auth-page--centered {
    padding: 1rem 0.75rem;
    align-items: flex-start;
    padding-top: max(1.25rem, env(safe-area-inset-top));
  }
  .auth-center {
    max-width: 100%;
    margin-top: 0.5rem;
  }
  .auth-page--centered .auth-panel-inner {
    border-radius: 16px;
    padding: 1.25rem 1.05rem;
  }
  .auth-brand-top .brand-mark {
    width: 46px;
    height: 46px;
  }
  .auth-headline {
    margin-bottom: 1.1rem;
    font-size: 1.05rem;
  }
}

@media (max-height: 700px) {
  .auth-page--centered {
    align-items: flex-start;
    padding-top: 1.25rem;
    padding-bottom: 1.25rem;
  }
  .auth-brand-top { margin-bottom: 0.55rem; gap: 0.55rem; }
  .auth-headline { margin-bottom: 0.9rem; }
}
