/* Vagai Silambam SaaS — shared styles.
   Tokens mirror the mobile app (src/theme/index.ts) so both products look like one brand. */

:root {
  --primary: #1A3673;
  --primary-light: #2A4E9E;
  --primary-dark: #0E214D;
  --primary-muted: #EBF2FF;
  --accent: #00A86B;
  --accent-light: #E6F9F1;
  --secondary: #82F3B2;
  --gold: #D97706;
  --gold-light: #FEF3C7;
  --crimson: #E11D48;
  --crimson-light: #FFE4E6;
  --purple: #7C3AED;
  --purple-light: #F3E8FF;

  --bg: #F8FAFC;
  --surface: #FFFFFF;
  --surface-subtle: #F1F5F9;
  --border: #E2E8F0;
  --border-light: #F1F5F9;
  --text: #0F172A;
  --text-secondary: #64748B;
  --text-muted: #94A3B8;
  --ring: rgba(26, 54, 115, 0.10);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 22px;

  --shadow-sm: 0 3px 8px rgba(26, 54, 115, 0.07);
  --shadow-md: 0 6px 16px rgba(26, 54, 115, 0.10);
  --shadow-lg: 0 12px 28px rgba(26, 54, 115, 0.14);

  --sidebar-width: 248px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans Tamil", sans-serif;
}

a { color: var(--primary); text-decoration: none; }
h1, h2, h3 { letter-spacing: -0.3px; margin: 0; }

/* ───────────── auth pages ───────────── */

.auth-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: linear-gradient(160deg, var(--primary-dark), var(--primary) 55%, #24458c);
}
.auth-card {
  width: 100%;
  max-width: 440px;
  background: var(--surface);
  border-radius: var(--radius-xl);
  padding: 32px;
  box-shadow: var(--shadow-lg);
}
.auth-brand { text-align: center; margin-bottom: 26px; }
.auth-brand .mark {
  width: 56px; height: 56px; margin: 0 auto 12px;
  border-radius: var(--radius-lg);
  background: var(--primary-muted);
  display: grid; place-items: center;
  font-size: 26px;
}
.auth-brand h1 { font-size: 22px; color: var(--primary); }
.auth-brand p { margin: 4px 0 0; color: var(--text-secondary); font-size: 13px; }

/* ───────────── form controls ───────────── */

.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.field input, .field select, .field textarea {
  width: 100%;
  padding: 12px 14px;
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  outline: none;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--ring);
}
.field .hint { font-size: 12px; color: var(--text-muted); margin-top: 6px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 20px;
  font: inherit;
  font-weight: 800;
  border: 1.5px solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: transform .06s ease, box-shadow .15s ease, background .15s ease;
}
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .6; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; box-shadow: var(--shadow-md); }
.btn-primary:hover { background: var(--primary-light); }
.btn-ghost { background: var(--surface); color: var(--primary); border-color: var(--border); }
.btn-ghost:hover { background: var(--primary-muted); }
.btn-block { width: 100%; }

/* ───────────── app shell ───────────── */

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

.sidebar {
  width: var(--sidebar-width);
  flex: none;
  background: var(--primary);
  color: #fff;
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.sidebar .brand {
  display: flex; align-items: center; gap: 10px;
  padding: 0 8px 20px;
  font-weight: 900; font-size: 17px;
}
.sidebar .brand span.mark {
  width: 34px; height: 34px; border-radius: 10px;
  background: rgba(255,255,255,.14);
  display: grid; place-items: center; font-size: 17px;
}
.sidebar a {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 12px;
  border-radius: var(--radius-md);
  color: rgba(255,255,255,.82);
  font-weight: 600; font-size: 14px;
}
.sidebar a:hover { background: rgba(255,255,255,.10); color: #fff; }
.sidebar a.active { background: #fff; color: var(--primary); font-weight: 800; }
.sidebar .spacer { flex: 1; }
.sidebar .plan-chip {
  margin: 12px 8px 0;
  padding: 12px;
  border-radius: var(--radius-md);
  background: rgba(255,255,255,.10);
  font-size: 12px;
}
.sidebar .plan-chip strong { display: block; font-size: 14px; margin-bottom: 2px; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border-light);
}
.topbar h2 { font-size: 19px; flex: 1; }
.topbar .menu-btn { display: none; }

.content { padding: 24px; flex: 1; }

/* ───────────── cards, tables, badges ───────────── */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-left: 3px solid var(--primary);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow-sm);
}
.stat .label {
  font-size: 11px; font-weight: 800; letter-spacing: .5px;
  text-transform: uppercase; color: var(--text-muted);
}
.stat .value { font-size: 29px; font-weight: 900; letter-spacing: -.5px; margin-top: 10px; }
.stat .sub { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 20px;
  margin-bottom: 20px;
}
.card h3 { font-size: 16px; margin-bottom: 14px; }
.card-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.card-head h3 { flex: 1; margin: 0; }

