/* public/css/app.css — GSTDashboard */

/* ── Reset & base ─────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg:         #f4f3ef;
  --surface:    #ffffff;
  --surface2:   #f0efe9;
  --border:     #e4e2da;
  --border2:    #ccc9c0;
  --text:       #1a1917;
  --muted:      #6b6860;
  --hint:       #9c9a92;
  --accent:     #1d4ed8;
  --accent-lt:  #eff6ff;
  --accent-bd:  #bfdbfe;
  --success:    #065f46;
  --success-bg: #ecfdf5;
  --success-bd: #6ee7b7;
  --error:      #991b1b;
  --error-bg:   #fef2f2;
  --error-bd:   #fca5a5;
  --warn:       #92400e;
  --warn-bg:    #fffbeb;
  --warn-bd:    #fde68a;
  --mono:       'IBM Plex Mono', monospace;
  --sans:       'DM Sans', sans-serif;
  --r:          6px;
  --rlg:        10px;
  --topbar-h:   52px;
  --sidebar-w:  220px;
}
html { font-size: 14px; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.55;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Topbar ───────────────────────────────────────────── */
.topbar {
  position: fixed; top: 0; left: 0; right: 0;
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 1.25rem;
  gap: 1rem;
  z-index: 200;
}
.topbar-left  { display: flex; align-items: center; gap: 10px; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.topbar-nav   { display: flex; gap: 2px; margin-left: 1rem; }

.logo { font-family: var(--mono); font-size: 15px; font-weight: 500; color: var(--text); letter-spacing: -0.3px; }
.logo span { color: var(--accent); }
.env-pill { font-size: 10px; background: var(--warn-bg); color: var(--warn); border: 1px solid var(--warn-bd); padding: 2px 8px; border-radius: 20px; font-family: var(--mono); }

.tnav { font-size: 13px; color: var(--muted); padding: 5px 10px; border-radius: var(--r); transition: background .12s, color .12s; }
.tnav:hover { background: var(--surface2); color: var(--text); text-decoration: none; }
.tnav.active { color: var(--accent); background: var(--accent-lt); font-weight: 500; }

.user-chip { display: flex; align-items: center; gap: 8px; }
.avatar-img { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; }
.avatar-initials { width: 26px; height: 26px; border-radius: 50%; background: var(--accent-lt); color: var(--accent); font-size: 10px; font-weight: 500; display: flex; align-items: center; justify-content: center; }
.user-name { font-size: 13px; color: var(--text); }
.role-pill { font-size: 9px; padding: 2px 7px; border-radius: 10px; font-weight: 500; }
.role-admin { background: #ede9fe; color: #6d28d9; }
.role-staff { background: var(--accent-lt); color: var(--accent); }
.role-client { background: var(--success-bg); color: var(--success); }
.btn-logout { font-size: 12px; color: var(--muted); padding: 4px 10px; border: 1px solid var(--border2); border-radius: var(--r); transition: background .12s; }
.btn-logout:hover { background: var(--surface2); text-decoration: none; }

/* ── App shell ────────────────────────────────────────── */
.app-shell { display: flex; margin-top: var(--topbar-h); min-height: calc(100vh - var(--topbar-h)); }

/* ── Sidebar ──────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 1rem 0.5rem;
  position: sticky;
  top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
}
.sb-section-label { font-size: 10px; font-weight: 500; letter-spacing: .07em; text-transform: uppercase; color: var(--hint); padding: 0 8px; margin: 6px 0 4px; display: flex; align-items: center; justify-content: space-between; }
.sb-count { background: var(--surface2); color: var(--muted); padding: 0 5px; border-radius: 8px; font-size: 10px; }
.sb-item { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: var(--r); font-size: 12.5px; color: var(--muted); transition: background .12s, color .12s; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-item:hover { background: var(--surface2); color: var(--text); text-decoration: none; }
.sb-item.active { background: var(--accent-lt); color: var(--accent); font-weight: 500; }
.sb-icon { font-size: 13px; flex-shrink: 0; }
.sb-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.dot-green { background: #10b981; }
.dot-gray  { background: var(--border2); }
.sb-state { margin-left: auto; font-size: 10px; background: var(--surface2); padding: 1px 5px; border-radius: 4px; color: var(--hint); }
.sb-add { color: var(--accent); font-size: 12px; margin-top: 4px; }
.sb-client { font-size: 12px; }

/* ── Main content ─────────────────────────────────────── */
.main-content { flex: 1; padding: 1.75rem 2rem; overflow: auto; min-width: 0; }
.page-header { margin-bottom: 1.5rem; }
.page-title { font-size: 22px; font-weight: 500; letter-spacing: -0.5px; }
.page-sub { font-size: 13px; color: var(--muted); margin-top: 3px; }

/* ── Cards ────────────────────────────────────────────── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--rlg); padding: 1.25rem 1.5rem; margin-bottom: 1.25rem; }
.card-title { font-size: 13px; font-weight: 500; margin-bottom: 1rem; color: var(--text); }

/* ── Stat cards ───────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; margin-bottom: 1.25rem; }
.stat-card { background: var(--surface2); border-radius: var(--r); padding: 1rem; }
.stat-label { font-size: 10px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 5px; }
.stat-value { font-size: 22px; font-weight: 500; font-family: var(--mono); letter-spacing: -0.5px; color: var(--text); }
.stat-value.blue   { color: var(--accent); }
.stat-value.green  { color: #059669; }
.stat-value.amber  { color: #b45309; }
.stat-value.red    { color: var(--error); }

/* ── Section tabs ─────────────────────────────────────── */
.section-tabs { display: flex; border-bottom: 1px solid var(--border); margin-bottom: 1rem; overflow-x: auto; gap: 2px; }
.stab { font-size: 12px; padding: 7px 12px; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; display: flex; align-items: center; gap: 6px; transition: color .12s, border-color .12s; text-decoration: none; }
.stab:hover { color: var(--text); text-decoration: none; }
.stab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 500; }
.stab-count { font-size: 9px; background: var(--surface2); color: var(--muted); padding: 1px 5px; border-radius: 8px; }
.stab.active .stab-count { background: var(--accent-lt); color: var(--accent); }

/* ── Toolbar ──────────────────────────────────────────── */
.toolbar { display: flex; align-items: center; gap: 8px; margin-bottom: 1rem; flex-wrap: wrap; }
.toolbar select, .toolbar input[type=text], .toolbar input[type=search] {
  font-family: var(--sans); font-size: 12.5px;
  border: 1px solid var(--border2); border-radius: var(--r);
  padding: 6px 10px; background: var(--surface); color: var(--text);
  outline: none; transition: border-color .12s;
}
.toolbar select:focus, .toolbar input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(29,78,216,.08); }
.toolbar-right { margin-left: auto; display: flex; gap: 8px; }

