* { box-sizing: border-box; }
/* Light by default; dark follows the device unless the user chose in the top bar (data-theme on <html>) */
:root { color-scheme: light; --g: #1f5c46; --g2: #e6f0eb; --bg: #f4f3ee; --card: #fff; --fg: #222; --muted: #555; --line: #ddd; --line2: #bbb; --chip: #e4e2d8; --gtxt: #14402f; --gline: #b9d6c8;
  --warn: #8a3d05; --warnbg: #fdeede; --warnline: #f0cba5; --amberbg: #fdebc8; --ambertx: #7a4a00; --redbg: #f8d7d2; --redtx: #8e271c; --redline: #e0b4ae; --yelbg: #fff4cc; --yeltx: #6b5200; --yelline: #ecd98a; }
:root[data-theme="dark"] { color-scheme: dark; --g: #2a7a5c; --g2: #1d3a2f; --bg: #121614; --card: #1c211f; --fg: #e8e8e3; --muted: #a9aea9; --line: #343a37; --line2: #4a514d; --chip: #2c3330; --gtxt: #bfe3d1; --gline: #2f5a47;
  --warn: #f0b27a; --warnbg: #3a2616; --warnline: #6b4424; --amberbg: #3d2f12; --ambertx: #f0cf8a; --redbg: #3f1f1b; --redtx: #f2aaa2; --redline: #6b3a34; --yelbg: #3a3312; --yeltx: #ecd98a; --yelline: #5c5120; }
.themebtn_unused { min-height: 36px; padding: 4px 10px; background: var(--chip); color: var(--fg); font-size: 1rem; }
body { margin: 0; font-family: Helvetica, Arial, sans-serif; background: var(--bg); color: var(--fg); font-size: 16px; }
.topbar { display: flex; align-items: center; gap: 10px; padding: 8px 14px; background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.brandlogo { height: 36px; width: auto; display: block; }
.brandtitle { font-weight: 700; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.langsel { width: auto; max-width: 45%; flex: 0 0 auto; font: inherit; font-size: .9rem; padding: 6px; border: 1px solid var(--line2); border-radius: 8px; background: var(--card); }
main { max-width: 720px; margin: 0 auto; padding: 14px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin-bottom: 14px; }
label { display: block; font-size: .85rem; color: var(--muted); margin: 10px 0 4px; }
input, textarea, select { width: 100%; font: inherit; padding: 11px; border: 1px solid var(--line2); border-radius: 10px; background: var(--card); }
textarea { min-height: 4.5rem; }
button, a.btn { font: inherit; min-height: 44px; padding: 10px 16px; border-radius: 10px; border: 0; background: var(--g); color: #fff; font-weight: 600; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
button.sec, a.btn.sec { background: var(--chip); color: var(--fg); }
button:disabled { opacity: .5; cursor: default; }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row > div { flex: 1 1 170px; }
.hint { font-size: .8rem; color: var(--muted); margin-top: 6px; }
.banner { padding: 12px; border-radius: 10px; margin: 10px 0; font-size: .95rem; background: var(--card); border: 1px solid var(--line); }
.banner.err { background: var(--warnbg); color: var(--warn); border-color: var(--warnline); }
.banner.good { background: var(--g2); color: var(--gtxt); border-color: var(--gline); }
.banner.warn { background: var(--yelbg); color: var(--yeltx); border-color: var(--yelline); }
.hidden { display: none !important; }

/* Application shell */
.brandtitle { color: inherit; text-decoration: none; flex: 0 1 auto; }
.who2 { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; justify-content: flex-end; font-size: .9rem; color: var(--muted); overflow: hidden; }
.who2 span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who2 img { height: 24px; width: auto; border-radius: 4px; }
.optwrap { position: relative; flex: 0 0 auto; margin-left: auto; }
.who2:not(:empty) + .optwrap { margin-left: 0; }
.optbtn { min-height: 40px; min-width: 44px; padding: 4px 12px; background: var(--chip); color: var(--fg); font-size: 1.15rem; }
.panel { position: absolute; right: 0; top: calc(100% + 6px); width: min(300px, calc(100vw - 28px)); background: var(--card); border: 1px solid var(--line2); border-radius: 12px; padding: 12px 14px 14px; box-shadow: 0 6px 24px rgba(0,0,0,.28); z-index: 30; }
.panel .pl { font-size: .78rem; color: var(--muted); } .panel .pv { font-weight: 700; margin-bottom: 4px; }
.panel .langsel { max-width: none; width: 100%; }
.seg { display: flex; gap: 6px; } .segb { flex: 1; min-height: 40px; padding: 6px 4px; font-size: .85rem; background: var(--chip); color: var(--fg); }
.segb.on { background: var(--g); color: #fff; }
.signout { width: 100%; margin-top: 14px; background: var(--redbg); color: var(--redtx); border: 1px solid var(--redline); }
.crumb { display: flex; align-items: center; gap: 8px; padding: 10px 14px; max-width: 720px; margin: 0 auto; }
.crumb strong { font-size: 1.15rem; } .crumb .sep { color: var(--muted); }
.crumbhome { min-height: 36px; display: inline-flex; align-items: center; padding: 0 12px; border-radius: 18px; background: var(--chip); color: var(--fg); text-decoration: none; font-weight: 600; }
@media print { .crumb, .topbar { display: none !important; } }
.panel .ver { margin-top: 10px; text-align: right; }