table { width: 100%; border-collapse: collapse; }
th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .5px;
  color: var(--text-muted); padding: 10px 12px; border-bottom: 1px solid var(--border);
}
td { padding: 13px 12px; border-bottom: 1px solid var(--border-light); }
tbody tr:hover { background: var(--surface-subtle); }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 11px; border-radius: 999px;
  border: 1px solid; font-size: 11px; font-weight: 800; letter-spacing: .4px;
}
.badge-active { background: var(--accent-light); color: var(--accent); border-color: #00A86B29; }
.badge-inactive { background: var(--surface-subtle); color: var(--text-muted); border-color: #94A3B829; }
.badge-trial { background: var(--gold-light); color: var(--gold); border-color: #D9770629; }
.badge-suspended { background: var(--crimson-light); color: var(--crimson); border-color: #E11D4829; }

.btn-sm { padding: 7px 13px; font-size: 13px; }

.search {
  flex: 1; max-width: 320px;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  font: inherit;
}

.meter { height: 8px; border-radius: 4px; background: var(--surface-subtle); overflow: hidden; margin-top: 8px; }
.meter > span { display: block; height: 100%; background: var(--primary); border-radius: 4px; }
.meter.warn > span { background: var(--gold); }
.meter.full > span { background: var(--crimson); }

/* ───────────── feedback ───────────── */

.alert {
  padding: 12px 14px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 16px;
  border: 1px solid;
}
.alert-error { background: var(--crimson-light); color: #9F1239; border-color: #E11D4833; }
.alert-info { background: var(--primary-muted); color: var(--primary); border-color: var(--ring); }
.alert[hidden] { display: none; }

.toast-host { position: fixed; right: 20px; bottom: 20px; display: grid; gap: 10px; z-index: 60; }
.toast {
  background: var(--text); color: #fff;
  padding: 12px 16px; border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg); font-size: 14px; font-weight: 600;
  animation: toast-in .18s ease;
}
.toast.success { background: #0F766E; }
.toast.error { background: #9F1239; }
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } }

.empty { text-align: center; padding: 44px 20px; color: var(--text-secondary); }
.empty .mark {
  width: 76px; height: 76px; margin: 0 auto 16px;
  border-radius: 50%; background: var(--primary-muted);
  border: 1px solid var(--ring);
  display: grid; place-items: center; font-size: 30px;
}
.empty h3 { font-size: 17px; color: var(--text); margin-bottom: 6px; }

.skeleton {
  height: 14px; border-radius: 6px;
  background: linear-gradient(90deg, var(--surface-subtle) 25%, #e8edf5 37%, var(--surface-subtle) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.2s infinite linear;
}
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }

/* ───────────── modal ───────────── */

.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, .55);
  display: grid; place-items: center;
  padding: 20px; z-index: 50;
}
.modal-backdrop[hidden] { display: none; }
.modal {
  width: 100%; max-width: 520px;
  background: var(--surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  max-height: 90vh; display: flex; flex-direction: column;
}
.modal header { padding: 20px 22px; border-bottom: 1px solid var(--border-light); }
.modal header h3 { font-size: 18px; }
.modal .body { padding: 20px 22px; overflow-y: auto; }
.modal footer { padding: 16px 22px; border-top: 1px solid var(--border-light); display: flex; gap: 12px; justify-content: flex-end; }

.lang-toggle { display: flex; border: 1px solid var(--border); border-radius: 999px; overflow: hidden; }
.lang-toggle button {
  border: 0; background: transparent; padding: 6px 12px;
  font: inherit; font-size: 12px; font-weight: 700; cursor: pointer; color: var(--text-secondary);
}
.lang-toggle button.active { background: var(--primary); color: #fff; }