/* ── Buttons ──────────────────────────────────────────── */
.btn { font-family: var(--sans); font-size: 12.5px; font-weight: 500; padding: 7px 16px; border-radius: var(--r); border: 1px solid transparent; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; transition: all .12s; text-decoration: none; }
.btn-primary   { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover { background: #1e40af; text-decoration: none; }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border2); }
.btn-secondary:hover { background: var(--surface2); text-decoration: none; }
.btn-success   { background: #059669; color: #fff; }
.btn-danger    { background: var(--error); color: #fff; }
.btn-ghost     { background: transparent; color: var(--muted); border-color: transparent; }
.btn-ghost:hover { background: var(--surface2); }
.btn-sm { font-size: 11px; padding: 4px 10px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ── Forms ────────────────────────────────────────────── */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group.full { grid-column: 1 / -1; }
.form-group label { font-size: 11px; font-weight: 500; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.form-group input, .form-group select, .form-group textarea {
  font-family: var(--sans); font-size: 13px;
  border: 1px solid var(--border2); border-radius: var(--r);
  padding: 8px 12px; background: var(--surface); color: var(--text); outline: none;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px rgba(29,78,216,.08);
}
.form-actions { display: flex; gap: 8px; margin-top: 1rem; }

/* ── Table ────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.data-table thead th { background: var(--surface2); padding: 8px 10px; text-align: left; font-size: 10px; font-weight: 500; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; border-bottom: 1px solid var(--border); white-space: nowrap; }
.data-table tbody tr { border-bottom: 1px solid var(--border); transition: background .08s; }
.data-table tbody tr:hover { background: var(--surface2); }
.data-table tbody tr:last-child { border-bottom: none; }
.data-table td { padding: 7px 10px; color: var(--text); }
.data-table td.mono { font-family: var(--mono); font-size: 11px; }
.data-table td.muted { color: var(--muted); }

/* ── Badges ───────────────────────────────────────────── */
.badge { display: inline-block; font-size: 10px; font-weight: 500; padding: 2px 8px; border-radius: 10px; }
.badge-blue   { background: var(--accent-lt); color: var(--accent); }
.badge-green  { background: var(--success-bg); color: var(--success); }
.badge-amber  { background: var(--warn-bg); color: var(--warn); }
.badge-red    { background: var(--error-bg); color: var(--error); }
.badge-gray   { background: var(--surface2); color: var(--muted); }
.badge-purple { background: #ede9fe; color: #6d28d9; }

/* ── Category select inline ───────────────────────────── */
.cat-select { font-size: 11px; padding: 3px 6px; border-radius: 4px; border: 1px solid var(--border2); background: var(--surface); color: var(--text); font-family: var(--sans); max-width: 150px; cursor: pointer; }
.cat-select:focus { border-color: var(--accent); outline: none; }

/* ── IMS buttons ──────────────────────────────────────── */
.ims-btn { font-size: 10px; padding: 3px 8px; border-radius: 10px; border: none; cursor: pointer; font-family: var(--sans); font-weight: 500; }
.ims-pending  { background: var(--warn-bg);    color: var(--warn); }
.ims-accepted { background: var(--success-bg); color: var(--success); }
.ims-rejected { background: var(--error-bg);  color: var(--error); }
.ims-modified { background: #ede9fe;           color: #6d28d9; }

/* ── Pagination ───────────────────────────────────────── */
.pagination { display: flex; align-items: center; gap: 4px; margin-top: 1rem; font-size: 12px; color: var(--muted); }
.page-btn { padding: 4px 9px; border-radius: var(--r); border: 1px solid var(--border2); background: var(--surface); color: var(--text); cursor: pointer; font-size: 11px; transition: background .1s; }
.page-btn:hover { background: var(--surface2); }
.page-btn.current { background: var(--accent); color: #fff; border-color: var(--accent); }
.page-btn:disabled { opacity: .4; cursor: not-allowed; }

/* ── Flash messages ───────────────────────────────────── */
.flash { border-radius: var(--r); padding: 10px 14px; font-size: 13px; margin-bottom: 1rem; border: 1px solid; }
.flash-info    { background: var(--accent-lt); color: var(--accent); border-color: var(--accent-bd); }
.flash-success { background: var(--success-bg); color: var(--success); border-color: var(--success-bd); }
.flash-error   { background: var(--error-bg); color: var(--error); border-color: var(--error-bd); }
.flash-warning { background: var(--warn-bg); color: var(--warn); border-color: var(--warn-bd); }

/* ── Client header bar ────────────────────────────────── */
.client-header { display: flex; align-items: center; gap: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 10px 14px; margin-bottom: 1.25rem; }
.client-header .name { font-size: 14px; font-weight: 500; }
.client-header .gstin { font-family: var(--mono); font-size: 11px; color: var(--muted); }
.client-header .right { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.token-ok   { font-size: 11px; background: var(--success-bg); color: var(--success); border: 1px solid var(--success-bd); padding: 3px 10px; border-radius: 10px; }
.token-exp  { font-size: 11px; background: var(--error-bg); color: var(--error); border: 1px solid var(--error-bd); padding: 3px 10px; border-radius: 10px; }

/* ── OTP modal ────────────────────────────────────────── */
.modal-overlay { display: none; min-height: 400px; background: rgba(0,0,0,.45); align-items: center; justify-content: center; }
.modal-overlay.open { display: flex; }
.modal { background: var(--surface); border-radius: var(--rlg); padding: 1.75rem; width: 360px; border: 1px solid var(--border); }
.modal h3 { font-size: 16px; font-weight: 500; margin-bottom: 4px; }
.modal p  { font-size: 13px; color: var(--muted); margin-bottom: 1.25rem; }
.otp-inputs { display: flex; gap: 8px; margin: 1rem 0; }
.otp-inputs input { width: 44px; height: 52px; text-align: center; font-size: 22px; font-weight: 600; font-family: var(--mono); border: 1px solid var(--border2); border-radius: var(--r); outline: none; }
.otp-inputs input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(29,78,216,.1); }

/* ── Report cards ─────────────────────────────────────── */
.report-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.report-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--rlg); padding: 1.25rem; cursor: pointer; transition: border-color .15s; text-decoration: none; display: block; }
.report-card:hover { border-color: var(--accent); text-decoration: none; }
.report-icon { font-size: 18px; margin-bottom: 10px; }
.report-name { font-size: 13px; font-weight: 500; color: var(--text); margin-bottom: 4px; }
.report-desc { font-size: 11.5px; color: var(--muted); line-height: 1.5; }
.report-dl   { display: flex; gap: 6px; margin-top: 12px; }

/* ── Login page ───────────────────────────────────────── */
.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: var(--bg); }
.login-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--rlg); padding: 2.5rem; width: 360px; text-align: center; }
.login-logo { font-family: var(--mono); font-size: 22px; font-weight: 500; margin-bottom: 6px; }
.login-logo span { color: var(--accent); }
.login-tagline { font-size: 13px; color: var(--muted); margin-bottom: 2rem; }
.btn-google { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; padding: 10px; border: 1px solid var(--border2); border-radius: var(--r); background: var(--surface); font-size: 13.5px; font-weight: 500; cursor: pointer; transition: background .12s; }
.btn-google:hover { background: var(--surface2); text-decoration: none; }
.login-note { font-size: 11px; color: var(--hint); margin-top: 1.5rem; line-height: 1.6; }

/* ── Utility ──────────────────────────────────────────── */
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-muted { color: var(--muted); }
.text-mono { font-family: var(--mono); }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.w-full { width: 100%; }
.loading { opacity: .6; pointer-events: none; }
.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--border2); border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Responsive ───────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .main-content { padding: 1rem; }
  .form-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}
