/* ═══════════════════════════════════════════════════════════════
   Maharani Mega Mart — app.css
   Same tokens and look as gbsTexWeb. --primary / --primary-dark /
   --primary-light / --primary-soft are injected by js/theme.js.
   ═══════════════════════════════════════════════════════════════ */
:root {
  --bg:          #eef1f5;
  --surface:     #ffffff;
  --surface-2:   #f6f8fb;
  --border:      #d0d6de;
  --text:        #1e2533;
  --text-muted:  #6c757d;
  --label:       #4a5568;
  --danger:      #c0392b;
  --success:     #1e6f3e;
  --err-bg:      #fdecea; --err-cl: #c62828; --err-bd: #f5c6cb;
  --ok-bg:       #e8f5ec; --ok-cl:  #1e6f3e; --ok-bd:  #b9dfc5;
  --shadow:      0 6px 32px rgba(0,0,0,.11);
  --radius:      16px;
  --primary-text: var(--primary);
  --font: 'Segoe UI', system-ui, -apple-system, Roboto, sans-serif;
  --font-ml: 'Noto Sans Malayalam', 'Segoe UI', sans-serif;
}
[data-theme="dark"] {
  color-scheme: dark;                     /* native date pickers, selects, scrollbars follow night mode */
  --bg:         #14171c;
  --surface:    #1e2228;
  --surface-2:  #252b34;
  --border:     #333a44;
  --text:       #f2f5f9;
  --text-muted: #cdd7e4;
  --label:      #b8c4d4;
  --err-bg: #3b1616; --err-cl: #fca5a5; --err-bd: #7f1d1d;
  --ok-bg:  #13301f; --ok-cl:  #7ddc9f; --ok-bd:  #22543a;
  --shadow: 0 6px 32px rgba(0,0,0,.45);
  --primary-text: #7aa3c9;
  --primary-text: color-mix(in srgb, var(--primary) 60%, #fff);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }      /* components below set display:flex — hidden must still win */
html, body { margin: 0; }
body {
  font-family: var(--font); background: var(--bg); color: var(--text);
  -webkit-tap-highlight-color: transparent; transition: background .2s;
}
.ml { font-family: var(--font-ml); }
[data-theme="dark"] .text-muted { color: var(--text-muted) !important; }

/* Item-name language (user preference): <span class="nm-ml">…</span><span class="nm-en">…</span> */
[data-names="ml"] .nm-en, [data-names="en"] .nm-ml { display: none !important; }

/* ── Sign-in page (gbsTexWeb card) ─────────────────────────────── */
.auth-body {
  min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 20px 16px calc(20px + env(safe-area-inset-bottom));
}
.login-card {
  background: var(--surface); border-radius: var(--radius); width: 100%; max-width: 400px;
  box-shadow: var(--shadow); overflow: hidden;
}
.brand-header {
  background: var(--primary);
  background: linear-gradient(155deg, var(--primary), var(--primary-dark));
  padding: 26px 24px 20px; text-align: center; position: relative; color: #fff;
}
.brand-mark {
  width: 62px; height: 62px; border-radius: 18px; margin: 0 auto 12px;
  background: rgba(255,255,255,.16); display: flex; align-items: center; justify-content: center;
  font-size: 1.9rem; box-shadow: inset 0 0 0 1px rgba(255,255,255,.25);
}
.brand-header h1 { font-size: 1.3rem; font-weight: 800; margin: 0 0 2px; letter-spacing: .2px; }
.brand-header p  { font-size: .78rem; margin: 0; color: rgba(255,255,255,.72); }
.hdr-btn {
  position: absolute; top: 12px; width: 34px; height: 34px; border: none; border-radius: 9px;
  background: rgba(255,255,255,.18); color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: .95rem; cursor: pointer;
}
.hdr-btn:active { background: rgba(255,255,255,.32); }
.hdr-btn.right { right: 12px; }

.form-body { padding: 22px 22px 18px; }
.form-group { margin-bottom: 13px; }
.form-group > label { display: block; font-size: .8rem; font-weight: 600; color: var(--label); margin-bottom: 5px; }
.input-wrap { position: relative; }
.input-wrap > i.lead {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: 1rem;
}
.input-wrap input {
  width: 100%; padding: 12px 12px 12px 38px; min-height: 48px;
  border: 1.5px solid var(--border); border-radius: 10px; font-size: 1rem;
  color: var(--text); background: var(--surface); outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.input-wrap input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent); }
.input-wrap input.has-eye { padding-right: 44px; }
.eye-btn {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: 36px; height: 36px; background: none; border: none; color: var(--text-muted); font-size: 1.05rem; cursor: pointer;
}
.check-row { display: flex; align-items: center; gap: 8px; font-size: .84rem; color: var(--label); margin: 4px 0 12px; }
.check-row input { width: 18px; height: 18px; accent-color: var(--primary); }
.check-row a { margin-left: auto; color: var(--err-cl); font-weight: 600; text-decoration: none; font-size: .8rem; }

.msg { border-radius: 9px; padding: 9px 12px; font-size: .85rem; margin-bottom: 12px; display: none; }
.msg.err { background: var(--err-bg); color: var(--err-cl); border: 1px solid var(--err-bd); }
.msg.ok  { background: var(--ok-bg);  color: var(--ok-cl);  border: 1px solid var(--ok-bd); }
.msg.show { display: block; }

.btn-main {
  width: 100%; min-height: 50px; padding: 12px; border: none; border-radius: 11px;
  background: var(--primary); color: #fff; font-size: 1rem; font-weight: 700; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 8px; transition: filter .15s, transform .08s;
}
.btn-main:active { transform: scale(.985); }
.btn-main:hover { filter: brightness(1.1); }
.btn-main:disabled { opacity: .7; cursor: not-allowed; }

.btn-bio {
  width: 100%; min-height: 64px; border-radius: 14px; cursor: pointer; margin-bottom: 14px;
  border: 1.5px solid var(--primary); background: var(--primary-light); color: var(--primary);
  display: flex; align-items: center; gap: 14px; padding: 10px 16px; text-align: left; font-weight: 700;
}
[data-theme="dark"] .btn-bio { background: color-mix(in srgb, var(--primary) 25%, var(--surface)); color: var(--text); }
.btn-bio .fp { font-size: 2rem; line-height: 1; }
.btn-bio small { display: block; font-weight: 500; font-size: .76rem; opacity: .8; }
.btn-bio:disabled { opacity: .75; }
.or-line { display: flex; align-items: center; gap: 10px; margin: 0 0 14px; font-size: .7rem; letter-spacing: .14em; font-weight: 700; color: var(--text-muted); }
.or-line::before, .or-line::after { content: ""; flex: 1; height: 1px; background: var(--border); }

.bottom-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-top: 14px; padding-top: 13px; border-top: 1px solid var(--border);
}
.swatches { display: flex; gap: 7px; flex-wrap: wrap; align-items: center; }
.swatch {
  width: 24px; height: 24px; border-radius: 50%; border: 2.5px solid transparent; cursor: pointer; padding: 0;
  transition: transform .12s, border-color .12s; box-shadow: 0 0 0 1px rgba(0,0,0,.08);
}
.swatch.active { border-color: var(--text); transform: scale(1.12); }
.swatch.custom {
  background: conic-gradient(#e53935, #fdd835, #43a047, #1e88e5, #8e24aa, #e53935);
  position: relative; overflow: hidden;
}
.swatch.custom input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.muted-link { font-size: .8rem; color: var(--primary-text); font-weight: 600; text-decoration: none; }

.powered { margin-top: 18px; text-align: center; }
.powered .lbl { font-size: .66rem; letter-spacing: .08em; color: var(--text-muted); text-transform: uppercase; font-weight: 700; margin-bottom: 5px; }
.powered img { max-width: 100px; height: auto; }
[data-theme="dark"] .powered img { filter: brightness(0) invert(.85); }

/* ── App shell (gbsTexWeb staff app) ───────────────────────────── */
.app-top {
  position: sticky; top: 0; z-index: 30; color: #fff;
  background: var(--primary); background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  padding: calc(12px + env(safe-area-inset-top)) 14px 12px; display: flex; align-items: center; gap: 11px;
  box-shadow: 0 2px 10px rgba(0,0,0,.18);
}
.app-top .logo {
  width: 38px; height: 38px; border-radius: 11px; background: rgba(255,255,255,.18);
  display: flex; align-items: center; justify-content: center; font-size: 1.2rem; flex: 0 0 auto;
}
.app-top .ttl { min-width: 0; flex: 1 1 auto; }
.app-top .ttl b { display: block; font-size: 1.02rem; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-top .ttl span { display: block; font-size: .74rem; opacity: .82; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-top .icon-btn {
  width: 38px; height: 38px; border: none; border-radius: 10px; background: rgba(255,255,255,.15); color: #fff;
  font-size: 1.05rem; display: flex; align-items: center; justify-content: center; cursor: pointer; flex: 0 0 auto;
}
.app-top .icon-btn:active { background: rgba(255,255,255,.3); }

.wrap { max-width: 640px; margin: 0 auto; padding: 14px 14px calc(90px + env(safe-area-inset-bottom)); }

.hello {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; display: flex; align-items: center; gap: 13px; margin-bottom: 16px;
}
.avatar {
  width: 46px; height: 46px; border-radius: 50%; background: var(--primary-light); color: var(--primary);
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 1.1rem; flex: 0 0 auto;
}
[data-theme="dark"] .avatar { background: color-mix(in srgb, var(--primary) 40%, var(--surface)); color: #fff; }
.hello .who b { display: block; font-size: 1.02rem; }
.hello .who span { font-size: .8rem; color: var(--text-muted); }
.role-pill { margin-left: auto; font-size: .7rem; font-weight: 700; padding: 4px 10px; border-radius: 20px;
  background: var(--primary-light); color: var(--primary); letter-spacing: .3px; }
[data-theme="dark"] .role-pill { background: color-mix(in srgb, var(--primary) 35%, var(--surface)); color: #fff; }

.today-card {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 18px; padding: 13px 12px; border-radius: var(--radius);
  background: var(--primary); background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: #fff; text-decoration: none;
  box-shadow: 0 6px 18px rgba(0,0,0,.18);
}
.today-card small { display: block; font-size: .64rem; text-transform: uppercase; letter-spacing: .4px; opacity: .8; font-weight: 700; }
.today-card b { display: block; font-size: 1rem; margin-top: 2px; white-space: nowrap; }
.sec-lbl { font-size: .72rem; font-weight: 800; letter-spacing: .6px; text-transform: uppercase;
  color: var(--primary-text); margin: 4px 2px 10px; display: flex; align-items: center; gap: 6px; }

/* Colourful tile launcher (gbsTexWeb .home-tile) */
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (max-width: 370px) { .tiles { gap: 9px; } }
@media (min-width: 560px) { .tiles { grid-template-columns: repeat(4, 1fr); } }
.tile {
  position: relative; border: 0; border-radius: 16px; padding: 18px 8px 14px; cursor: pointer; color: #fff;
  display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center;
  background: var(--tc, #444);
  background: linear-gradient(150deg, var(--tc, #444), color-mix(in srgb, var(--tc, #444) 70%, #000 22%));
  box-shadow: 0 4px 14px rgba(0,0,0,.22); transition: transform .1s, box-shadow .15s;
}
.tile:active { transform: scale(.95); box-shadow: 0 2px 6px rgba(0,0,0,.2); }
.tile i { font-size: 1.75rem; line-height: 1; }
.tile b { font-size: .82rem; line-height: 1.15; }
.tile small { font-family: var(--font-ml); font-size: .7rem; opacity: .88; line-height: 1.2; }
.tile .soon { position: absolute; top: 7px; right: 7px; font-size: .55rem; font-weight: 800; letter-spacing: .4px;
  background: rgba(255,255,255,.25); border-radius: 6px; padding: 2px 5px; }

/* ── Bottom sheet (Appearance & Security) ──────────────────────── */
.sheet-back { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 60; opacity: 0; pointer-events: none; transition: opacity .2s; }
.sheet-back.open { opacity: 1; pointer-events: auto; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 61; max-height: 90vh; overflow-y: auto;
  background: var(--surface); color: var(--text); border-radius: 20px 20px 0 0;
  padding: 8px 18px calc(20px + env(safe-area-inset-bottom)); transform: translateY(105%); transition: transform .25s ease;
  max-width: 640px; margin: 0 auto; box-shadow: 0 -10px 40px rgba(0,0,0,.25);
}
.sheet.open { transform: translateY(0); }
.sheet .grab { width: 42px; height: 5px; border-radius: 3px; background: var(--border); margin: 4px auto 12px; }
.sheet h5 { font-size: 1.05rem; font-weight: 800; margin: 0 0 14px; display: flex; align-items: center; gap: 8px; }
.set-card { border: 1px solid var(--border); border-radius: 14px; padding: 13px 14px; margin-bottom: 12px; background: var(--surface-2); }
.set-card .h { font-size: .74rem; font-weight: 800; letter-spacing: .5px; text-transform: uppercase; color: var(--text-muted); margin-bottom: 10px; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 0; }
.set-row + .set-row { border-top: 1px dashed var(--border); }
.set-row .t b { display: block; font-size: .92rem; }
.set-row .t span { font-size: .76rem; color: var(--text-muted); }

.sw { position: relative; width: 50px; height: 28px; flex: 0 0 auto; }
.sw input { opacity: 0; width: 0; height: 0; }
.sw span { position: absolute; inset: 0; background: var(--border); border-radius: 28px; transition: .2s; cursor: pointer; }
.sw span::before { content: ""; position: absolute; width: 22px; height: 22px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.sw input:checked + span { background: var(--primary); }
.sw input:checked + span::before { transform: translateX(22px); }

.seg { display: inline-flex; border: 1.5px solid var(--border); border-radius: 10px; overflow: hidden; }
.seg button { border: 0; background: transparent; color: var(--text); padding: 7px 12px; font-size: .82rem; font-weight: 600; cursor: pointer; }
.seg button + button { border-left: 1.5px solid var(--border); }
.seg button.on { background: var(--primary); color: #fff; }

.dev-list { list-style: none; padding: 0; margin: 8px 0 0; }
.dev-list li { display: flex; align-items: center; gap: 10px; padding: 8px 0; font-size: .84rem; }
.dev-list li + li { border-top: 1px dashed var(--border); }
.dev-list li i { font-size: 1.2rem; color: var(--primary-text); }
.dev-list li .d { flex: 1; min-width: 0; }
.dev-list li .d small { display: block; color: var(--text-muted); font-size: .72rem; }
.dev-list li button { border: 0; background: none; color: var(--danger); font-size: 1.05rem; cursor: pointer; }

.btn-line {
  width: 100%; min-height: 46px; border-radius: 11px; border: 1.5px solid var(--border); background: var(--surface);
  color: var(--text); font-weight: 700; display: flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer; margin-top: 8px;
}
.btn-line.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, var(--border)); }

/* Fingerprint offer (after a password sign-in) */
.offer {
  position: fixed; left: 12px; right: 12px; bottom: calc(14px + env(safe-area-inset-bottom)); z-index: 50; max-width: 460px; margin: 0 auto;
  background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 16px;
  padding: 14px; box-shadow: 0 14px 40px rgba(0,0,0,.28); display: flex; gap: 12px; align-items: flex-start;
  animation: up .3s ease;
}
.offer .fp { font-size: 2rem; line-height: 1; }
.offer .b { display: flex; gap: 8px; margin-top: 10px; }
.offer .b button { flex: 1; min-height: 40px; border-radius: 10px; font-weight: 700; cursor: pointer; }
.offer .yes { background: var(--primary); color: #fff; border: 0; }
.offer .no  { background: transparent; color: var(--text); border: 1.5px solid var(--border); }
@keyframes up { from { transform: translateY(30px); opacity: 0; } to { transform: none; opacity: 1; } }

/* Toast */
.toast-mm {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(20px);
  background: #222a35; color: #fff; padding: 11px 18px; border-radius: 12px; font-size: .88rem; z-index: 90;
  opacity: 0; transition: .25s; max-width: calc(100% - 32px); box-shadow: 0 8px 24px rgba(0,0,0,.3); pointer-events: none;
}
.toast-mm.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast-mm.ok { background: var(--success); }
.toast-mm.err { background: var(--danger); }

/* Spinner (pages without Bootstrap JS/CSS still use the same class name) */
.spinner-border { display: inline-block; width: 1rem; height: 1rem; border: 2px solid currentColor;
  border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; vertical-align: -2px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Password strength */
.pw-meter { height: 6px; border-radius: 4px; background: var(--border); overflow: hidden; margin-top: 7px; }
.pw-meter span { display: block; height: 100%; width: 0; transition: width .2s, background .2s; }
.pw-rules { list-style: none; padding: 0; margin: 8px 0 0; font-size: .78rem; color: var(--text-muted); }
.pw-rules li { display: flex; gap: 6px; align-items: center; }
.pw-rules li.ok { color: var(--ok-cl); }
