:root {
  --ink: #16324a;
  --muted: #5d7690;
  --line: rgba(120, 168, 210, 0.35);
  --glass: rgba(255, 255, 255, 0.72);
  --blue: #2f8fe0;
  --blue-deep: #1769b0;
  --paid: #1c8a4a;
  --unpaid: #b86a00;
  --overdue: #c0392b;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: "Segoe UI", Tahoma, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(900px 420px at 8% -10%, rgba(255, 255, 255, 0.9), transparent 60%),
    radial-gradient(800px 480px at 100% 0%, rgba(150, 205, 245, 0.55), transparent 55%),
    linear-gradient(165deg, #eef7ff 0%, #d7ebfa 48%, #c5e0f6 100%);
}
a { color: var(--blue-deep); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
.brandbar, .nav, .card, .login, .sumbox, .history {
  background: var(--glass);
  border: 1px solid rgba(255, 255, 255, 0.75);
  box-shadow: 0 10px 30px rgba(70, 120, 170, 0.12);
  backdrop-filter: blur(16px);
}
.brandbar {
  display: flex; align-items: center; justify-content: space-between;
  margin: 10px 12px 0; padding: 8px 16px; border-radius: 16px;
}
.brandbar h1 { margin: 0; font-weight: 700; font-size: 14px; letter-spacing: 0.2px; }
.nav {
  display: flex; align-items: center; gap: 4px;
  margin: 8px 12px 0; padding: 4px; min-height: 42px; border-radius: 14px;
}
.nav a { color: var(--ink); padding: 8px 14px; border-radius: 10px; font-size: 14px; }
.nav a.active, .nav a:hover { background: rgba(47, 143, 224, 0.16); color: var(--blue-deep); }
.nav .grow { margin-left: auto; }
.who { color: var(--muted); font-size: 12px; padding-right: 10px; }
.page { padding: 12px; }
.tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.find, .field input, .field select, .field textarea, .portal input, .portal select {
  border: 1px solid var(--line); border-radius: 8px; background: rgba(255,255,255,0.86);
  height: 32px; padding: 0 8px;
}
.find { min-width: 200px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  height: 32px; padding: 0 12px; border-radius: 9px;
  border: 1px solid var(--line); background: rgba(255,255,255,0.8); cursor: pointer; color: var(--ink);
}
.btn.primary { background: linear-gradient(180deg, #59b0f0, #2f8fe0); border-color: #2b86d4; color: white; }
.btn.danger { color: var(--overdue); }
.card { border-radius: 16px; overflow: auto; }
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left; background: rgba(47, 143, 224, 0.12); color: var(--blue-deep);
  font-size: 12px; font-weight: 650; padding: 8px 10px;
}
td { padding: 8px 10px; border-bottom: 1px solid rgba(180, 210, 230, 0.45); font-size: 13px; background: rgba(255,255,255,0.35); }
tr.click:hover td { background: rgba(47, 143, 224, 0.08); cursor: pointer; }
.num { text-align: right; color: var(--blue-deep); font-variant-numeric: tabular-nums; white-space: nowrap; }
.serial { font-weight: 700; color: var(--blue-deep); }
.info.paid { color: var(--paid); }
.sumbox {
  margin-left: auto; min-width: 180px; border-radius: 14px; padding: 6px 14px; text-align: right;
}
.sumbox small { display: block; color: var(--muted); font-size: 11px; letter-spacing: 0.04em; text-transform: uppercase; }
.sumbox strong { font-size: 18px; color: var(--blue-deep); }
.filters a, .years a {
  margin-right: 6px; padding: 6px 10px; border-radius: 999px; color: var(--ink);
  background: rgba(255,255,255,0.7); border: 1px solid var(--line); font-size: 13px;
}
.filters a.on, .years a.on { background: var(--blue); color: white; border-color: var(--blue); }
.dash { display: grid; grid-template-columns: 1.4fr 0.8fr; gap: 12px; }
.chart-box { padding: 12px 14px 18px; }
.chart-box h2 { margin: 0 0 8px; font-size: 16px; font-weight: 600; text-align: center; }
.bars { display: flex; align-items: flex-end; gap: 6px; height: 180px; }
.bars .col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.bars .bit { width: 100%; background: linear-gradient(#9fd4fb, #2f8fe0); border-radius: 6px 6px 0 0; min-height: 2px; }
.bars .mo { font-size: 10px; color: var(--muted); margin-top: 4px; }
.section { padding: 16px 18px 20px; margin-bottom: 14px; }
.section h2, .history h2, .chart-box h2 { margin: 0 0 8px; font-size: 12px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--blue-deep); }
td.info { white-space: nowrap; }
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 10px; }
.field { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.field.wide, .field.span2 { grid-column: span 2; }
.field span { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.field textarea { height: 64px; padding: 8px; }
.serial-box { font-weight: 700; color: var(--blue-deep); background: rgba(47, 143, 224, 0.08) !important; }
.heading { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.heading h1, .page > h1 { margin: 0; font-weight: 700; font-size: 14px; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; }
.status { font-size: 12px; padding: 2px 8px; border-radius: 999px; background: rgba(47,143,224,0.12); text-transform: capitalize; }
.status.paid { color: var(--paid); }
.status.overdue { color: var(--overdue); }
.note { color: var(--muted); font-size: 12px; margin: 0; }
.login-wrap { min-height: 100vh; display: grid; place-items: center; }
.login { width: 400px; max-width: 100%; border-radius: 18px; padding: 28px; }
.login h1 { margin: 0 0 4px; font-size: 26px; font-weight: 560; }
.captcha { display: flex; gap: 10px; align-items: center; margin: 6px 0 10px; }
.captcha img { border: 1px solid var(--line); border-radius: 8px; height: 56px; background: white; }
.err { background: #fdecea; color: var(--overdue); padding: 8px 10px; margin-bottom: 10px; border-radius: 8px; }
.paper { width: 840px; max-width: 100%; margin: 20px auto; background: white; padding: 36px; border-radius: 16px; }
.count { color: var(--muted); font-size: 13px; margin: 0 0 8px; }
body.fit { height: 100vh; overflow: hidden; }
body.fit .page { height: calc(100vh - 96px); overflow: hidden; display: flex; }
.sheet { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 10px; }
.invoice-form { min-height: 0; display: flex; flex-direction: column; gap: 8px; }
.fields.tight { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.lines-wrap { flex: 1; min-height: 0; overflow: auto; }
.lines-wrap th, .lines-wrap td { padding: 4px 6px; }
.portal input, .portal select { width: 100%; height: 28px; }
.footline { display: flex; align-items: center; gap: 10px; }
.totals.inline { margin-left: auto; display: flex; gap: 14px; }
.totals.inline div { display: flex; flex-direction: column; font-size: 11px; color: var(--muted); }
.totals.inline b { color: var(--ink); font-size: 13px; }
.totals.inline .grand b { color: var(--blue-deep); font-size: 16px; }
.history { border-radius: 16px; padding: 12px; min-height: 0; display: flex; flex-direction: column; }
.hist-name { margin: 0; font-weight: 650; }
.hist-sums { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; margin: 8px 0; }
.hist-sums div { background: rgba(255,255,255,0.7); border-radius: 10px; padding: 6px; }
.hist-sums span { display: block; font-size: 10px; color: var(--muted); text-transform: uppercase; }
.hist-sums b { font-size: 12px; }
.hist-list { overflow: auto; min-height: 0; display: flex; flex-direction: column; gap: 6px; }
.hist-list a {
  display: grid; grid-template-columns: auto 1fr; gap: 0 8px;
  padding: 6px 8px; border-radius: 10px; background: rgba(255,255,255,0.72); color: var(--ink);
}
.hist-list b { color: var(--blue-deep); }
.hist-list em { font-style: normal; text-align: right; color: var(--blue-deep); }
.hist-list small { grid-column: 1 / -1; color: var(--muted); }
@media print { .noprint, .brandbar, .nav { display: none !important; } body { background: white; } }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.search { display: flex; gap: 8px; flex: 1; min-width: 0; }
.table-scroll { overflow-x: auto; }
.fit-table { width: 100%; min-width: 860px; }
.section { padding: 10px 12px; margin-bottom: 8px; }
.owner { display: grid; grid-template-columns: 1.15fr 0.85fr; gap: 12px; align-items: start; }
.owner-figures { display: grid; gap: 10px; }
.figure { padding: 14px 16px; }
.figure strong { display: block; margin-top: 8px; font-size: 22px; color: var(--blue-deep); }
.dash { grid-template-columns: minmax(0, 1fr); }
.chart-box { max-width: 520px; }
.gate {
  min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 22px; padding: 24px 16px; color: white;
  background:
    radial-gradient(circle at 18% 20%, rgba(70, 190, 230, 0.16), transparent 26%),
    radial-gradient(circle at 82% 78%, rgba(70, 190, 230, 0.12), transparent 24%),
    linear-gradient(165deg, #2a4258, #1b3144 55%, #142838);
}
.panel {
  width: min(460px, 100%); padding: 28px 26px 20px; border-radius: 22px;
  background: rgba(160, 196, 220, 0.16);
  border: 2px solid rgba(80, 220, 255, 0.92);
  box-shadow: 0 0 24px rgba(0, 210, 255, 0.32), inset 0 0 36px rgba(255,255,255,0.05);
}
.panel h1 { margin: 0 0 18px; text-align: center; font-size: 28px; font-weight: 650; color: white; }
.glow { display: block; margin: 0 0 12px; }
.glow > span:first-child { display: block; margin-bottom: 5px; font-size: 12px; letter-spacing: 0.08em; color: #e7f3fb; }
.box {
  display: flex; align-items: center; gap: 8px; min-height: 42px; padding: 0 10px; border-radius: 10px;
  border: 1.5px solid rgba(80, 220, 255, 0.9); background: rgba(10, 24, 38, 0.28);
  box-shadow: 0 0 12px rgba(0, 200, 255, 0.22);
}
.box input { flex: 1; height: 40px; border: 0; background: transparent; color: white; outline: none; }
.box svg { width: 18px; height: 18px; fill: none; stroke: #e7f3fb; stroke-width: 1.7; }
.eye { border: 0; background: transparent; color: #e7f3fb; cursor: pointer; font-size: 16px; }
.caprow { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.caprow img { background: white; border-radius: 8px; }
.caprow a { color: white; }
.seal {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  background: rgba(15, 23, 42, 0.75); border: 1px solid rgba(56, 189, 248, 0.25);
  padding: 8px 12px; border-radius: 20px; max-width: 100%; margin: 15px auto 0;
  color: #cbd5e1; font-size: 11px; line-height: 1; white-space: nowrap;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}
.seal .pulse {
  width: 8px; height: 8px; background: #22c55e; border-radius: 50%; box-shadow: 0 0 8px #22c55e;
}
.enter {
  width: 100%; height: 46px; margin-top: 6px; border-radius: 12px; cursor: pointer; color: #e9f9ff;
  background: transparent; border: 2px solid rgba(80, 220, 255, 0.95);
  box-shadow: 0 0 16px rgba(0, 210, 255, 0.35); font-size: 18px;
}
.billpop { border: 0; border-radius: 16px; padding: 14px; width: min(720px, 96vw); background: rgba(255,255,255,0.96); color: var(--ink); }
.billpop::backdrop { background: rgba(18, 40, 64, 0.45); }
.billbar { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.thumbs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.thumb { width: 120px; border: 1px solid var(--line); border-radius: 10px; background: white; padding: 4px; cursor: pointer; }
.thumb img { width: 112px; height: 84px; object-fit: cover; display: block; border-radius: 6px; }
.thumb span { display: block; font-size: 11px; margin-top: 4px; }
.fullpage { width: min(920px, 98vw); }
.fullpage img { width: 100%; max-height: 75vh; object-fit: contain; background: #eef5fb; }
.credit { width: min(460px, 100%); display: flex; justify-content: space-between; gap: 16px; font-size: 16px; }
.credit a { color: white; text-decoration: underline; }
@media (max-width: 1100px) {
  .fields.tight, .grid2, .owner { grid-template-columns: 1fr; }
  body.fit { height: auto; overflow: auto; }
  body.fit .page { height: auto; overflow: visible; }
  .sheet { grid-template-columns: 1fr; }
}
@media (max-width: 800px) {
  .brandbar, .nav { margin: 6px; flex-wrap: wrap; }
  .nav a { padding: 8px 10px; }
  .nav .grow, .sumbox, .search { width: 100%; margin-left: 0; }
  .find { min-width: 0; flex: 1; }
  .fields, .hist-sums { grid-template-columns: 1fr; }
  .credit { flex-direction: column; }
  .footline, .totals.inline { flex-wrap: wrap; }
}
