/* Sanei Billing — application shell */
:root {
  --ink: #142033;
  --muted: #5c6b80;
  --line: #e4e8ef;
  --paper: #f4f6f9;
  --card: #ffffff;
  --navy: #101a2c;
  --navy-2: #18263d;
  --accent: #1f6f5b;
  --accent-2: #174f42;
  --gold: #c4a574;
  --danger: #b42318;
  --warn: #b54708;
  --ok: #067647;
  --shadow: 0 1px 2px rgba(16, 26, 44, 0.04), 0 8px 24px rgba(16, 26, 44, 0.04);
  --radius: 12px;
  --side: 248px;
}

* { box-sizing: border-box; }
html { font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif; }
body { margin: 0; background: radial-gradient(1200px 500px at 10% -10%, #e7f3ee 0%, transparent 45%), var(--paper); color: var(--ink); line-height: 1.5; }
a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; }

.app { display: flex; min-height: 100vh; }
.side {
  width: var(--side);
  background: var(--navy);
  color: #d7deea;
  display: flex;
  flex-direction: column;
  padding: 1.25rem 0.9rem;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand { display: flex; gap: 0.75rem; align-items: center; padding: 0.2rem 0.55rem 1.25rem; }
.mark {
  width: 38px; height: 38px; border-radius: 10px;
  background: linear-gradient(160deg, #2a8f76, #12382e);
  color: #fff; display: grid; place-items: center;
  font-weight: 700; letter-spacing: 0.04em; font-size: 0.78rem;
  border: 1px solid rgba(196, 165, 116, 0.55);
}
.brand strong { display: block; color: #fff; font-size: 0.95rem; letter-spacing: 0.01em; }
.brand span { display: block; color: #93a0b5; font-size: 0.72rem; margin-top: 0.1rem; }
.side nav { display: flex; flex-direction: column; gap: 0.45rem; }
.side nav a {
  color: #c5cedb; padding: 0.62rem 0.75rem; border-radius: 12px;
  font-size: 0.92rem; font-weight: 650; text-decoration: none;
  transition: transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.2s, box-shadow 0.2s;
}
.side nav a:hover { background: var(--navy-2); color: #fff; transform: translateY(-1px); }
.side nav a:active, .side nav a.pressed { transform: translateY(2px) scale(0.98); }
.side nav a.active {
  background: linear-gradient(180deg, #243656, #1a2942);
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.16), 0 4px 0 #0c1422, 0 8px 14px rgba(0,0,0,0.25);
}
.side .signout {
  margin-top: auto; background: linear-gradient(180deg, #24344e, #18263c); color: #e8eef8;
  border: 0; border-radius: 12px; padding: 0.62rem 0.75rem; cursor: pointer; text-align: left; font-weight: 650;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.16), 0 4px 0 #0c1422;
  transition: transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.side .signout:hover { color: #fff; }
.side .signout:active, .side .signout.pressed { transform: translateY(3px); box-shadow: inset 0 2px 4px rgba(0,0,0,0.25), 0 1px 0 #0c1422; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.top {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 1.25rem 1.75rem 0.35rem;
}
.eyebrow { margin: 0; color: var(--gold); font-size: 0.72rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; }
.top h1 { margin: 0.15rem 0 0; font-size: 1.55rem; letter-spacing: -0.02em; }
.top p.lead { margin: 0.25rem 0 0; color: var(--muted); font-size: 0.92rem; }
.content { padding: 0.85rem 1.75rem 2.5rem; }

.card {
  background: linear-gradient(180deg, #ffffff 0%, #fbfcfe 100%);
  border: 1px solid rgba(255,255,255,0.7);
  border-radius: 18px;
  padding: 1.15rem 1.2rem; margin-bottom: 1rem;
  box-shadow: inset 0 1px 0 #fff, 0 10px 0 rgba(16, 26, 44, 0.03), 0 18px 40px rgba(16, 26, 44, 0.06);
}
.card h2 { margin: 0 0 0.35rem; font-size: 1.02rem; font-weight: 700; color: var(--ink); letter-spacing: 0; text-transform: none; }
.card h3 { margin: 0.2rem 0 0.4rem; font-size: 0.95rem; }
.section-label {
  grid-column: 1 / -1; margin: 0 0 0.15rem; padding: 0;
  font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--muted); font-weight: 700;
}

.btn {
  --face: #2f9d7e;
  --lip: #145444;
  display: inline-flex; align-items: center; justify-content: center; gap: 0.35rem;
  background: linear-gradient(180deg, #5ed4b4 0%, var(--face) 48%, #1d7a62 100%);
  color: #fff; border: 0;
  padding: 0.62rem 1.05rem; border-radius: 14px; font-size: 0.92rem; cursor: pointer; font-weight: 700;
  text-decoration: none; position: relative; user-select: none;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.55),
    inset 0 -2px 0 rgba(0,0,0,0.12),
    0 5px 0 var(--lip),
    0 10px 16px rgba(16, 40, 32, 0.18);
  transform: translateY(0);
  margin: 0 0 8px;
  transition: transform 0.34s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.34s cubic-bezier(0.34, 1.56, 0.64, 1), filter 0.2s;
}
.btn:hover { text-decoration: none; filter: brightness(1.04); transform: translateY(-1px); }
.btn:active, .btn.pressed {
  transform: translateY(5px) scale(0.985);
  box-shadow:
    inset 0 2px 4px rgba(0,0,0,0.16),
    0 1px 0 var(--lip),
    0 2px 6px rgba(16, 40, 32, 0.12);
}
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }
.btn-outline {
  --lip: #c5cedb;
  background: linear-gradient(180deg, #ffffff, #eef2f7);
  color: var(--ink);
  box-shadow: inset 0 1px 0 #fff, 0 5px 0 #d5dce6, 0 10px 16px rgba(16, 26, 44, 0.06);
}
.btn-success { --face: #128a55; --lip: #0b5c38; background: linear-gradient(180deg, #4dcc8a, #128a55 55%, #0d6b42); }
.btn-danger { --face: #d14343; --lip: #8d1d1d; background: linear-gradient(180deg, #f08a8a, #d14343 55%, #b42318); color: #fff; }
.btn-sm { padding: 0.36rem 0.65rem; font-size: 0.78rem; border-radius: 11px; box-shadow: inset 0 1px 0 rgba(255,255,255,0.5), 0 3px 0 var(--lip), 0 6px 10px rgba(16,26,44,0.1); }
.btn-sm:active, .btn-sm.pressed { transform: translateY(3px) scale(0.98); }

.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 10px; }
table { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
th, td { border-bottom: 1px solid var(--line); padding: 0.62rem 0.75rem; text-align: left; vertical-align: middle; }
th { background: #f8fafc; font-weight: 700; color: #3e4d63; font-size: 0.72rem; letter-spacing: 0.06em; text-transform: uppercase; position: sticky; top: 0; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #f7faf8; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

.badge { display: inline-block; padding: 0.16rem 0.5rem; border-radius: 999px; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.02em; }
.badge-valid { background: #e7f6ef; color: #067647; }
.badge-warning { background: #fff4e5; color: #b54708; }
.badge-error { background: #fdecec; color: #b42318; }
.badge-skipped { background: #eef1f6; color: #475569; }

.stat { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.75rem; margin-bottom: 1rem; }
.stat-item { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 0.9rem 1rem; }
.stat-item .v { font-size: 1.45rem; font-weight: 750; color: var(--ink); font-variant-numeric: tabular-nums; }
.stat-item .l { font-size: 0.72rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; }

.dropzone {
  border: 0; border-radius: 18px; padding: 2.2rem 1rem;
  text-align: center; cursor: pointer;
  background: linear-gradient(180deg, #ffffff, #f4f7fb);
  box-shadow: inset 0 1px 0 #fff, 0 6px 0 #e1e7f0, 0 14px 24px rgba(16,26,44,0.06);
  transition: transform 0.34s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.34s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.dropzone:hover { transform: translateY(-2px); }
.dropzone:active, .dropzone.drag-over { transform: translateY(4px) scale(0.995); box-shadow: inset 0 3px 8px rgba(16,26,44,0.08), 0 1px 0 #e1e7f0; }
.dropzone p { margin: 0 0 0.35rem; color: var(--ink); font-size: 1rem; }
.dropzone small { color: var(--muted); }

input, select, textarea {
  width: 100%; padding: 0.58rem 0.75rem; border: 1px solid #d7deea; border-radius: 12px;
  background: linear-gradient(180deg, #f3f5f9, #fff 40%);
  color: var(--ink); font-size: 0.92rem;
  box-shadow: inset 0 2px 4px rgba(16, 26, 44, 0.06), inset 0 1px 0 rgba(255,255,255,0.8);
  transition: box-shadow 0.25s cubic-bezier(0.34, 1.4, 0.64, 1), border-color 0.2s;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: #2f9d7e;
  box-shadow: inset 0 2px 5px rgba(16, 26, 44, 0.08), 0 0 0 4px rgba(47, 157, 126, 0.16);
}
label { display: block; font-size: 0.75rem; font-weight: 700; color: #3d4d63; margin-bottom: 0.28rem; letter-spacing: 0.02em; }
label.inline { display: flex; align-items: center; gap: 0.45rem; font-size: 0.86rem; text-transform: none; letter-spacing: 0; font-weight: 600; }
label.inline input { width: auto; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 0.75rem 0.85rem; margin-bottom: 1.15rem; align-items: end; }
.form-group { margin-bottom: 0; min-width: 0; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 0.75rem; }
.bill-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem 1.25rem; }
.bill-layout section { display: grid; grid-template-columns: 1fr 1fr; gap: 0.7rem 0.75rem; align-content: start; }
.bill-layout .wide { grid-column: 1 / -1; }
.bill-layout section.wide { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.modal-actions {
  position: sticky; bottom: -1.2rem; z-index: 2;
  display: flex; justify-content: space-between; align-items: center; gap: 0.75rem; flex-wrap: wrap;
  margin: 0.85rem -1.2rem -1.2rem; padding: 0.85rem 1.2rem 1rem;
  background: linear-gradient(180deg, rgba(247,249,252,0.2), #f7f9fc 28%);
  border-top: 1px solid var(--line);
}
.help, .muted { color: var(--muted); }
.small { font-size: 0.8rem; }
.ok { color: var(--ok); font-weight: 650; }
.err { color: var(--danger); font-weight: 650; }

.hidden { display: none !important; }
.flex, .actions { display: flex; gap: 14px 16px; flex-wrap: wrap; align-items: center; }
.actions { justify-content: flex-end; margin: 0.15rem 0 1rem; }
.flex select { width: auto; min-width: 12rem; }
.justify-between { justify-content: space-between; }
.items-center { align-items: center; }

.sse { font-size: 0.85rem; color: var(--accent-2); font-weight: 700; margin-top: 0.65rem; }
.progress { height: 8px; background: #e7ebf1; border-radius: 99px; overflow: hidden; margin-top: 0.45rem; }
.progress-bar { height: 100%; width: 0%; background: var(--accent); transition: width 0.3s; }

.empty { text-align: center; color: var(--muted); padding: 2rem; }
.settings-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 0.85rem; }
.toolbar { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: end; }

.modal {
  position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 1.2rem;
}
.modal[hidden] { display: none; }
.modal-backdrop {
  position: absolute; inset: 0; background: rgba(16, 26, 44, 0.46);
  backdrop-filter: blur(4px); animation: fade-in 0.22s ease;
}
.modal-panel {
  position: relative; width: min(980px, 100%); max-height: min(88vh, 920px); overflow: auto;
  background: linear-gradient(180deg, #fff, #f7f9fc);
  border-radius: 22px; padding: 1.15rem 1.2rem 1.2rem;
  box-shadow: inset 0 1px 0 #fff, 0 18px 0 rgba(16,26,44,0.04), 0 30px 70px rgba(16,26,44,0.28);
  animation: pop-spring 0.46s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 0.6rem; }
.modal-head h2 { margin: 0; }
.icon-x {
  width: 36px; height: 36px; border-radius: 12px; border: 0; cursor: pointer;
  background: linear-gradient(180deg, #fff, #eef2f7); color: var(--ink); font-size: 1.1rem;
  box-shadow: inset 0 1px 0 #fff, 0 3px 0 #d5dce6;
}
.icon-x:active { transform: translateY(2px); box-shadow: inset 0 2px 4px rgba(16,26,44,0.08); }
@keyframes pop-spring {
  0% { transform: translateY(18px) scale(0.94); opacity: 0; }
  70% { transform: translateY(-3px) scale(1.015); }
  100% { transform: none; opacity: 1; }
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.toast {
  display: none; position: fixed; right: 1.2rem; bottom: 1.2rem; z-index: 40;
  background: var(--navy); color: #fff; padding: 0.75rem 0.95rem; border-radius: 14px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.2), 0 8px 0 #0c1422, 0 16px 24px rgba(0,0,0,0.2);
  max-width: 320px; font-size: 0.88rem;
  animation: pop-spring 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.toast.error { background: var(--danger); }
.toast.ok, .toast.info { background: var(--navy); }

.login-body { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 0.9fr; }
.login-hero {
  background: radial-gradient(1200px 500px at -10% -20%, #245445 0%, transparent 50%), var(--navy);
  color: #fff; padding: 3.5rem; display: flex; flex-direction: column; justify-content: flex-end;
}
.login-hero h1 { font-size: 2.4rem; margin: 0.4rem 0; letter-spacing: -0.03em; }
.login-hero p { color: #c5d0e0; max-width: 420px; }
.login-panel { display: grid; place-items: center; padding: 2rem; }
.login-card { width: min(420px, 100%); }
.login-card h2 { margin: 0 0 0.35rem; font-size: 1.45rem; }
.login-card .btn { width: 100%; margin-top: 0.4rem; }
.footer-note { margin-top: 1.2rem; color: var(--muted); font-size: 0.8rem; }

@media (max-width: 860px) {
  .bill-layout, .bill-layout section { grid-template-columns: 1fr; }
  .app { flex-direction: column; }
  .side { width: 100%; height: auto; position: relative; padding-bottom: 0.8rem; }
  .side nav { flex-direction: row; overflow: auto; }
  .side .signout { margin-top: 0.6rem; }
  .login-body { grid-template-columns: 1fr; }
  .login-hero { min-height: 220px; padding: 1.6rem; }
  .stat { grid-template-columns: 1fr 1fr; }
  .content, .top { padding-left: 1rem; padding-right: 1rem; }
}
