/* RUSHIKULAM Office — phone first, the same page grows into a sidebar layout on a computer. */
@font-face { font-family: 'Marcellus'; src: url('../assets/fonts/Marcellus-Regular.ttf'); font-display: swap; }
@font-face { font-family: 'Mukta'; font-weight: 400; src: url('../assets/fonts/Mukta-Regular.ttf'); font-display: swap; }
@font-face { font-family: 'Mukta'; font-weight: 500; src: url('../assets/fonts/Mukta-Medium.ttf'); font-display: swap; }
@font-face { font-family: 'Mukta'; font-weight: 600; src: url('../assets/fonts/Mukta-SemiBold.ttf'); font-display: swap; }
@font-face { font-family: 'Mukta'; font-weight: 700; src: url('../assets/fonts/Mukta-Bold.ttf'); font-display: swap; }
@font-face { font-family: 'Tiro Devanagari Sanskrit'; src: url('../assets/fonts/TiroDevanagariSanskrit-Regular.ttf'); font-display: swap; }

:root {
  --bg: #FBF6EE; --surface: #FFFFFF; --surface2: #F6EEE3; --tint: #FCEBD9;
  --ink: #2B1B17; --ink2: #4A3A33; --muted: #7A6A63; --line: #EADFD3;
  --maroon: #6B1E1E; --maroon-deep: #3A0E0E; --saffron: #E07B24; --saffron-ink: #AD4A18; --gold: #C9A55C;
  --ok: #2F7D4A; --ok-soft: #E3F1E7; --warn: #B7791F; --warn-soft: #FBF0D9; --danger: #C0392B; --danger-soft: #FBE4E1;
  --radius: 14px; --shadow: 0 1px 2px rgba(60, 30, 10, .06), 0 8px 24px rgba(60, 30, 10, .07);
  --tabbar: 64px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 16px/1.5 'Mukta', 'Noto Sans Kannada', 'Nirmala UI', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: 'Marcellus', Georgia, serif; font-weight: 400; margin: 0; line-height: 1.2; }
h1 { font-size: 26px; } h2 { font-size: 20px; } h3 { font-size: 17px; }
p { margin: 0; }
a { color: var(--saffron-ink); }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.muted { color: var(--muted); } .small { font-size: 14px; } .center { text-align: center; }
.deva { font-family: 'Tiro Devanagari Sanskrit', 'Mukta', serif; }
.row { display: flex; align-items: center; gap: 10px; } .row.wrap { flex-wrap: wrap; } .grow { flex: 1 1 auto; min-width: 0; }
.stack { display: grid; gap: 14px; } .stack.tight { gap: 8px; } .stack.loose { gap: 22px; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

/* ── first paint ── */
.boot { min-height: 100dvh; display: grid; place-content: center; justify-items: center; gap: 14px; color: var(--muted); }

/* ── buttons ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 18px;
  border: 1px solid transparent; border-radius: 12px; background: var(--maroon); color: #fff; font-weight: 600;
  cursor: pointer; text-decoration: none; transition: transform .08s ease, background .15s ease, opacity .15s ease; white-space: nowrap;
}
.btn:hover { background: #7C2424; } .btn:active { transform: scale(.98); }
.btn.saffron { background: var(--saffron); } .btn.saffron:hover { background: #cf6f1d; }
.btn.ghost { background: transparent; color: var(--maroon); border-color: var(--line); } .btn.ghost:hover { background: var(--surface2); }
.btn.quiet { background: transparent; color: var(--ink2); } .btn.quiet:hover { background: var(--surface2); }
.btn.danger { background: transparent; color: var(--danger); border-color: #edc4be; } .btn.danger:hover { background: var(--danger-soft); }
.btn.small { min-height: 38px; padding: 0 12px; font-size: 14.5px; border-radius: 10px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: default; pointer-events: none; }
.btn svg { width: 18px; height: 18px; flex: none; }
.icon-btn { width: 44px; height: 44px; display: inline-grid; place-items: center; border: 0; border-radius: 12px; background: transparent; color: var(--ink2); cursor: pointer; }
.icon-btn:hover { background: var(--surface2); } .icon-btn svg { width: 20px; height: 20px; }
:focus-visible { outline: 3px solid rgba(224, 123, 36, .45); outline-offset: 2px; }

/* ── fields ── */
.field { display: grid; gap: 6px; }
.field > span.label { font-weight: 600; font-size: 14.5px; color: var(--ink2); }
.field .help { font-size: 13.5px; color: var(--muted); }
input[type=text], input[type=email], input[type=url], input[type=number], input[type=search], input[type=date], input[type=tel], select, textarea {
  width: 100%; min-height: 46px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); outline: none;
}
textarea { min-height: 96px; resize: vertical; line-height: 1.55; }
input:focus, select:focus, textarea:focus { border-color: var(--saffron); box-shadow: 0 0 0 3px rgba(224, 123, 36, .16); }
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch i { width: 46px; height: 28px; border-radius: 99px; background: #d9cdc0; position: relative; transition: background .15s; flex: none; }
.switch i::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .15s; }
.switch input:checked + i { background: var(--ok); } .switch input:checked + i::after { transform: translateX(18px); }
.switch input:focus-visible + i { outline: 3px solid rgba(224, 123, 36, .45); outline-offset: 2px; }

