@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  --navy: #102b4e;
  --blue: #176fe8;
  --ink: #1d2b3e;
  --muted: #718096;
  --line: #e4eaf2;
  --bg: #f4f7fb;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 Inter, Arial, sans-serif;
}

a { color: var(--blue); }
button, input, select, textarea { font: inherit; }

.shell {
  min-height: 100vh;
  display: flex;
}

.sidebar {
  width: 260px;
  flex: 0 0 260px;
  background: linear-gradient(180deg, #102b4e, #081b32);
  color: #fff;
  display: flex;
  flex-direction: column;
  padding: 24px 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 5px 8px 23px;
  color: #fff;
  text-decoration: none;
  border-bottom: 1px solid #ffffff1b;
}

.brand-mark {
  display: grid;
  place-items: center;
  background: #fff;
  color: #176fe8;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  font-weight: 800;
  font-size: 18px;
  flex-shrink: 0;
}

.brand b { display: block; font-size: 16px; line-height: 1.35; }
.brand small { display: block; color: #b8c9df; font-size: 12px; margin-top: 4px; }

.sidebar nav {
  display: grid;
  gap: 7px;
  margin-top: 22px;
}

.sidebar nav a {
  display: block;
  padding: 14px;
  border-radius: 8px;
  color: #c7d4e6;
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
}

.sidebar nav a:hover,
.sidebar nav a.active {
  background: #176fe8;
  color: #fff;
}

.side-foot {
  margin-top: auto;
  padding: 18px 8px 4px;
  border-top: 1px solid #ffffff1b;
  color: #b8c9df;
  font-size: 12px;
  line-height: 2;
}
.side-foot a { color: #fff; }

.main {
  flex: 1;
  min-width: 0;
  max-width: calc(100% - 260px);
  padding: 0 32px 32px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 96px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 28px;
}

.topbar h1 {
  font-size: 30px;
  letter-spacing: -.6px;
  line-height: 1.2;
  margin: 5px 0 0;
}

.eyebrow {
  font-size: 12px;
  letter-spacing: 1.5px;
  font-weight: 800;
  color: var(--blue);
}

.top-right { color: var(--muted); font-size: 14px; }

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 26px;
}

.stat, .panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 4px 16px #19355306;
}

.stat { padding: 24px; }
.stat span { display: block; color: var(--muted); font-size: 14px; margin-bottom: 12px; }
.stat strong { font-size: 28px; letter-spacing: -.5px; line-height: 1.25; }

.panel { padding: 24px; margin-bottom: 22px; min-width: 0; }
.panel h2 { font-size: 20px; line-height: 1.3; margin: 0 0 8px; }
.panel p { color: var(--muted); font-size: 14px; margin: 0 0 16px; }

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

.btn {
  display: inline-block;
  background: var(--blue);
  color: #fff;
  border: 0;
  border-radius: 8px;
  padding: 13px 18px;
  text-decoration: none;
  font: 700 14px Inter, Arial, sans-serif;
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover { background: #075cc8; }
.btn-light { background: #fff; border: 1px solid var(--line); color: var(--ink); }
.btn-danger { background: #fff0f0; color: #c73f3f; }
.btn-sm { padding: 8px 11px; font-size: 12px; }
.btn-full { width: 100%; margin-top: 14px; }

.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; white-space: nowrap; font-size: 14px; }
th {
  text-align: left;
  background: #f6f9fd;
  color: #66778c;
  padding: 14px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}
td { padding: 14px; border-bottom: 1px solid #edf1f6; }
tbody tr:last-child td { border-bottom: 0; }
td a { color: var(--blue); font-weight: 700; text-decoration: none; }
.empty { text-align: center; color: #8a98a9; padding: 28px !important; }

.badge {
  background: #e4f8eb;
  color: #18834f;
  border-radius: 20px;
  padding: 5px 10px;
  font-size: 12px;
}
.note { background: #eaf3ff; color: #56708d; border-radius: 9px; padding: 14px; font-size: 13px; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}
.form-grid label, .field, .login-card label {
  display: grid;
  gap: 8px;
  font-size: 13px;
  color: #65758a;
  font-weight: 600;
}
.form-grid input, .form-grid select, .field input, .field select, .search, .filters input,
.form-grid textarea, .field textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid #dce5f0;
  border-radius: 8px;
  padding: 12px 13px;
  font: inherit;
  color: var(--ink);
  background: #fff;
  outline-color: #8bbaff;
}
.form-end { display: flex; align-items: end; }

.billing-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(350px, .9fr);
  gap: 20px;
  align-items: start;
}

.search { margin: 6px 0 16px; }
.items { display: grid; gap: 9px; max-height: 620px; overflow: auto; }

.item {
  display: flex;
  align-items: center;
  gap: 13px;
  text-align: left;
  border: 1px solid #e7edf5;
  background: #fff;
  border-radius: 9px;
  padding: 14px;
  cursor: pointer;
  color: var(--ink);
  min-width: 0;
}
.item:hover { border-color: #9dc5ff; background: #f9fbff; }
.item span { flex: 1; min-width: 0; }
.item b { display: block; font-size: 14px; overflow-wrap: anywhere; }
.item small { display: block; color: #8996a6; font-size: 12px; margin-top: 5px; }
.item strong { font-size: 13px; white-space: nowrap; }
.item em { font-style: normal; background: #e4f8eb; color: #18834f; border-radius: 6px; padding: 6px; font-size: 16px; }

.field { margin: 14px 0; }
.cart { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin: 16px 0; }
.cart-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto 28px;
  align-items: center;
  gap: 12px;
  padding: 13px 0;
  border-bottom: 1px solid #edf1f6;
}
.cart-row:last-child { border-bottom: 0; }
.cart-row b { font-size: 13px; }
.cart-row small { display: block; font-size: 12px; color: #8996a6; margin-top: 4px; }
.qty { display: flex; align-items: center; gap: 7px; }
.qty button, .remove { border: 0; background: #edf3fa; border-radius: 5px; padding: 6px 8px; cursor: pointer; }
.remove { color: #c73f3f; background: #fff0f0; }

.totals { border-top: 1px dashed #d9e3ef; padding-top: 10px; }
.totals > div { display: flex; justify-content: space-between; gap: 12px; margin: 13px 0; color: #66778c; }
.totals b { color: #263b54; }
.totals .grand { background: #e3f8eb; padding: 14px; border-radius: 8px; color: #176b44; font-weight: 800; }
.grand b { font-size: 20px; color: #148650; }

.filters { display: flex; gap: 12px; margin-bottom: 16px; }
.filters input { max-width: 420px; }
.invoice-tools { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 16px; }

.invoice {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 36px;
  max-width: 900px;
  margin: auto;
}
.invoice-head { display: flex; align-items: center; gap: 16px; }
.invoice-head h2 { margin: 0 0 7px; font-size: 24px; }
.invoice-head p { margin: 3px 0; color: #66778c; font-size: 13px; }
.logo-box {
  width: 58px;
  height: 58px;
  border-radius: 12px;
  background: #e8f1ff;
  color: #176fe8;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 21px;
}
.invoice-title { margin-left: auto; text-align: right; font-weight: 800; color: #176fe8; line-height: 1.5; }
.invoice hr { border: 0; border-top: 1px solid var(--line); margin: 24px 0; }
.invoice-meta { display: flex; justify-content: space-between; gap: 16px; line-height: 2; margin-bottom: 22px; font-size: 13px; }
.invoice-total { width: min(340px, 100%); margin: 22px 0 0 auto; }
.invoice-total > div { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; }
.invoice-total .grand { background: #e3f8eb; padding: 14px; border-radius: 7px; }
.thanks { text-align: center; margin-top: 36px; font-weight: 700; }
.powered { text-align: center; color: #8a98a9; font-size: 12px; }

.settings-preview { display: grid; grid-template-columns: 160px 1fr; gap: 16px; padding: 10px 0; }
.settings-preview b { color: #66778c; }

.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: linear-gradient(135deg, #e9f1ff, #f7f9fc);
}
.login-card {
  width: min(480px, 100%);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 36px;
  box-shadow: 0 15px 50px #102b4e12;
  display: grid;
  gap: 17px;
}
.brand-mark.big { width: 58px; height: 58px; font-size: 22px; }
.login-card h1 { font-size: 28px; line-height: 1.25; margin: 0; }
.login-card p { color: var(--muted); margin: 0; }
.login-card input {
  width: 100%;
  padding: 13px;
  border: 1px solid #dce5f0;
  border-radius: 8px;
}
.login-card small { color: #8a98a9; }
.error { background: #fff0f0; color: #b73535; padding: 12px; border-radius: 7px; font-size: 13px; }

@media (max-width: 1200px) {
  .sidebar { width: 230px; flex-basis: 230px; }
  .main { max-width: calc(100% - 230px); padding: 0 22px 26px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .billing-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 700px) {
  body { font-size: 14px; }
  .shell { display: block; }
  .sidebar { width: auto; min-height: auto; padding: 12px; }
  .brand { padding-bottom: 12px; }
  .brand-mark { width: 42px; height: 42px; font-size: 16px; }
  .brand b { font-size: 14px; }
  .brand small { font-size: 11px; }
  .sidebar nav { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 12px; gap: 5px; }
  .sidebar nav a { font-size: 12px; padding: 10px; }
  .side-foot { margin-top: 10px; font-size: 11px; }
  .main { max-width: none; padding: 0 12px 20px; }
  .topbar { min-height: 72px; margin-bottom: 18px; }
  .topbar h1 { font-size: 21px; }
  .eyebrow { font-size: 10px; }
  .top-right { font-size: 11px; }
  .stats { gap: 9px; }
  .stat { padding: 13px; border-radius: 11px; }
  .stat strong { font-size: 19px; }
  .stat span { font-size: 11px; }
  .panel { padding: 14px; margin-bottom: 14px; }
  .panel h2 { font-size: 17px; }
  .panel p { font-size: 12px; }
  .btn { font-size: 12px; padding: 10px 12px; }
  .form-grid { grid-template-columns: 1fr; }
  .billing-grid { display: block; }
  .invoice { padding: 18px; }
  .invoice-head h2 { font-size: 18px; }
  .invoice-meta { flex-direction: column; }
  .cart-row { grid-template-columns: minmax(0, 1fr) auto 24px; gap: 8px; }
  .cart-row > b { display: none; }
  .filters { flex-wrap: wrap; }
  .filters input { max-width: none; }
  .settings-preview { grid-template-columns: 100px 1fr; }
  table { font-size: 12px; }
  th { font-size: 11px; padding: 10px; }
  td { padding: 10px; }
  .login-card { padding: 24px; }
  .login-card h1 { font-size: 23px; }
}

@media print {
  body { background: #fff; }
  .sidebar, .topbar, .invoice-tools { display: none !important; }
  .main { max-width: none; padding: 0; }
  .page { display: block; }
  .invoice { border: 0; box-shadow: none; padding: 0; max-width: none; }
  .invoice table { white-space: normal; }
}
