:root {
  --bg: #f3f7fc;
  --bg-2: #eef3fb;
  --surface: #ffffff;
  --surface-2: #f8fbff;
  --text: #132238;
  --muted: #667085;
  --primary: #1d4ed8;
  --primary-2: #dbeafe;
  --primary-3: #eff6ff;
  --border: #dbe4ef;
  --success: #067647;
  --danger: #b42318;
  --warning: #b54708;
  --shadow-soft: 0 12px 30px rgba(15, 23, 42, 0.08);
  --shadow-hard: 0 22px 40px rgba(15, 23, 42, 0.12);
  --sidebar: #0f172a;
  --sidebar-2: #172554;
  --sidebar-text: #deebff;
  --sidebar-muted: #9ab0cf;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: Inter, Arial, Helvetica, sans-serif;
  background: linear-gradient(180deg, var(--bg-2) 0%, var(--bg) 100%);
  color: var(--text);
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4, p { margin-top: 0; }
strong { color: #101828; }

.body-app .app-shell {
  display: grid;
  grid-template-columns: 290px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  min-height: 100vh;
  padding: 24px 18px;
  color: var(--sidebar-text);
  background:
    radial-gradient(circle at top left, rgba(59,130,246,.24), transparent 26%),
    linear-gradient(180deg, var(--sidebar) 0%, var(--sidebar-2) 100%);
  position: sticky;
  top: 0;
}

.sidebar-top {
  padding: 8px 10px 22px;
  border-bottom: 1px solid rgba(255,255,255,.1);
  margin-bottom: 20px;
}
.brand-mark {
  display: block;
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: -.02em;
  color: #fff;
  margin-bottom: 6px;
}
.brand-mark:hover { text-decoration: none; }
.sidebar-caption {
  color: var(--sidebar-muted);
  font-size: .92rem;
  line-height: 1.45;
}

.sidebar-summary {
  display: grid;
  gap: 10px;
  margin-bottom: 20px;
}
.summary-pill {
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.08);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  font-size: .92rem;
}
.summary-pill strong { color: #fff; }
.muted-pill { color: #cad8ec; }

.sidebar-nav {
  display: grid;
  gap: 8px;
}
.nav-group-label {
  margin: 16px 10px 6px;
  color: #9fb5d3;
  font-size: .78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.nav-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  color: var(--sidebar-text);
  font-weight: 600;
  transition: .16s ease;
}
.nav-link:hover {
  text-decoration: none;
  background: rgba(255,255,255,.08);
}
.nav-link.active {
  background: linear-gradient(135deg, rgba(59,130,246,.22), rgba(147,197,253,.14));
  box-shadow: inset 0 0 0 1px rgba(147,197,253,.18);
  color: #fff;
}
.nav-link-muted { margin-top: 10px; color: #d6e0ef; }
.nav-pill {
  min-width: 22px;
  height: 22px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  color: var(--primary);
  font-size: .78rem;
  font-weight: 800;
  padding: 0 7px;
}

.app-main {
  display: grid;
  grid-template-rows: auto 1fr;
  min-width: 0;
}
.shell-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding: 24px 30px 16px;
}
.topbar-title {
  font-size: 1.85rem;
  font-weight: 800;
  letter-spacing: -.03em;
}
.topbar-subtitle {
  color: var(--muted);
  margin-top: 8px;
  max-width: 900px;
  line-height: 1.55;
}
.user-chip {
  background: rgba(255,255,255,.75);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,.8);
  box-shadow: var(--shadow-soft);
  border-radius: 18px;
  padding: 13px 16px;
  min-width: 210px;
  display: grid;
  gap: 4px;
  text-align: right;
}
.user-chip span {
  color: var(--muted);
  font-size: .9rem;
}

.shell-content {
  padding: 0 30px 30px;
  min-width: 0;
}
.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  margin-bottom: 18px;
  font-size: .92rem;
}
.breadcrumbs a { color: var(--muted); }
.breadcrumbs .sep { color: #98a2b3; }

.subnav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 22px;
}
.subnav-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 14px;
  border-radius: 999px;
  font-weight: 700;
  background: var(--primary-3);
  color: #29456b;
  border: 1px solid #c8dcff;
}
.subnav-link.active {
  background: linear-gradient(135deg, var(--primary), #2563eb);
  color: #fff;
  border-color: transparent;
}
.subnav-link:hover { text-decoration: none; }

.public-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 16px;
}
.public-panel {
  width: min(540px, 100%);
}
.auth-shell {
  display: grid;
  gap: 18px;
}
.auth-hero {
  text-align: center;
  padding: 8px 20px 0;
}
.auth-hero h1 { font-size: 2rem; margin-bottom: 10px; }
.auth-hero p { color: var(--muted); line-height: 1.6; }


