:root {
  --bg: #F8FAFC;
  --surface: #FFFFFF;
  --ink: #071D26;
  --brand: #0F4C5C;
  --accent: #8C2703;
  --success: #16A34A;
  --muted: #64748B;
  --muted-2: #94A3B8;
  --border: #E2E8F0;
  --divider: #F1F5F9;
  --slate: #334155;
  --sidebar: #071D26;
  --sidebar-border: #14313D;
  --sidebar-muted: #9FB8BF;
  --sidebar-muted-2: #8AA6AD;
  --radius: 6px;
  --radius-lg: 8px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Inter', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

::placeholder { color: var(--muted-2); }
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--accent); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: 0; }

/* ---- Buttons ---- */
.btn {
  padding: 10px 18px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.btn--primary { background: var(--brand); color: #FFFFFF; }
.btn--accent { background: var(--accent); color: #FFFFFF; }
.btn--success { background: var(--success); color: #FFFFFF; }
.btn--ghost { background: var(--surface); color: var(--ink); border-color: var(--border); }
.btn--block { width: 100%; justify-content: center; }
.btn--sm { padding: 9px 16px; font-size: 13px; }

/* ---- Fields ---- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; font-weight: 600; color: var(--brand); }
.field input, .field select, .field textarea {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  color: var(--ink);
  background: var(--bg);
  font-family: inherit;
}
.field__error { font-size: 12px; color: var(--accent); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid .span-2 { grid-column: span 2; }

/* ---- Auth (login / register) ---- */
.auth { display: flex; height: 100vh; width: 100%; }
.auth__brand {
  width: 46%;
  min-width: 380px;
  background: var(--sidebar);
  color: #FFFFFF;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 56px;
}
.auth__brand-lead { font-size: 34px; font-weight: 700; line-height: 1.25; max-width: 420px; }
.auth__brand-sub { font-size: 15px; color: var(--sidebar-muted); margin-top: 16px; max-width: 380px; line-height: 1.6; }
.auth__brand-foot { font-size: 13px; color: #5C7B84; }
.auth__panel { flex: 1; display: flex; align-items: center; justify-content: center; background: var(--surface); }
.auth__card { width: 100%; max-width: 380px; padding: 24px; }
.auth__title { font-size: 22px; font-weight: 700; color: var(--ink); }
.auth__subtitle { font-size: 14px; color: var(--muted); margin-top: 6px; margin-bottom: 32px; }
.auth__form { display: flex; flex-direction: column; gap: 16px; }
.auth__alt { text-align: center; font-size: 13px; margin-top: 16px; color: var(--muted); }
.alert { padding: 11px 14px; border-radius: var(--radius); font-size: 13px; }
.alert--error { background: #FBE3D8; color: var(--accent); }
.alert--info { background: var(--divider); color: var(--muted); }
.alert--success { background: #DCFCE7; color: var(--success); }

.brand-mark { display: flex; align-items: center; gap: 12px; }
.brand-mark__name { font-size: 24px; font-weight: 800; color: #FFFFFF; letter-spacing: -0.02em; }

/* ---- App shell ---- */
.app { display: flex; height: 100vh; width: 100%; overflow: hidden; }
.sidebar {
  width: 248px;
  min-width: 248px;
  background: var(--sidebar);
  display: flex;
  flex-direction: column;
  padding: 24px 16px;
}
.sidebar__brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 24px 8px; }
.sidebar__brand .brand-mark__name { font-size: 18px; }
.nav { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.nav__item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-lg);
  font-size: 13px;
  font-weight: 600;
  color: var(--sidebar-muted);
  cursor: pointer;
}
.nav__item:hover { color: #FFFFFF; }
.nav__item--active { background: var(--brand); color: #FFFFFF; }
.nav__item--soon { color: #5C7B84; cursor: default; }
.nav__item--soon:hover { color: #5C7B84; }
.nav__soon-tag { margin-left: auto; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; }
.sidebar__spacer { flex: 1; }
.sidebar__user { border-top: 1px solid var(--sidebar-border); padding-top: 16px; padding-left: 8px; display: flex; align-items: center; gap: 10px; }
.avatar { width: 34px; height: 34px; border-radius: var(--radius); background: var(--brand); color: #FFFFFF; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; }
.sidebar__user-name { font-size: 13px; font-weight: 600; color: #FFFFFF; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar__signout { font-size: 12px; color: var(--sidebar-muted-2); cursor: pointer; background: none; border: none; padding: 0; font-family: inherit; }

.app__main { flex: 1; display: flex; flex-direction: column; min-width: 0; overflow: hidden; }
.topbar {
  height: 76px;
  min-height: 76px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
}
.topbar__title { font-size: 20px; font-weight: 700; color: var(--ink); }
.topbar__subtitle { font-size: 13px; color: var(--muted); margin-top: 2px; }
.content { flex: 1; overflow-y: auto; padding: 32px; }

/* ---- Cards / grids ---- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.card--pad { padding: 20px; }
.card__header { padding: 18px 20px; border-bottom: 1px solid var(--border); font-size: 15px; font-weight: 700; color: var(--ink); }
.grid { display: grid; gap: 16px; }
.grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.section-limit { max-width: 640px; }

.stat__label { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.stat__value { font-size: 26px; font-weight: 800; color: var(--ink); margin-top: 6px; }
.stat__sub { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* ---- Tables ---- */
.table { width: 100%; border-collapse: collapse; }
.table thead tr { background: var(--bg); }
.table th { text-align: left; padding: 10px 20px; font-size: 12px; color: var(--muted); font-weight: 600; }
.table td { padding: 12px 20px; font-size: 13px; color: var(--slate); border-top: 1px solid var(--divider); }
.table td.num, .table th.num { text-align: right; }
.table .strong { font-weight: 600; color: var(--ink); }

/* ---- Badges ---- */
.badge { display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.badge--draft { background: #E2E8F0; color: #334155; }
.badge--issued { background: #DCEEF2; color: #0F4C5C; }
.badge--paid { background: #DCFCE7; color: #16A34A; }
.badge--overdue { background: #FBE3D8; color: #8C2703; }

.page-actions { display: flex; justify-content: flex-end; margin-bottom: 16px; }
