:root {
  --ink: #1A1A1A;
  --muted: #5F6368;
  --line: #E3E5E8;
  --line-soft: #EEF0F3;
  --field: #D5D8DD;
  --soft: #F6F7F9;
  --blue: #1F5FD1;
  --blue-dark: #174BA8;
  --blue-soft: #EEF3FC;
  --blue-chip: #E4ECFA;
  --green: #2E6B3A;
  --green-soft: #E4F3E7;
  --amber: #8A4B00;
  --amber-soft: #FFF1DD;
  --red: #B3261E;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: #FFFFFF; color: var(--ink); }
body { font-family: 'Inter', 'Noto Sans Telugu', system-ui, sans-serif; font-size: 15px; -webkit-text-size-adjust: 100%; }
a { color: var(--blue); }
a:hover { color: var(--blue-dark); }
button, input, textarea, select { font-family: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid #9DBBF0; outline-offset: 2px; }

#app { max-width: 560px; margin: 0 auto; min-height: 100vh; display: flex; flex-direction: column; }

.topbar { display: flex; align-items: center; gap: 8px; padding: 12px 12px 12px 8px; border-bottom: 1px solid var(--line-soft); position: sticky; top: 0; background: #FFFFFF; z-index: 5; }
.topbar h1 { font-size: 17px; font-weight: 600; margin: 0; flex-grow: 1; }
.topbar .meta { font-size: 13px; color: var(--muted); padding-right: 8px; }
.iconbtn { width: 44px; height: 44px; border: 0; background: transparent; display: inline-flex; align-items: center; justify-content: center; border-radius: 10px; color: var(--ink); text-decoration: none; flex-shrink: 0; }
.iconbtn:hover { background: var(--soft); }
.iconbtn svg { width: 20px; height: 20px; }
.iconbtn.small { height: 40px; }
.iconbtn.small svg { width: 17px; height: 17px; color: var(--muted); }

.page { padding: 16px 20px; display: flex; flex-direction: column; gap: 18px; }
.home-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 20px 4px 20px; }
.brand { font-size: 17px; font-weight: 700; letter-spacing: -0.2px; }
.avatar { width: 44px; height: 44px; border-radius: 22px; border: 1px solid var(--line); background: var(--soft); font-size: 13px; font-weight: 600; }
.greet { padding: 8px 20px 0 20px; }
.greet .big { font-size: 26px; font-weight: 600; }
.greet .sub { color: var(--muted); }

.card { border: 1px solid var(--line); border-radius: 16px; padding: 16px; }
.card.soft { background: var(--soft); border: 0; }
.card.blue { background: var(--blue-soft); border: 0; }
.card h2 { font-size: 16px; font-weight: 600; margin: 0; }
.row { display: flex; align-items: center; gap: 12px; }
.between { justify-content: space-between; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.stack { display: flex; flex-direction: column; gap: 8px; }
.stack-lg { display: flex; flex-direction: column; gap: 14px; }

.progress { height: 6px; border-radius: 3px; background: var(--line-soft); margin: 10px 0 6px 0; overflow: hidden; }
.progress > div { height: 6px; background: var(--blue); border-radius: 3px; }

.option { display: flex; align-items: center; gap: 12px; min-height: 68px; border: 0; border-bottom: 1px solid var(--line-soft); background: transparent; width: 100%; text-align: left; padding: 0; color: var(--ink); text-decoration: none; }
.option:last-child { border-bottom: 0; }
.option .ico { width: 40px; height: 40px; border-radius: 12px; background: var(--blue-soft); display: flex; align-items: center; justify-content: center; flex-shrink: 0; color: var(--blue); }
.option .ico.solid { background: var(--blue); color: #FFFFFF; }
.option .ico svg { width: 20px; height: 20px; }
.option .txt { flex-grow: 1; display: flex; flex-direction: column; gap: 2px; }
.option .ttl { font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.option .chev { color: var(--muted); width: 18px; height: 18px; }
.option[disabled] { opacity: 0.55; cursor: default; }

.chip { font-size: 12px; font-weight: 600; color: var(--blue); background: var(--blue-chip); border-radius: 6px; padding: 4px 8px; display: inline-block; }
.chip.grey { color: var(--muted); background: #E9ECF0; }
.chip.solid { color: #FFFFFF; background: var(--blue); }
.chip.white { color: var(--blue); background: #FFFFFF; }
.tag { font-size: 11px; font-weight: 600; border-radius: 6px; padding: 3px 7px; }
.tag.edited { color: var(--amber); background: var(--amber-soft); }
.tag.added { color: var(--green); background: var(--green-soft); }

.section-label { font-size: 13px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.6px; padding: 18px 20px 4px 20px; }
.list { padding: 0 20px; }
.list a { display: flex; align-items: center; justify-content: space-between; min-height: 56px; border-bottom: 1px solid var(--line-soft); text-decoration: none; color: var(--ink); gap: 12px; }
.list .t { font-size: 15px; font-weight: 500; }

label.lbl, .lbl { font-size: 15px; font-weight: 600; }
.field { border: 1px solid var(--field); border-radius: 12px; padding: 12px; font-size: 16px; line-height: 1.5; width: 100%; background: #FFFFFF; resize: vertical; }
input.field { height: 48px; padding: 0 12px; }
.field:focus { border-color: var(--blue); outline: none; box-shadow: 0 0 0 3px #DCE7FA; }

.btn { height: 50px; border-radius: 12px; font-size: 15px; font-weight: 600; border: 1px solid var(--field); background: #FFFFFF; padding: 0 18px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; color: var(--ink); }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #FFFFFF; }
.btn.primary:hover { background: var(--blue-dark); }
.btn.outline { border-color: var(--blue); color: var(--blue); }
.btn.small { height: 40px; font-size: 13px; padding: 0 14px; border-radius: 10px; }
.btn.dashed { border: 1px dashed #B8BEC6; color: var(--blue); font-weight: 500; height: 46px; width: 100%; }
.btn.dashed.grey { color: var(--muted); }
.btn[disabled] { opacity: 0.5; cursor: default; }
.btn svg { width: 18px; height: 18px; }

.footer-actions { display: flex; gap: 12px; padding: 16px 20px calc(20px + env(safe-area-inset-bottom)) 20px; border-top: 1px solid var(--line-soft); position: sticky; bottom: 0; background: #FFFFFF; margin-top: auto; }
.footer-actions .btn { flex: 1; }
.footer-actions .btn.grow2 { flex: 2; }

.scale { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.seg { height: 44px; border: 1px solid var(--field); border-radius: 10px; background: #FFFFFF; font-size: 15px; font-weight: 500; }
.seg[aria-pressed="true"] { background: var(--blue); border-color: var(--blue); color: #FFFFFF; font-weight: 600; }

.linecard { border: 1px solid var(--line); border-radius: 14px; padding: 10px 6px 10px 14px; display: flex; flex-direction: column; gap: 6px; }
.linecard.editing { border: 2px solid var(--blue); padding: 9px 5px 11px 13px; background: #FAFBFC; }
.linecard .who { font-size: 12px; font-weight: 700; color: var(--muted); letter-spacing: 0.4px; text-transform: uppercase; }
.linecard .text { font-size: 16px; line-height: 1.55; padding: 0 8px 4px 0; white-space: pre-wrap; word-break: break-word; }
.linecard .text.empty { color: var(--muted); font-style: italic; }
.linecard .orig { font-size: 14px; line-height: 1.5; color: var(--muted); text-decoration: line-through; padding-right: 8px; white-space: pre-wrap; }
.linecard textarea { margin-right: 8px; width: calc(100% - 8px); }
.linecard .tools { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; padding-right: 8px; }
.toggle { display: inline-flex; background: #F1F3F5; border-radius: 10px; padding: 3px; }
.toggle button { height: 36px; min-width: 64px; border: 0; border-radius: 8px; background: transparent; font-size: 13px; font-weight: 500; color: var(--muted); padding: 0 10px; }
.toggle button[aria-pressed="true"] { background: #FFFFFF; color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08); }

.check { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.check.ok { color: var(--green); }
.check.warn { color: var(--amber); }
.check svg { width: 16px; height: 16px; flex-shrink: 0; }

.checkrow { display: flex; align-items: center; gap: 12px; min-height: 48px; font-size: 15px; }
.checkrow input { width: 22px; height: 22px; accent-color: var(--blue); flex-shrink: 0; }

.flagged { background: var(--amber-soft); border-radius: 10px; padding: 10px 12px; font-size: 14px; line-height: 1.5; color: var(--amber); }
.error { background: #FCEBEA; color: var(--red); border-radius: 10px; padding: 10px 12px; font-size: 14px; line-height: 1.5; }

.login { padding: 48px 24px; display: flex; flex-direction: column; gap: 18px; }
.login h1 { font-size: 28px; margin: 0; }
.pin { letter-spacing: 8px; font-size: 22px; text-align: center; }

.prose { font-size: 15px; line-height: 1.6; }
.prose h2 { font-size: 17px; margin: 18px 0 6px 0; }
.prose ul { padding-left: 20px; margin: 6px 0; }
.prose li { margin: 4px 0; }

#toast { position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--ink); color: #FFFFFF; padding: 12px 18px; border-radius: 12px; font-size: 14px; max-width: calc(100% - 40px); z-index: 20; }
.spinner { padding: 60px 20px; text-align: center; color: var(--muted); }
.saved { font-size: 13px; color: var(--muted); padding-right: 8px; }