.hero { padding: 2px 0 0; }
.hero.compact { padding-top: 0; }
.hero h1 { margin-bottom: 8px; font-size: 1.9rem; }
.hero p { color: var(--muted); line-height: 1.55; }
.company-card-grid { align-items: start; }
.bar-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-2);
}
.form-grid-inline { align-items: end; }
.auth-card { width: min(460px, 100%); margin: 0 auto; }

.card {
  background: rgba(255,255,255,.92);
  border: 1px solid rgba(216,225,239,.9);
  border-radius: 22px;
  padding: 22px;
  box-shadow: var(--shadow-soft);
}
.card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 16px;
}
.card-head h2, .card-head h3 { margin-bottom: 0; }
.card-head p { margin-bottom: 0; }
.card-subtitle { color: var(--muted); font-size: .95rem; line-height: 1.5; }

.grid { display: grid; gap: 20px; }
.compact-gap { gap: 16px; }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }

.stat-card {
  background: linear-gradient(180deg, rgba(255,255,255,.95), rgba(248,251,255,.96));
}
.eyebrow {
  font-size: .76rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
  margin-bottom: 12px;
}
.stat-value {
  font-size: 2rem;
  line-height: 1.02;
  font-weight: 800;
  letter-spacing: -.03em;
  color: var(--primary);
}
.hero-number {
  font-size: 2.2rem;
  font-weight: 800;
  letter-spacing: -.03em;
  color: var(--primary);
}
.soft-kpi {
  display: grid;
  gap: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 15px 16px;
}
.soft-kpi span { color: var(--muted); font-size: .92rem; }
.soft-kpi strong { font-size: 1.08rem; }
.soft-kpi.positive strong { color: var(--success); }
.soft-kpi.negative strong { color: var(--danger); }
.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px 24px;
}

