/* Corpliance GST Portal */
:root {
  --brand: #16325c;
  --brand-2: #1e4a85;
  --accent: #0f8a6c;
  --accent-soft: #e6f5f0;
  --ink: #142033;
  --ink-2: #3b4a61;
  --muted: #6b7a90;
  --line: #e3e8ef;
  --line-2: #d3dae5;
  --bg: #f4f6fa;
  --card: #ffffff;
  --danger: #c0392b;
  --danger-soft: #fdecea;
  --warn: #b7791f;
  --warn-soft: #fdf6e3;
  --info: #1e5aa8;
  --info-soft: #e8f0fb;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(20, 32, 51, .06), 0 2px 8px rgba(20, 32, 51, .04);
  --font: "Segoe UI", "Inter", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: var(--font); font-size: 14.5px; color: var(--ink); background: var(--bg);
       line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: var(--brand-2); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; color: var(--ink); font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: 22px; }
h2 { font-size: 17px; }
h3 { font-size: 15px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.mono { font-family: Consolas, "SF Mono", Menlo, monospace; font-size: 13px; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }

/* ---------- layout ---------- */
.shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.sidebar { background: linear-gradient(180deg, var(--brand) 0%, #0f2442 100%); color: #cfd9e8;
           padding: 22px 14px; position: sticky; top: 0; height: 100vh; display: flex;
           flex-direction: column; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 22px; color: #fff; }
.brand-mark { width: 34px; height: 34px; border-radius: 9px; background: var(--accent);
              display: grid; place-items: center; font-weight: 700; color: #fff; font-size: 16px; }
.brand-name { font-weight: 650; font-size: 15px; line-height: 1.2; }
.brand-sub { font-size: 11.5px; color: #9fb2cc; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px;
         color: #cfd9e8; font-weight: 500; }
.nav a:hover { background: rgba(255,255,255,.07); color: #fff; text-decoration: none; }
.nav a.active { background: rgba(255,255,255,.12); color: #fff; }
.nav svg { width: 18px; height: 18px; opacity: .85; flex: none; }
.nav-label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #7f93b0;
             padding: 16px 10px 6px; }
.sidebar-foot { margin-top: auto; border-top: 1px solid rgba(255,255,255,.1); padding: 14px 8px 0; }
.who { font-size: 13px; color: #fff; font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.who-sub { font-size: 12px; color: #9fb2cc; margin-bottom: 10px; }
.linkbtn { background: none; border: 0; color: #cfd9e8; padding: 0; cursor: pointer;
           font: inherit; font-size: 13px; }
.linkbtn:hover { color: #fff; text-decoration: underline; }

.main { padding: 26px 32px 48px; min-width: 0; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px;
             margin-bottom: 20px; flex-wrap: wrap; }
.page-head .sub { color: var(--muted); margin-top: 3px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.mobile-top { display: none; }

/* ---------- cards ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
        box-shadow: var(--shadow); }
.card-pad { padding: 20px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px;
             padding: 15px 20px; border-bottom: 1px solid var(--line); }
.card + .card, .card + .grid, .grid + .card { margin-top: 18px; }
.grid > .card { margin-top: 0; }
.grid > * { min-width: 0; }
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stat { padding: 16px 18px; }
.stat-label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em;
              font-weight: 600; }
.stat-value { font-size: 23px; font-weight: 650; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat-foot { font-size: 12.5px; color: var(--muted); margin-top: 2px; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px;
       padding: 8px 15px; border-radius: 8px; border: 1px solid var(--line-2); background: #fff;
       color: var(--ink); font: inherit; font-weight: 600; font-size: 13.5px; cursor: pointer;
       white-space: nowrap; transition: background .12s, border-color .12s, box-shadow .12s; }
.btn:hover { background: #f6f8fb; text-decoration: none; border-color: #c4cdda; }
.btn:focus-visible { outline: 3px solid rgba(30, 74, 133, .25); outline-offset: 1px; }
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--brand-2); border-color: var(--brand-2); color: #fff; }
.btn-primary:hover { background: var(--brand); border-color: var(--brand); }
.btn-accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-accent:hover { background: #0b7259; border-color: #0b7259; }
.btn-danger { color: var(--danger); border-color: #efc2bd; }
.btn-danger:hover { background: var(--danger-soft); border-color: #e3a49c; }
.btn-ghost { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: #eef1f6; border-color: transparent; }
.btn-sm { padding: 5px 10px; font-size: 12.5px; }
.btn-icon { padding: 6px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
form.inline { display: inline; }

/* ---------- badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px;
         font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-open { background: #eef1f6; color: #55657c; }
.badge-submitted { background: var(--accent-soft); color: var(--accent); }
.badge-unlocked { background: var(--warn-soft); color: var(--warn); }
.badge-off { background: var(--danger-soft); color: var(--danger); }
.tag { display: inline-block; white-space: nowrap; padding: 1px 7px; border-radius: 5px; background: #eef1f6;
       color: var(--ink-2); font-size: 11.5px; font-weight: 600; }
.tag-cn { background: #fdecea; color: #a8322a; }
.tag-dn { background: #e8f0fb; color: #1e5aa8; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em;
            color: var(--muted); font-weight: 650; padding: 10px 14px; background: #f8fafc;
            border-bottom: 1px solid var(--line); white-space: nowrap; }
.table th.num { text-align: right; }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:hover { background: #fafbfd; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tfoot td { padding: 11px 14px; font-weight: 650; background: #f8fafc;
                  border-top: 1px solid var(--line); }
.table .row-actions { text-align: right; white-space: nowrap; }
.table td.strong { font-weight: 600; }
.empty { padding: 44px 20px; text-align: center; color: var(--muted); }
.empty h3 { color: var(--ink-2); margin-bottom: 6px; }
.empty .btn { margin-top: 14px; }

/* ---------- forms ---------- */
.form-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 14px 16px; }
.col-2 { grid-column: span 2; } .col-3 { grid-column: span 3; } .col-4 { grid-column: span 4; }
.col-5 { grid-column: span 5; } .col-6 { grid-column: span 6; } .col-8 { grid-column: span 8; }
.col-12 { grid-column: span 12; }
.field label, label.lbl { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink-2);
                          margin-bottom: 5px; }
.field .hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.field .err { font-size: 12.5px; color: var(--danger); margin-top: 4px; }
.req { color: var(--danger); }
input[type=text], input[type=password], input[type=email], input[type=date], input[type=number],
input[type=search], select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--line-2); border-radius: 8px;
  font: inherit; font-size: 14px; color: var(--ink); background: #fff;
  transition: border-color .12s, box-shadow .12s; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand-2);
  box-shadow: 0 0 0 3px rgba(30, 74, 133, .15); }
input.invalid, select.invalid { border-color: var(--danger); }
input[readonly] { background: #f5f7fa; color: var(--ink-2); }
textarea { min-height: 70px; resize: vertical; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; color: var(--ink-2); }
.check input { width: 16px; height: 16px; accent-color: var(--brand-2); }
.input-row { display: flex; gap: 8px; }
.input-row select { flex: 1; }
.form-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 20px;
             border-top: 1px solid var(--line); background: #fafbfd;
             border-radius: 0 0 var(--radius) var(--radius); }
.section-title { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; font-weight: 700;
                 color: var(--muted); margin-bottom: 12px; }

/* line items */
.lines { width: 100%; border-collapse: collapse; min-width: 1060px; }
.lines th { font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted);
            text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); font-weight: 650; }
.lines td { padding: 6px; vertical-align: top; border-bottom: 1px dashed var(--line); }
.lines input, .lines select { padding: 7px 8px; font-size: 13.5px; }
.lines th.num { text-align: right; }
.lines .calc { padding: 14px 6px 6px; text-align: right; color: var(--ink-2); font-variant-numeric: tabular-nums;
               white-space: nowrap; font-size: 13.5px; }
.lines .ln { color: var(--muted); padding-top: 14px; text-align: center; width: 28px; }
.w-desc { min-width: 200px; } .w-hsn { width: 100px; } .w-qty { width: 80px; } .w-unit { width: 80px; }
.w-rate { width: 105px; } .w-tax { width: 125px; } .w-gst { width: 80px; } .w-amt { width: 100px; }
.w-cess { width: 90px; } .w-x { width: 36px; }
.totals { display: grid; grid-template-columns: auto auto; gap: 6px 24px; justify-content: end;
          padding: 16px 20px; font-variant-numeric: tabular-nums; }
.totals div:nth-child(odd) { color: var(--muted); text-align: right; }
.totals div:nth-child(even) { text-align: right; min-width: 120px; font-weight: 600; }
.totals .grand { font-size: 17px; color: var(--ink) !important; font-weight: 700 !important;
                 border-top: 1px solid var(--line); padding-top: 8px; }
.tax-mode { font-size: 12.5px; padding: 6px 10px; border-radius: 7px; background: var(--info-soft);
            color: var(--info); display: inline-block; }

/* ---------- alerts ---------- */
.flashes { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.alert { padding: 11px 14px; border-radius: 9px; border: 1px solid; font-size: 14px;
         display: flex; gap: 10px; align-items: flex-start; }
.alert-success { background: var(--accent-soft); border-color: #bfe5d9; color: #0b5e4a; }
.alert-error { background: var(--danger-soft); border-color: #f2c4bf; color: #8e2a20; }
.alert-info { background: var(--info-soft); border-color: #c8daf3; color: #1a4b8c; }
.alert-warn { background: var(--warn-soft); border-color: #efdcae; color: #7c5313; }

/* ---------- month picker ---------- */
.month-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.month-bar select { width: auto; min-width: 170px; font-weight: 600; }

/* ---------- login ---------- */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-side { background: linear-gradient(150deg, var(--brand) 0%, #0d2140 70%); color: #d6e1f0;
             padding: 56px; display: flex; flex-direction: column; justify-content: space-between; }
.auth-side h1 { color: #fff; font-size: 30px; line-height: 1.25; max-width: 420px; margin-top: 50px; }
.auth-side p { max-width: 420px; color: #b6c6dc; font-size: 15px; }
.auth-points { list-style: none; padding: 0; margin: 26px 0 0; display: grid; gap: 12px; }
.auth-points li { display: flex; gap: 10px; align-items: center; color: #d6e1f0; }
.auth-points svg { width: 18px; height: 18px; color: #4fd1ab; flex: none; }
.auth-main { display: grid; place-items: center; padding: 40px 24px; }
.auth-card { width: 100%; max-width: 380px; }
.auth-card h2 { font-size: 22px; margin-bottom: 4px; }
.auth-card .field { margin-top: 16px; }
.auth-card .btn { width: 100%; padding: 10px; margin-top: 22px; font-size: 14.5px; }

/* ---------- modal ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(15, 25, 45, .45); display: none;
              align-items: center; justify-content: center; padding: 20px; z-index: 50; }
.modal-back.open { display: flex; }
.modal { background: #fff; border-radius: 12px; width: 100%; max-width: 520px;
         box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.modal .card-head h3 { font-size: 16px; }

/* ---------- misc ---------- */
.kv { display: grid; grid-template-columns: 160px 1fr; gap: 8px 16px; }
.kv dt { color: var(--muted); font-size: 13px; }
.kv dd { margin: 0; font-weight: 500; }
.secret { font-family: Consolas, monospace; font-size: 18px; letter-spacing: .05em; padding: 10px 14px;
          background: #f5f7fa; border: 1px dashed var(--line-2); border-radius: 8px; display: inline-block; }
.list-plain { margin: 0; padding-left: 18px; }
.divider { height: 1px; background: var(--line); margin: 16px 0; }

@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: -260px; width: 240px; z-index: 40; transition: left .2s; }
  .sidebar.open { left: 0; }
  .mobile-top { display: flex; align-items: center; justify-content: space-between;
                background: var(--brand); color: #fff; padding: 12px 16px; position: sticky; top: 0; z-index: 30; }
  .mobile-top button { background: none; border: 0; color: #fff; cursor: pointer; padding: 4px; }
  .main { padding: 18px 14px 40px; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .form-grid > * { grid-column: span 12 !important; }
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-side { display: none; }
  .kv { grid-template-columns: 1fr; }
}
@media print {
  .sidebar, .mobile-top, .actions, .no-print { display: none !important; }
  .shell { display: block; }
  .main { padding: 0; }
  .card { box-shadow: none; }
}
