/* Swara Books — single stylesheet, no build tools. Accent #1e4a8c. */

:root {
  --accent: #1e4a8c;
  --accent-dark: #16376a;
  --accent-soft: #e8eef8;
  --bg: #f4f6fa;
  --surface: #ffffff;
  --text: #1c2434;
  --text-muted: #6b7688;
  --border: #e4e8ef;
  --green: #157a4a;
  --green-soft: #e2f5ea;
  --red: #b3372f;
  --red-soft: #fbe9e7;
  --blue-soft: #e3ecfa;
  --shadow: 0 1px 3px rgba(20, 33, 61, .06), 0 6px 18px rgba(20, 33, 61, .05);
  --radius: 12px;
  --sidebar-w: 232px;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
          "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }
body {
  font-family: var(--font);
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a.link:hover { text-decoration: underline; }

/* ------------------------------------------------ layout */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: linear-gradient(180deg, #17325e 0%, var(--accent) 100%);
  color: #dbe4f3;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, .12);
}
.brand-mark {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: rgba(255, 255, 255, .14);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
}
.brand-mark.big { width: 48px; height: 48px; background: var(--accent); margin: 0 auto 12px; }
.brand-name { font-weight: 700; font-size: 16.5px; letter-spacing: .2px; color: #fff; }

.nav { padding: 14px 10px; display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-link {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px;
  border-radius: 9px;
  color: #c3d0e6;
  font-weight: 500;
  transition: background .15s, color .15s;
}
.nav-link svg { opacity: .85; }
.nav-link:hover { background: rgba(255, 255, 255, .09); color: #fff; }
.nav-link.active { background: rgba(255, 255, 255, .16); color: #fff; }

.sidebar-footer { padding: 10px; border-top: 1px solid rgba(255, 255, 255, .12); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 28px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20;
}
.page-title { font-size: 19px; font-weight: 700; flex: 1; }
.topbar-actions { display: flex; gap: 10px; }

.menu-btn {
  display: none;
  background: none; border: none; color: var(--text);
  cursor: pointer; padding: 4px;
}

.content { padding: 26px 28px 48px; max-width: 1180px; width: 100%; }

.scrim {
  display: none;
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, .45);
  z-index: 30;
}

/* ------------------------------------------------ cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 22px;
  margin-bottom: 22px;
}
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
.card-head h2 { font-size: 15px; font-weight: 700; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 18px;
  margin-bottom: 22px;
}
.stat { margin-bottom: 0; }
.stat-label { font-size: 12.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .6px; color: var(--text-muted); }
.stat-value { font-size: 27px; font-weight: 750; margin: 6px 0 2px; color: var(--accent); font-variant-numeric: tabular-nums; }
.stat-sub { font-size: 12.5px; color: var(--text-muted); }

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
}
.two-col .card { margin-bottom: 22px; }

/* ------------------------------------------------ tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px; white-space: nowrap; }
th {
  font-size: 12px; font-weight: 650; text-transform: uppercase; letter-spacing: .5px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
td { border-bottom: 1px solid #f0f2f6; font-variant-numeric: tabular-nums; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: #f8fafd; }
.num { text-align: right; }

/* ------------------------------------------------ pills */
.pill {
  display: inline-block;
  padding: 3px 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 650;
  text-transform: capitalize;
}
.pill-paid { background: var(--green-soft); color: var(--green); }
.pill-final { background: var(--blue-soft); color: var(--accent); }
.pill-cancelled { background: var(--red-soft); color: var(--red); }
.pill-draft { background: #eef0f4; color: var(--text-muted); }

/* ------------------------------------------------ buttons */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 16px;
  border-radius: 9px;
  border: 1px solid transparent;
  font: inherit; font-weight: 600; font-size: 14px;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); }
.btn-ghost { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.btn-block { width: 100%; justify-content: center; padding: 11px; }

.icon-btn {
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); padding: 6px; border-radius: 6px;
  font-size: 16px; line-height: 1;
}
.icon-btn:hover { background: var(--red-soft); color: var(--red); }

/* ------------------------------------------------ forms */
.field { margin-bottom: 14px; min-width: 0; }
.field label {
  display: block;
  font-size: 12.5px; font-weight: 600; color: var(--text-muted);
  margin-bottom: 5px;
}
input, select, textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 9px;
  font: inherit;
  color: var(--text);
  background: var(--surface);
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(30, 74, 140, .14);
}
.field-row { display: flex; gap: 14px; }
.field-row .field { flex: 1; }
.field-row.wrap { flex-wrap: wrap; }
.field-row.wrap .field { min-width: 170px; }
.field.narrow { max-width: 150px; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin: 4px 0 6px; }
.inline-form .form-actions { margin-bottom: 0; }

.items-table input, .items-table select { padding: 7px 9px; }
.items-table td { padding: 6px 6px; }
.items-table .amount-cell { font-weight: 650; text-align: right; padding-right: 12px; }

.totals {
  margin-left: auto;
  margin-top: 16px;
  max-width: 320px;
  border-top: 1px solid var(--border);
  padding-top: 10px;
}
.totals-row {
  display: flex; justify-content: space-between;
  padding: 4px 0;
  font-variant-numeric: tabular-nums;
}
.totals-row.grand {
  font-weight: 750; font-size: 16.5px;
  border-top: 1px solid var(--border);
  margin-top: 6px; padding-top: 9px;
  color: var(--accent);
}

/* ------------------------------------------------ misc */
.muted { color: var(--text-muted); }
.small { font-size: 12.5px; }
.empty { text-align: center; padding: 34px 16px; }
.empty p:first-child { font-weight: 650; font-size: 15.5px; margin-bottom: 4px; }
.empty .btn { margin-top: 14px; }

.kv { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid #f0f2f6; }
.kv:last-child { border-bottom: none; }
.kv span:first-child { color: var(--text-muted); }
.kv.grand span { font-weight: 750; color: var(--accent); }
.detail-name { font-size: 17px; font-weight: 700; margin-bottom: 4px; }

.alert {
  background: var(--red-soft); color: var(--red);
  border: 1px solid #f2c4bf;
  border-radius: 9px;
  padding: 10px 14px;
  margin-bottom: 16px;
  font-weight: 550;
}

/* ------------------------------------------------ auth */
.auth-body {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh;
  background:
    radial-gradient(1000px 500px at 80% -10%, rgba(30, 74, 140, .16), transparent),
    radial-gradient(800px 400px at 0% 110%, rgba(30, 74, 140, .12), transparent),
    var(--bg);
  padding: 24px;
}
.auth-card {
  width: 100%; max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 8px 40px rgba(20, 33, 61, .12);
  padding: 36px 34px 28px;
}
.auth-brand { text-align: center; margin-bottom: 24px; }
.auth-brand h1 { font-size: 22px; font-weight: 750; }
.auth-brand .brand-mark { color: #fff; }
.auth-form .btn { margin-top: 6px; }
.auth-switch { text-align: center; margin-top: 18px; font-size: 13.5px; color: var(--text-muted); }

/* ------------------------------------------------ responsive */
@media (max-width: 900px) {
  .two-col { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    z-index: 40;
    transform: translateX(-100%);
    transition: transform .22s ease;
    height: 100vh;
  }
  .sidebar.open { transform: translateX(0); }
  .scrim.show { display: block; }
  .menu-btn { display: inline-flex; }
  .topbar { padding: 13px 16px; }
  .content { padding: 18px 16px 40px; }
  .page-title { font-size: 17px; }
  .field-row { flex-wrap: wrap; }
  .field.narrow { max-width: none; }
}