.list { display: grid; gap: 12px; }
.list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 14px 16px;
  border-radius: 16px;
  background: #fff;
  border: 1px solid var(--border);
}
.list-item-link:hover {
  text-decoration: none;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.07);
}
.vertical {
  flex-direction: column;
  align-items: flex-start;
}
.compact-list .list-item { padding: 12px 14px; }
.action-list { display: grid; gap: 12px; }
.action-item {
  display: block;
  padding: 14px 16px;
  background: linear-gradient(180deg, #f8fbff, #f3f8ff);
  border: 1px solid var(--border);
  border-radius: 16px;
  color: var(--text);
  font-weight: 700;
}
.action-item:hover {
  text-decoration: none;
  background: #eef4ff;
}

.metric-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.metric-box {
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--surface-2);
}
.metric-box span {
  display: block;
  color: var(--muted);
  font-size: .88rem;
  margin-bottom: 8px;
}
.metric-box strong { font-size: 1.08rem; }

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--primary-3);
  color: var(--primary);
  font-size: .9rem;
  font-weight: 700;
  white-space: nowrap;
}
.badge.success { background: #ecfdf3; color: var(--success); }
.badge.warning { background: #fffaeb; color: var(--warning); }
.badge.large { font-size: 1rem; padding: 8px 16px; }

label {
  display: grid;
  gap: 8px;
  font-weight: 700;
  color: #1d2939;
}
input, textarea, select, button { font: inherit; }
input, textarea, select {
  width: 100%;
  padding: 11px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #fff;
}
textarea { resize: vertical; }
button, .button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 16px;
  border-radius: 12px;
  border: 0;
  background: linear-gradient(135deg, var(--primary), #2563eb);
  color: #fff;
  font-weight: 800;
  cursor: pointer;
}
button.secondary, .button-link.secondary { background: #475467; }
button:hover, .button-link:hover { opacity: .96; text-decoration: none; }

.stack { display: grid; gap: 14px; }
.inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: end;
}
.inline-form label { min-width: 220px; }
.form-actions-inline {
  display: flex;
  align-items: end;
}
.inline-check {
  display: flex;
  align-items: center;
  gap: 10px;
}
.inline-check input { width: auto; }
.compact-form { min-width: 250px; }

.alert {
  padding: 12px 14px;
  border-radius: 12px;
  margin: 10px 0 18px;
}
.alert-error {
  background: #fef3f2;
  color: var(--danger);
  border: 1px solid #fecdca;
}
.alert-success {
  background: #ecfdf3;
  color: var(--success);
  border: 1px solid #abefc6;
}
.muted { color: var(--muted); }
.small { font-size: .92rem; }
.narrow { max-width: 720px; }
.wrap-gap { gap: 16px; flex-wrap: wrap; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
hr { border: 0; border-top: 1px solid var(--border); margin: 20px 0; }

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: #fff;
}
table {
  width: 100%;
  border-collapse: collapse;
  min-width: 620px;
}
thead th {
  text-align: left;
  padding: 12px 12px;
  font-size: .84rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
  background: #f8fbff;
  border-bottom: 1px solid var(--border);
}
td {
  text-align: left;
  padding: 13px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
tbody tr:hover { background: #f9fbff; }

.empty-state {
  padding: 22px;
  border: 1px dashed #cbd5e1;
  border-radius: 18px;
  background: #fafcff;
}
.empty-state h3 { margin-bottom: 8px; }

@media (max-width: 1280px) {
  .body-app .app-shell { grid-template-columns: 250px minmax(0, 1fr); }
}

@media (max-width: 1024px) {
  .body-app .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: static;
    min-height: auto;
    padding-bottom: 12px;
  }
  .sidebar-nav {
    grid-auto-flow: column;
    grid-auto-columns: minmax(180px, 1fr);
    overflow-x: auto;
    padding-bottom: 6px;
  }
  .nav-group-label { grid-column: 1 / -1; }
  .shell-topbar { padding-top: 18px; }
  .cols-2, .cols-3, .cols-4, .detail-grid, .metric-strip { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
}

@media (max-width: 720px) {
  .shell-topbar {
    flex-direction: column;
    align-items: flex-start;
    padding: 18px 16px 14px;
  }
  .shell-content { padding: 0 16px 22px; }
  .user-chip { width: 100%; text-align: left; }
  .card { padding: 18px; border-radius: 18px; }
  .inline-form label, .compact-form { min-width: 100%; }
  .topbar-title { font-size: 1.55rem; }
}


.alert-warning { background: #fffaeb; color: var(--warning); border: 1px solid #fedf89; }
.inline-actions { display:flex; flex-wrap:wrap; gap:8px; }
.inline-actions form { margin:0; }
.credential-box { border:1px solid var(--border); border-radius:18px; background: var(--surface-2); padding:16px; }
.clean-list { margin:0; padding-left:18px; display:grid; gap:8px; color: var(--muted); }
.archive-year { display:grid; gap:14px; }
.archive-year-title { font-size:1.15rem; font-weight:800; letter-spacing:-.02em; }
.archive-period-list { display:grid; gap:12px; }
.archive-period { border:1px solid var(--border); border-radius:18px; background: var(--surface-2); padding:14px; }
.archive-period-head { display:flex; justify-content:space-between; align-items:center; gap:12px; margin-bottom:12px; }
.archive-doc-list { display:grid; gap:10px; }
.archive-doc-row { display:flex; justify-content:space-between; align-items:flex-start; gap:14px; padding:12px 14px; border-radius:14px; background:#fff; border:1px solid var(--border); }
.archive-doc-actions, .archive-doc-meta { color: var(--muted); white-space: nowrap; }
code { background:#111827; color:#fff; padding:4px 8px; border-radius:8px; }
@media (max-width: 900px) { .inline-actions { flex-direction:column; } .archive-doc-row { flex-direction:column; } }


.document-upload-form {
  gap: 14px;
}
.field-group {
  display: grid;
  gap: 10px;
}
.field-label {
  font-weight: 700;
  color: #1d2939;
}
.choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.choice-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fff;
  cursor: pointer;
  font-weight: 600;
  min-height: 52px;
}
.choice-option:hover {
  background: var(--surface-2);
}
.choice-option input[type="radio"] {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--primary);
  flex: 0 0 auto;
}
.choice-option span {
  display: block;
  line-height: 1.35;
}
@media (max-width: 1100px) {
  .choice-grid {
    grid-template-columns: 1fr;
  }
}