/* ── cards and badges ── */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.card.flat { box-shadow: none; } .card.tint { background: var(--tint); border-color: #f3d7ba; } .card.note { background: var(--warn-soft); border-color: #f0dcae; }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 99px; font-size: 13px; font-weight: 600; background: var(--surface2); color: var(--ink2); white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); } .badge.warn { background: var(--warn-soft); color: var(--warn); } .badge.gold { background: #f6ecd4; color: #8a6a22; }
.empty { text-align: center; padding: 34px 18px; color: var(--muted); border: 1.5px dashed var(--line); border-radius: var(--radius); background: rgba(255,255,255,.5); }
.empty h3 { color: var(--ink); margin-bottom: 6px; }

/* ── shell ── */
.shell { min-height: 100dvh; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--maroon); color: #fff; }
.topbar img { width: 34px; height: auto; } .topbar .title { font-family: 'Marcellus', serif; font-size: 19px; letter-spacing: .02em; }
.topbar .who { margin-left: auto; font-size: 13.5px; opacity: .85; max-width: 46vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.preview-flag { background: var(--gold); color: #3a2a05; text-align: center; font-size: 13.5px; font-weight: 600; padding: 4px 10px; }
main.page { padding: 18px 14px calc(var(--tabbar) + 28px); max-width: 980px; margin: 0 auto; }
.page-head { display: grid; gap: 4px; margin-bottom: 16px; }
nav.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; height: calc(var(--tabbar) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--surface); border-top: 1px solid var(--line); }
nav.tabs a { display: grid; place-content: center; justify-items: center; gap: 2px; text-decoration: none; color: var(--muted); font-size: 12px; font-weight: 600; }
nav.tabs a svg { width: 22px; height: 22px; } nav.tabs a.on { color: var(--maroon); }
nav.side { display: none; }

@media (min-width: 900px) {
  .shell { display: grid; grid-template-columns: 250px 1fr; }
  .topbar { display: none; } nav.tabs { display: none; }
  nav.side { display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100dvh; padding: 20px 14px; background: var(--maroon); color: #fff; }
  nav.side .brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; }
  nav.side .brand img { width: 42px; } nav.side .brand b { font-family: 'Marcellus', serif; font-weight: 400; font-size: 20px; letter-spacing: .03em; display: block; }
  nav.side .brand span { font-size: 12.5px; opacity: .75; }
  nav.side a { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 12px; color: rgba(255,255,255,.82); text-decoration: none; font-weight: 500; }
  nav.side a svg { width: 20px; height: 20px; } nav.side a:hover { background: rgba(255,255,255,.08); } nav.side a.on { background: rgba(255,255,255,.14); color: #fff; }
  nav.side .foot { margin-top: auto; font-size: 13px; opacity: .8; padding: 8px; display: grid; gap: 8px; word-break: break-all; }
  nav.side .foot button { justify-self: start; background: transparent; border: 1px solid rgba(255,255,255,.35); color: #fff; border-radius: 10px; padding: 7px 12px; cursor: pointer; }
  main.page { padding: 30px 32px 60px; margin: 0; max-width: 1040px; }
}

/* ── sign in ── */
.signin { min-height: 100dvh; display: grid; place-items: center; padding: 22px; background: radial-gradient(120% 80% at 50% 0%, #7A2626 0%, #4A1212 70%); }
.signin .card { width: min(430px, 100%); padding: 26px 22px; }
.signin .logo { display: grid; justify-items: center; gap: 8px; margin-bottom: 18px; text-align: center; } .signin .logo img { width: 92px; }
.code-input { letter-spacing: .5em; text-align: center; font-size: 24px !important; font-weight: 600; }

/* ── dashboard ── */
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (min-width: 700px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stat { padding: 14px; } .stat b { display: block; font-family: 'Marcellus', serif; font-weight: 400; font-size: 30px; line-height: 1.1; color: var(--maroon); }
.stat span { font-size: 13.5px; color: var(--muted); }
.bars { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; align-items: end; gap: 5px; height: 120px; }
.bars div { background: linear-gradient(#E8872E, #B8461F); border-radius: 5px 5px 2px 2px; min-height: 3px; position: relative; }
.bars div.zero { background: var(--line); }
.bar-labels { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 5px; font-size: 11px; color: var(--muted); text-align: center; margin-top: 4px; }
.quick { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.quick a { display: flex; gap: 12px; align-items: center; padding: 14px; text-decoration: none; color: var(--ink); }
.quick a svg { width: 26px; height: 26px; color: var(--saffron); flex: none; } .quick a b { display: block; font-weight: 600; } .quick a span { font-size: 13.5px; color: var(--muted); }

/* ── toolbars and lists ── */
.toolbar { display: grid; gap: 10px; margin-bottom: 14px; }
@media (min-width: 700px) { .toolbar { grid-template-columns: 1fr 220px auto; align-items: center; } }
.list { display: grid; gap: 10px; }
.item { padding: 14px; } .item.open { border-color: var(--saffron); box-shadow: 0 0 0 3px rgba(224,123,36,.12), var(--shadow); }
.item .now { font-size: 16.5px; white-space: pre-wrap; overflow-wrap: anywhere; }
.item .orig { font-size: 13.5px; color: var(--muted); margin-top: 6px; white-space: pre-wrap; overflow-wrap: anywhere; }
.item .meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 6px; }
.item button.line { all: unset; display: block; width: 100%; cursor: pointer; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.slot { background: #f6ecd4; color: #8a6a22; border-radius: 6px; padding: 0 5px; font-weight: 600; }

/* ── banners ── */
.banner-card { display: grid; gap: 12px; grid-template-columns: 112px 1fr; align-items: start; }
.banner-card .thumb { width: 112px; aspect-ratio: 16/9; border-radius: 10px; background: linear-gradient(135deg, #E8872E, #6B1E1E); object-fit: cover; display: block; }
.banner-card.off { opacity: .62; }
.preview-banner { position: relative; border-radius: 16px; overflow: hidden; aspect-ratio: 16/9; background: linear-gradient(135deg, #E8872E, #B8461F 55%, #6B1E1E); color: #fff; display: flex; align-items: flex-end; max-width: 420px; }
.preview-banner img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.preview-banner .shade { position: absolute; inset: 0; background: linear-gradient(transparent 35%, rgba(26,10,5,.82)); }
.preview-banner .txt { position: relative; padding: 14px; } .preview-banner .txt b { font-family: 'Marcellus', serif; font-weight: 400; font-size: 20px; display: block; line-height: 1.2; } .preview-banner .txt span { font-size: 14px; opacity: .9; }

/* ── chant editor ── */
.grid2 { display: grid; gap: 14px; } @media (min-width: 700px) { .grid2 { grid-template-columns: 1fr 1fr; } }
.lyrics-cols { display: grid; gap: 12px; } @media (min-width: 900px) { .lyrics-cols { grid-template-columns: repeat(3, 1fr); } .lyrics-cols.two { grid-template-columns: repeat(2, 1fr); } }
.lyrics-cols textarea { min-height: 200px; white-space: pre; overflow-x: auto; }
.timing { display: grid; gap: 8px; }
.timing .tline { display: grid; grid-template-columns: 34px 1fr 96px 44px; gap: 8px; align-items: center; padding: 8px 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.timing .tline.now { border-color: var(--saffron); background: var(--tint); }
.timing .tline .n { color: var(--muted); font-size: 13px; text-align: center; } .timing .tline .words { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.timing .tline input { min-height: 40px; padding: 6px 8px; text-align: right; }
.tap-pad { position: sticky; bottom: calc(var(--tabbar) + 86px); z-index: 5; display: grid; gap: 8px; padding: 12px; border-radius: 16px; background: var(--maroon); color: #fff; box-shadow: var(--shadow); }
@media (min-width: 900px) { .tap-pad { bottom: 90px; } }
.tap-pad audio { width: 100%; height: 40px; } .tap-pad .next { min-height: 58px; font-size: 18px; background: var(--saffron); }
.tap-pad .upnext { font-size: 14.5px; opacity: .92; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.savebar { position: sticky; bottom: calc(var(--tabbar) + 8px); z-index: 6; display: flex; gap: 8px; flex-wrap: wrap; padding: 10px; margin-top: 18px; border-radius: 16px; background: rgba(255,255,255,.94); border: 1px solid var(--line); box-shadow: var(--shadow); backdrop-filter: blur(6px); }
@media (min-width: 900px) { .savebar { bottom: 12px; } }

/* ── dialogs and toasts ── */
dialog { border: 0; border-radius: 18px; padding: 22px; width: min(440px, calc(100vw - 32px)); box-shadow: 0 24px 60px rgba(30, 10, 5, .35); color: var(--ink); }
dialog::backdrop { background: rgba(30, 10, 5, .45); }
dialog h2 { margin-bottom: 8px; } dialog .actions { justify-content: flex-end; margin-top: 18px; }
#toasts { position: fixed; left: 0; right: 0; bottom: calc(var(--tabbar) + 16px); z-index: 60; display: grid; justify-items: center; gap: 8px; pointer-events: none; padding: 0 14px; }
@media (min-width: 900px) { #toasts { bottom: 22px; } }
.toast { background: #2B1B17; color: #fff; padding: 11px 16px; border-radius: 12px; box-shadow: var(--shadow); max-width: 560px; animation: rise .18s ease; }
.toast.ok { background: var(--ok); } .toast.bad { background: var(--danger); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid rgba(255,255,255,.4); border-top-color: #fff; animation: spin .7s linear infinite; }
.spinner.dark { border-color: var(--line); border-top-color: var(--maroon); width: 26px; height: 26px; margin: 30px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
