:root {
  color-scheme: light;
  --bg: #f6f2e9;
  --card: #fff;
  --text: #201a0f;
  --muted: #736a58;
  --line: #ece5d4;
  --ink: #17130b;
  --ink-2: #2b2314;
  --brand: #8a6410;
  --brand-soft: #fbf0cf;
  --gold-1: #fbe7a6;
  --gold-2: #e0b341;
  --gold-3: #b4850f;
  --gold: linear-gradient(135deg, var(--gold-1) 0%, var(--gold-2) 48%, var(--gold-3) 100%);
  --dark: radial-gradient(120% 140% at 100% 0%, #5a4516 0%, var(--ink-2) 45%, var(--ink) 100%);
  --danger: #b3261e;
  --danger-soft: #fdeae8;
  --ok: #1d6b3d;
  --ok-soft: #e2f4e8;
  --radius: 18px;
  --radius-s: 12px;
  --shadow: 0 1px 2px rgba(60, 45, 10, .06), 0 8px 24px -12px rgba(60, 45, 10, .18);
  --serif: "Cormorant Garamond", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); }
h1 { font-family: var(--serif); font-size: 1.75rem; line-height: 1.2; margin: 0; letter-spacing: .005em; }
h2 { font-size: 1.02rem; font-weight: 700; margin: 0 0 .85rem; }
h3 { font-size: .95rem; margin: 1.1rem 0 .5rem; }
a { color: var(--brand); }
[hidden] { display: none !important; }
.muted { color: var(--muted); font-size: .87rem; }
.loading { padding: 2.5rem; text-align: center; color: var(--muted); }
.error { color: var(--danger); }
.right { text-align: right; }
svg.icon { width: 1.35em; height: 1.35em; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- layout ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar { width: 250px; flex: none; background: var(--dark); color: #fff; padding: 1.1rem .85rem; position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; gap: .2rem; }
.brand { display: flex; align-items: center; gap: .7rem; font-family: var(--serif); font-size: 1.2rem; font-weight: 700; line-height: 1.2; color: var(--gold-1); overflow-wrap: anywhere; }
.sidebar .brand { padding: .2rem .4rem 1.1rem; margin-bottom: .6rem; border-bottom: 1px solid rgba(251, 231, 166, .16); }
.mark { width: 38px; height: 38px; border-radius: 12px; background: var(--gold); color: var(--ink); display: inline-flex; align-items: center; justify-content: center; flex: none; box-shadow: inset 0 1px 0 rgba(255,255,255,.6), 0 4px 14px -4px rgba(224,179,65,.6); font-size: 1rem; }
.sidebar a, .sidebar button.link { display: flex; align-items: center; gap: .75rem; color: #e8dfc9; text-decoration: none; padding: .6rem .75rem; border-radius: var(--radius-s); text-align: left; min-height: 0; }
.sidebar a:hover, .sidebar button.link:hover { background: rgba(255,255,255,.07); color: #fff; }
.sidebar a.active { background: var(--gold); color: var(--ink); font-weight: 700; box-shadow: 0 6px 18px -8px rgba(224,179,65,.8); }
.sidebar .spacer { flex: 1; min-height: .75rem; }
.sidebar .account { color: #bfb399; font-size: .82rem; padding: .75rem .75rem .4rem; border-top: 1px solid rgba(251, 231, 166, .16); }
.sidebar .account strong { display: block; color: #fff; font-size: .92rem; }
.topbar, .tabbar, .scrim { display: none; }
main { flex: 1; min-width: 0; padding: 1.6rem 1.75rem 2.5rem; max-width: 1240px; margin: 0 auto; }
.head { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; justify-content: space-between; margin-bottom: 1.15rem; }
.banner { background: var(--danger-soft); color: var(--danger); border: 1px solid #f3c2bd; padding: .75rem 1rem; border-radius: var(--radius-s); margin-bottom: 1rem; }

/* ---------- cards ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.2rem; margin-bottom: 1rem; box-shadow: var(--shadow); }
.grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); align-items: start; margin-bottom: 1rem; }
.grid > .card { margin: 0; }
.card.highlight { background: var(--dark); border-color: var(--ink); color: #fff; }
.card.highlight h2 { color: var(--gold-1); font-family: var(--serif); font-size: 1.3rem; }
.card.highlight dt, .card.highlight .muted { color: #c9bd9f; }
.card.highlight dl.facts .total { color: var(--gold-1); border-top-color: rgba(251, 231, 166, .25); font-size: 1.45rem; }

.hero { position: relative; overflow: hidden; background: var(--dark); color: #fff; border-radius: 22px; padding: 1.4rem 1.5rem; margin-bottom: 1rem; box-shadow: 0 18px 40px -20px rgba(40, 28, 4, .7); }
.hero::after { content: ""; position: absolute; right: -60px; bottom: -90px; width: 220px; height: 220px; border-radius: 50%; border: 28px solid rgba(224, 179, 65, .14); pointer-events: none; }
.hero .label { color: #c9bd9f; font-size: .78rem; text-transform: uppercase; letter-spacing: .09em; }
.hero .figure { display: block; font-size: clamp(2rem, 7vw, 2.9rem); font-weight: 750; line-height: 1.15; color: var(--gold-1); text-decoration: none; overflow-wrap: anywhere; margin: .15rem 0 1rem; }
.hero .chips { display: flex; flex-wrap: wrap; gap: .5rem; position: relative; z-index: 1; }
.chip { background: rgba(255,255,255,.09); border: 1px solid rgba(251, 231, 166, .18); border-radius: 99px; padding: .3rem .8rem; font-size: .83rem; color: #f3ead3; }
.chip b { color: #fff; }

.quick { display: grid; grid-template-columns: repeat(5, 1fr); gap: .75rem; margin-bottom: 1rem; }
.quick a { display: flex; flex-direction: column; align-items: center; gap: .45rem; text-align: center; text-decoration: none; color: var(--text); font-size: .82rem; font-weight: 600; line-height: 1.25; }
.quick i { width: 56px; height: 56px; border-radius: 18px; background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow); display: flex; align-items: center; justify-content: center; color: var(--brand); font-size: 1.15rem; transition: transform .15s; }
.quick a:first-child i { background: var(--gold); border-color: transparent; color: var(--ink); }
.quick a:hover i { transform: translateY(-2px); }

.stats { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); margin-bottom: 1rem; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.05rem; text-decoration: none; color: inherit; box-shadow: var(--shadow); min-width: 0; }
.stat i { width: 38px; height: 38px; border-radius: var(--radius-s); background: var(--brand-soft); color: var(--brand); display: flex; align-items: center; justify-content: center; margin-bottom: .6rem; }
.stat span { display: block; color: var(--muted); font-size: .81rem; }
.stat strong { display: block; font-size: 1.3rem; overflow-wrap: anywhere; }
.stat small { display: block; color: var(--muted); font-size: .8rem; }
.stat.alert { border-color: #f0bdb8; }
.stat.alert i { background: var(--danger-soft); color: var(--danger); }
.stat.alert strong { color: var(--danger); }
a.stat { transition: transform .15s; }
a.stat:hover { transform: translateY(-2px); }

/* ---------- controls ---------- */
button, .btn { font: inherit; font-weight: 600; cursor: pointer; border: 1px solid var(--line); background: #fff; color: var(--text); border-radius: var(--radius-s); padding: .55rem 1.05rem; min-height: 2.6rem; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: .45rem; transition: transform .1s, filter .15s; }
button:hover:not(:disabled), .btn:hover { filter: brightness(.97); }
button:active:not(:disabled), .btn:active { transform: scale(.97); }
button.primary, .btn.primary { background: var(--gold); border-color: transparent; color: var(--ink); box-shadow: inset 0 1px 0 rgba(255,255,255,.55), 0 8px 18px -10px rgba(160, 117, 12, .9); }
button.danger { color: var(--danger); border-color: #efc3bf; }
button.small, .btn.small { padding: .25rem .7rem; font-size: .82rem; min-height: 2rem; border-radius: 10px; }
button.link { background: none; border: 0; padding: 0; min-height: 0; color: var(--brand); justify-content: flex-start; }
button:disabled { opacity: .5; cursor: default; }
.actions { display: flex; flex-wrap: wrap; gap: .55rem; align-items: center; }

label { display: block; font-size: .82rem; font-weight: 600; color: var(--muted); }
input, select, textarea { font: inherit; font-weight: 400; width: 100%; padding: .55rem .8rem; border: 1px solid #ddd4bd; border-radius: var(--radius-s); background: #fffdf8; color: var(--text); margin-top: .25rem; min-height: 2.8rem; transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { outline: 0; border-color: var(--gold-3); box-shadow: 0 0 0 3px rgba(224, 179, 65, .28); background: #fff; }
input[type=checkbox], input[type=radio] { width: 1.15rem; height: 1.15rem; min-height: 0; margin: 0 .5rem 0 0; accent-color: var(--gold-3); }
input[type=file] { padding: .4rem; font-size: .85rem; border-style: dashed; }
input[type=file]::file-selector-button { font: inherit; font-weight: 600; border: 0; border-radius: 8px; background: var(--brand-soft); color: var(--brand); padding: .3rem .7rem; margin-right: .6rem; cursor: pointer; }
textarea { min-height: 5.5rem; resize: vertical; }
label.check { display: flex; align-items: center; color: var(--text); font-size: .92rem; min-height: 2.8rem; }
:focus-visible { outline: 2px solid var(--gold-3); outline-offset: 2px; }
.fields { display: grid; gap: .85rem; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); margin-bottom: 1rem; }
.fields .wide { grid-column: 1 / -1; }
.toolbar { display: flex; flex-wrap: wrap; gap: .55rem; margin-bottom: .85rem; }
.toolbar input, .toolbar select { width: auto; flex: 1 1 170px; max-width: 340px; margin: 0; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: .7rem .65rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: .72rem; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fdf9ec; }
td a { font-weight: 700; text-decoration: none; }
td.num, th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
tr.void td { text-decoration: line-through; color: var(--muted); }

.badge { display: inline-block; font: 700 .72rem/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; padding: .12rem .65rem; border-radius: 99px; background: var(--brand-soft); color: #6b4e08; white-space: nowrap; vertical-align: middle; }
.badge::first-letter { text-transform: uppercase; }
.badge.overdue, .badge.failed { background: var(--danger-soft); color: var(--danger); }
.badge.closed, .badge.sent { background: var(--ok-soft); color: var(--ok); }
.badge.cancelled, .badge.auctioned { background: #eeebe3; color: var(--muted); }

dl.facts { display: grid; grid-template-columns: auto 1fr; row-gap: .4rem; margin: 0; }
dl.facts dt { color: var(--muted); }
dl.facts dd { margin: 0; padding-left: 1rem; text-align: right; font-weight: 600; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
dl.facts .total { font-weight: 750; font-size: 1.15rem; margin-top: .35rem; border-top: 1px solid var(--line); padding-top: .55rem; color: var(--text); align-self: stretch; display: flex; align-items: center; }
dl.facts dd.total { justify-content: flex-end; }

.thumbs { display: flex; flex-wrap: wrap; gap: .7rem; }
.thumb { width: 112px; font-size: .75rem; text-align: center; overflow-wrap: anywhere; }
.thumb img, .thumb .doc { width: 112px; height: 112px; object-fit: cover; border-radius: var(--radius-s); border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; background: #faf7ee; font-weight: 700; box-shadow: var(--shadow); }
.thumb button.link { justify-content: center; width: 100%; }
.thumb.mini { width: 64px; display: block; margin-top: .4rem; }
.thumb.mini img, .thumb.mini .doc { width: 64px; height: 64px; }
.avatar { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; background: var(--gold); display: inline-flex; align-items: center; justify-content: center; font-weight: 800; text-transform: uppercase; color: var(--ink); flex: none; border: 2px solid #fff; box-shadow: 0 0 0 2px var(--gold-2); }
.who { display: flex; gap: .8rem; align-items: center; }
.head .who .avatar { width: 58px; height: 58px; font-size: 1.3rem; }

.item-row { border: 1px solid var(--line); border-left: 4px solid var(--gold-2); border-radius: var(--radius-s); padding: .9rem; margin-bottom: .75rem; background: #fffcf4; }
/* article lines on the new loan form */
.article-head, .article { display: grid; grid-template-columns: 6.5rem minmax(9rem, 1fr) 4.5rem 6.2rem 6.2rem 6rem 7rem 7.5rem 2.4rem; gap: .5rem; align-items: center; }
.article-head { font-size: .72rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; align-items: end; padding: 0 .6rem .35rem; }
.article { border: 1px solid var(--line); border-left: 4px solid var(--gold-2); border-radius: var(--radius-s); background: #fffcf4; padding: .5rem .6rem; margin-bottom: .5rem; }
.article label > span, .article .value > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.article input, .article select { margin: 0; padding-left: .55rem; padding-right: .4rem; }
.article .value { text-align: right; overflow-wrap: anywhere; }
.article [data-remove] { padding: 0; width: 2.4rem; }
.article-total { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; justify-content: space-between; }

/* not enough width for one line: each article becomes a small card */
@media (max-width: 1180px) {
  .article-head { display: none; }
  .article { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: end; padding: .8rem; }
  .article label > span, .article .value > span { position: static; width: auto; height: auto; overflow: visible; clip-path: none; display: block; font-size: .8rem; }
  .article input, .article select { margin-top: .25rem; }
  .article .name { grid-column: 1 / -1; }
  .article .value { grid-column: 1 / -1; text-align: left; display: flex; gap: .5rem; align-items: baseline; }
  .article [data-remove] { grid-column: 1 / -1; width: 100%; }
}


.world { display: grid; gap: .55rem; background: var(--brand-soft); border-radius: var(--radius-s); padding: .85rem 1rem; margin-bottom: .85rem; }

.switch { display: inline-flex; gap: .25rem; background: var(--brand-soft); border-radius: 99px; padding: .25rem; margin-bottom: .85rem; }
.switch button { border: 0; border-radius: 99px; background: transparent; min-width: 7rem; }
.switch button[aria-pressed="true"] { background: var(--gold); color: var(--ink); }
:lang(te) { font-family: system-ui, "Nirmala UI", "Noto Sans Telugu", Gautami, sans-serif; line-height: 1.7; }

.pager { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: flex-end; align-items: center; margin-top: .85rem; }

/* ---------- dialogs, toasts, camera ---------- */
dialog { border: 0; border-radius: 22px; padding: 1.35rem; width: min(580px, calc(100vw - 1.5rem)); box-shadow: 0 30px 80px rgba(30, 20, 0, .4); color: var(--text); }
dialog::backdrop { background: rgba(23, 19, 11, .6); backdrop-filter: blur(3px); }
dialog h2 { font-family: var(--serif); font-size: 1.4rem; }
dialog:modal form > .actions:last-child { position: sticky; bottom: -1.35rem; background: #fff; margin-bottom: -1.35rem; padding: .75rem 0 1.1rem; }
#toasts { position: fixed; right: 1rem; bottom: 1rem; left: 1rem; display: flex; flex-direction: column; align-items: flex-end; gap: .5rem; z-index: 30; pointer-events: none; }
.toast { background: var(--ink); color: #fff; padding: .7rem 1rem; border-radius: var(--radius-s); border-left: 4px solid var(--gold-2); max-width: 430px; box-shadow: 0 10px 30px -10px rgba(0,0,0,.5); animation: rise .2s ease-out; }
.toast.bad { background: var(--danger); border-left-color: #ffd0cc; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
.camera-button { margin-top: .4rem; }
dialog.camera video { width: 100%; max-height: 55vh; background: #000; border-radius: var(--radius-s); }
dialog.camera .thumbs, dialog.camera label { margin-bottom: .75rem; }

/* ---------- sign in ---------- */
.auth { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-art { background: var(--dark); color: #f3ead3; padding: 3rem; display: flex; flex-direction: column; justify-content: center; gap: 1.2rem; }
.auth-art h2 { font-family: var(--serif); font-size: 2.6rem; line-height: 1.15; color: var(--gold-1); margin: 0; }
.auth-art ul { list-style: none; padding: 0; margin: 0; display: grid; gap: .8rem; }
.auth-art li { display: flex; align-items: center; gap: .75rem; }
.auth-art li svg { color: var(--gold-2); }
.auth-form { display: flex; align-items: center; justify-content: center; padding: 1.5rem; }
.auth-form .card { width: 100%; max-width: 420px; padding: 1.75rem; margin: 0; }
.auth-form h1 { margin: .9rem 0 .2rem; }
.auth .fields { grid-template-columns: 1fr; }
.auth input.code { text-align: center; font-size: 1.6rem; font-weight: 700; letter-spacing: .45em; }
.auth .actions { justify-content: space-between; margin-bottom: 0; }
.auth .actions button.link { margin: 0; }
.auth button.primary { width: 100%; min-height: 3rem; }
.auth button.link { margin: 0 auto; }

#print { display: none; }

/* ---------- phones and small tablets ---------- */
@media (max-width: 820px) {
  body { font-size: 15px; }
  .shell { display: block; }
  .topbar { display: flex; align-items: center; gap: .7rem; background: var(--dark); padding: calc(.6rem + env(safe-area-inset-top)) 1rem .6rem; position: sticky; top: 0; z-index: 6; box-shadow: 0 8px 20px -14px rgba(0,0,0,.7); }
  .topbar .brand { font-size: 1.1rem; min-width: 0; }
  .topbar .brand span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

  main { padding: 1rem .85rem calc(6.5rem + env(safe-area-inset-bottom)); }
  h1 { font-size: 1.5rem; }
  .card { padding: 1rem; }
  input, select, textarea { font-size: 16px; } /* stops iOS zooming on focus */
  button.small, .btn.small { min-height: 2.4rem; }

  /* bottom navigation */
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); align-items: end; position: fixed; left: 0; right: 0; bottom: 0; z-index: 8; background: rgba(255, 255, 255, .96); backdrop-filter: blur(10px); border-top: 1px solid var(--line); border-radius: 22px 22px 0 0; padding: .45rem .35rem calc(.45rem + env(safe-area-inset-bottom)); box-shadow: 0 -10px 30px -18px rgba(60, 45, 10, .5); }
  .tabbar a, .tabbar button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .1rem; border: 0; background: none; color: var(--muted); font-size: .7rem; font-weight: 600; text-decoration: none; min-height: 3.1rem; padding: 0; }
  .tabbar svg.icon { width: 24px; height: 24px; }
  .tabbar .active { color: var(--brand); }
  .tabbar .active svg.icon { background: var(--brand-soft); border-radius: 99px; width: 46px; padding: 2px 11px; }
  .tabbar .add i { width: 56px; height: 56px; margin-top: -30px; border-radius: 50%; background: var(--gold); color: var(--ink); border: 4px solid #fff; display: flex; align-items: center; justify-content: center; box-shadow: 0 10px 20px -8px rgba(160, 117, 12, .9); }
  .tabbar .add i svg.icon { width: 28px; height: 28px; stroke-width: 2.4; background: none; padding: 0; }

  /* "More" sheet */
  .sidebar { display: none; position: fixed; top: auto; left: 0; right: 0; bottom: 0; width: auto; height: auto; max-height: 82vh; max-height: 82dvh; z-index: 10; border-radius: 24px 24px 0 0; padding: 1rem .85rem calc(1rem + env(safe-area-inset-bottom)); animation: sheet .22s ease-out; }
  .sidebar .brand, .sidebar .spacer, .sidebar a.in-tabbar { display: none; }
  .sidebar a, .sidebar button.link { padding: .8rem .9rem; flex: none; }
  .shell.open .sidebar { display: flex; }
  .shell.open .scrim { display: block; position: fixed; inset: 0; z-index: 9; background: rgba(23, 19, 11, .55); }

  /* actions fill the width */
  .head > .actions { width: 100%; }
  .head > .actions > * { flex: 1 1 40%; }

  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; }
  .stat { padding: .85rem; }
  .stat strong { font-size: 1.1rem; }
  .quick { gap: .4rem; }
  .quick a { font-size: .75rem; }
  .toolbar input, .toolbar select, .toolbar button, .toolbar .btn { flex: 1 1 100%; max-width: none; }

  /* tables become stacked cards */
  table.stack, table.stack tbody { display: block; }
  table.stack thead { display: none; }
  table.stack tr { display: block; background: #fff; border: 1px solid var(--line); border-radius: 16px; margin-bottom: .7rem; padding: .45rem .15rem; box-shadow: var(--shadow); }
  table.stack td { display: flex; justify-content: space-between; align-items: center; gap: 1rem; border: 0; padding: .28rem .8rem; text-align: right; white-space: normal; }
  table.stack td::before { content: attr(data-label); color: var(--muted); font-size: .8rem; text-align: left; }
  table.stack td:first-child:not(:has(input)) { justify-content: flex-start; font-size: 1.02rem; font-weight: 700; border-bottom: 1px dashed var(--line); padding-bottom: .55rem; margin-bottom: .25rem; }
  table.stack td:first-child:not(:has(input))::before { content: none; }
  table.stack td:empty { display: none; }

  /* forms slide up from the bottom */
  dialog:modal { width: 100%; max-width: 100%; margin: auto 0 0; border-radius: 24px 24px 0 0; max-height: 92vh; max-height: 92dvh; padding: 1.15rem 1rem calc(1rem + env(safe-area-inset-bottom)); animation: sheet .22s ease-out; }
  dialog .actions:last-child > * { flex: 1 1 40%; }
  /* keep Save and Cancel in reach on long forms */
  dialog:modal form > .actions:last-child { position: sticky; bottom: calc(-1rem - env(safe-area-inset-bottom)); background: #fff; border-top: 1px solid var(--line); margin: .75rem -1rem calc(-1rem - env(safe-area-inset-bottom)); padding: .7rem 1rem calc(.8rem + env(safe-area-inset-bottom)); }

  #toasts { bottom: calc(5.75rem + env(safe-area-inset-bottom)); align-items: stretch; }

  .auth { grid-template-columns: 1fr; grid-template-rows: auto 1fr; background: var(--bg); }
  .auth-art { padding: 2rem 1.4rem 4rem; gap: .6rem; }
  .auth-art h2 { font-size: 1.8rem; }
  .auth-art ul { display: none; }
  .auth-form { align-items: flex-start; padding: 0 .85rem 1.5rem; margin-top: -2.6rem; }
}
@keyframes sheet { from { transform: translateY(40px); opacity: .3; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

@media print {
  body { background: #fff; color: #000; }
  #root, #toasts, dialog { display: none !important; }
  #print { display: block; font-size: 13px; }
  #print h1, #print h2 { font-family: Georgia, serif; }
  #print .sheet { page-break-after: always; padding: 0 .5rem; }
  #print .sheet:last-child { page-break-after: auto; }
  #print .letter { white-space: pre-wrap; margin-top: 1.5rem; }
  #print header { text-align: center; border-bottom: 2px solid #000; padding-bottom: .5rem; margin-bottom: 1rem; }
  #print .sign { display: flex; justify-content: space-between; margin-top: 4rem; }
}

progress.storage { appearance: none; width: 100%; height: 12px; border: 0; border-radius: 6px; overflow: hidden; background: #e9e2d0; }
progress.storage::-webkit-progress-bar { background: #e9e2d0; }
progress.storage::-webkit-progress-value { background: #b8860b; }
progress.storage::-moz-progress-bar { background: #b8860b; }
progress.storage.full::-webkit-progress-value { background: #b3261e; }
progress.storage.full::-moz-progress-bar { background: #b3261e; }
.storage-warning { color: #b3261e; font-weight: 600; }
