/* Line Media Crew. Neutral greys and white, ink controls, the logo red as the only accent. */
:root {
  --bg: #F1F3F4; --card: #FFFFFF; --ink: #111214; --ink2: #4A4F55; --mute: #7B8087; --line: #DCE0E3; --soft: #E8EBED;
  --red: #DC2626; --red-soft: #FCE9E9; --ok: #17803D; --ok-soft: #E3F4E8; --warn: #B45309; --warn-soft: #FBEFD9;
  --r: 12px; --nav: 64px; --side: 232px;
  --ui: 'Barlow Semi Condensed', -apple-system, 'Segoe UI', sans-serif; --mono: 'IBM Plex Mono', ui-monospace, Menlo, monospace;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 17px/1.4 var(--ui); overscroll-behavior-y: none; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 28px; font-weight: 700; line-height: 1.15; }
h2 { font-size: 13px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--mute); margin: 22px 2px 8px; }
h3 { font-size: 19px; font-weight: 600; }
a { color: inherit; }
svg.i { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.mono { font-family: var(--mono); font-size: .88em; }
.mute { color: var(--mute); }
.small { font-size: 14.5px; }
.red { color: var(--red); }
.right { margin-left: auto; text-align: right; }
.grow { flex: 1; min-width: 0; }
.hide { display: none !important; }

/* Layout: bottom tabs on a phone, sidebar on a desktop. */
.shell { min-height: 100dvh; padding: env(safe-area-inset-top) 0 calc(var(--nav) + env(safe-area-inset-bottom)); }
.page { max-width: 760px; margin: 0 auto; padding: 14px 16px 28px; }
.page.wide { max-width: 1120px; }
.top { display: flex; align-items: center; gap: 10px; min-height: 44px; margin-bottom: 10px; }
.top img { height: 22px; display: block; }
.top .back { display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; margin-left: -10px; border: 0; background: none; color: var(--ink); cursor: pointer; }
nav.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; background: var(--card); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
nav.tabs a { flex: 1; height: var(--nav); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; text-decoration: none; color: var(--mute); font-size: 12.5px; font-weight: 500; position: relative; }
nav.tabs a.on { color: var(--ink); font-weight: 600; }
nav.tabs a.on::before { content: ''; position: absolute; top: 0; width: 28px; height: 3px; border-radius: 0 0 3px 3px; background: var(--red); }
nav.tabs .brand { display: none; }
.dot { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--red); color: #fff; font: 600 11.5px/18px var(--mono); text-align: center; }
nav.tabs .dot { position: absolute; top: 8px; left: calc(50% + 6px); }
@media (min-width: 900px) {
  .shell { padding: 0 0 0 var(--side); }
  nav.tabs { top: 0; right: auto; width: var(--side); flex-direction: column; border-top: 0; border-right: 1px solid var(--line); padding: 22px 12px; gap: 2px; }
  nav.tabs .brand { display: block; padding: 0 10px 22px; }
  nav.tabs .brand img { height: 26px; display: block; }
  nav.tabs a { flex: none; height: 44px; flex-direction: row; justify-content: flex-start; gap: 12px; padding: 0 10px; border-radius: 9px; font-size: 16.5px; }
  nav.tabs a.on { background: var(--soft); }
  nav.tabs a.on::before { display: none; }
  nav.tabs .dot { position: static; margin-left: auto; }
  .page { padding: 26px 28px 40px; }
  .top img { display: none; }
}

/* Cards and lists */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; margin-bottom: 10px; }
.card.flush { padding: 0; overflow: hidden; }
.card.alert { border-color: var(--red); background: var(--red-soft); }
.card.note { background: var(--soft); border-color: var(--soft); }
.item { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 9px 16px; border-top: 1px solid var(--line); text-decoration: none; color: inherit; background: none; border-left: 0; border-right: 0; border-bottom: 0; width: 100%; text-align: left; font: inherit; cursor: pointer; }
.item:first-child { border-top: 0; }
.item > svg.i { color: var(--mute); }
.item .t { font-weight: 500; overflow-wrap: anywhere; }
.item .s { font-size: 14.5px; color: var(--mute); overflow-wrap: anywhere; }
.kv { margin: 0; display: grid; grid-template-columns: minmax(96px, 30%) 1fr; gap: 6px 14px; align-items: baseline; }
.kv dt { color: var(--mute); font-size: 14.5px; }
.kv dd { margin: 0; overflow-wrap: anywhere; white-space: pre-line; }
.tag { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 6px; background: var(--soft); color: var(--ink2); font-size: 13px; font-weight: 600; letter-spacing: .02em; white-space: nowrap; }
.tag.ok { background: var(--ok-soft); color: var(--ok); }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.tag.bad { background: var(--red-soft); color: var(--red); }
.tag.ink { background: var(--ink); color: #fff; }
.apps { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.app { display: flex; align-items: center; gap: 10px; min-height: 64px; padding: 10px 14px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); text-decoration: none; }
.app b { display: block; font-weight: 600; line-height: 1.2; }
.app span { display: block; font-size: 13.5px; color: var(--mute); line-height: 1.2; }
.app svg.i { color: var(--mute); width: 18px; height: 18px; margin-left: auto; }
.chips { display: flex; gap: 8px; overflow-x: auto; margin: 0 -16px 12px; padding: 0 16px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 14px; border-radius: 19px; border: 1px solid var(--line); background: var(--card); color: var(--ink2); font: 500 15.5px var(--ui); white-space: nowrap; cursor: pointer; text-decoration: none; }
.chip.on, .chip:has(input:checked) { background: var(--ink); border-color: var(--ink); color: #fff; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.picks { display: flex; flex-wrap: wrap; gap: 8px; }
.bar { height: 8px; border-radius: 4px; background: var(--soft); overflow: hidden; margin: 10px 0 6px; }
.bar i { display: block; height: 100%; background: var(--ink); border-radius: 4px; }
.bar.over i { background: var(--red); }
.big { font: 600 30px/1.1 var(--mono); letter-spacing: -.02em; }
.split { display: flex; gap: 18px; flex-wrap: wrap; }
.split > div { min-width: 96px; }
.split .l { font-size: 13.5px; color: var(--mute); }
.split .v { font: 500 17px var(--mono); }
.day { display: grid; grid-template-columns: 96px auto 1fr; gap: 4px 10px; align-items: baseline; padding: 10px 16px; border-top: 1px solid var(--line); }
.day:first-child { border-top: 0; }
.day.today { background: var(--soft); }
.day .tag { justify-self: start; }
.day .mono { white-space: nowrap; text-align: right; }
.day .n { grid-column: 1 / -1; font-size: 14.5px; color: var(--ink2); }
.check { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 6px 16px; border-top: 1px solid var(--line); cursor: pointer; }
.check input { width: 22px; height: 22px; accent-color: var(--ink); flex: none; }
.check:has(input:checked) span { color: var(--mute); text-decoration: line-through; }
.thumb { width: 44px; height: 56px; border-radius: 6px; object-fit: cover; background: var(--soft); border: 1px solid var(--line); flex: none; display: flex; align-items: center; justify-content: center; font: 600 11px var(--mono); color: var(--mute); }
.photo { display: block; width: 100%; max-height: 62vh; object-fit: contain; background: var(--soft); border-radius: var(--r); border: 1px solid var(--line); }
.empty { padding: 26px 16px; text-align: center; color: var(--mute); }

/* Controls */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 46px; padding: 0 18px; border-radius: 10px; border: 1px solid var(--ink); background: var(--ink); color: #fff; font: 600 16.5px var(--ui); text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn.ghost { background: var(--card); color: var(--ink); border-color: var(--line); }
.btn.danger { background: var(--card); color: var(--red); border-color: var(--line); }
.btn.accent { background: var(--red); border-color: var(--red); }
.btn.sm { height: 36px; padding: 0 12px; font-size: 15px; border-radius: 8px; }
.btn.block { display: flex; width: 100%; }
.btn:disabled { opacity: .45; }
.btns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
label.f { display: block; margin-bottom: 12px; }
label.f > span { display: block; font-size: 14px; font-weight: 500; color: var(--ink2); margin-bottom: 4px; }
input, select, textarea { width: 100%; min-height: 44px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px; background: #fff; color: var(--ink); font: 400 16.5px var(--ui); }
/* iOS gives date and time fields their own width and centred text: bring them back in line. */
input[type=date], input[type=time] { -webkit-appearance: none; appearance: none; min-width: 0; height: 44px; text-align: left; }
input::-webkit-date-and-time-value { text-align: left; }
select { height: 44px; }
.cols > *, .rows .row label { min-width: 0; }
textarea { min-height: 84px; resize: vertical; line-height: 1.35; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--ink); outline-offset: -1px; }
input[type=checkbox] { width: auto; min-height: 0; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0 12px; }
.rows .row { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: flex-end; padding: 10px 0; border-top: 1px solid var(--line); }
.rows .row:first-child { border-top: 0; padding-top: 0; }
.rows .row label { flex: 1 1 120px; min-width: 0; }
.rows .row label span { display: block; font-size: 12.5px; color: var(--mute); }
.rows .row input, .rows .row select, .rows .row textarea { min-height: 40px; height: 40px; padding: 7px 9px; font-size: 15.5px; }
.rows .row textarea { min-height: 40px; height: 40px; }
.rows .del { width: 40px; height: 40px; border: 0; background: none; color: var(--mute); cursor: pointer; display: flex; align-items: center; justify-content: center; flex: none; }
table.t { width: 100%; border-collapse: collapse; font-size: 15.5px; }
table.t th { text-align: left; font-size: 12.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--mute); padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.t td { padding: 10px 12px; border-top: 1px solid var(--line); vertical-align: middle; }
table.t td.num, table.t th.num { text-align: right; font-family: var(--mono); font-size: 14px; white-space: nowrap; }
table.t tr:first-child td { border-top: 0; }
.scroll { overflow-x: auto; }
.seg { display: inline-flex; padding: 3px; background: var(--soft); border-radius: 10px; margin-bottom: 14px; max-width: 100%; overflow-x: auto; }
.seg a { height: 36px; padding: 0 14px; display: flex; align-items: center; border-radius: 8px; text-decoration: none; color: var(--ink2); font-weight: 500; white-space: nowrap; }
.seg a.on { background: var(--card); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(0, 0, 0, .12); }

/* Sign-in */
.auth { min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: calc(24px + env(safe-area-inset-top)) 24px calc(24px + env(safe-area-inset-bottom)); }
.auth .box { width: 100%; max-width: 380px; }
.auth img { height: 34px; display: block; margin: 0 auto 26px; }
.auth h1 { text-align: center; margin-bottom: 6px; }
.auth p { text-align: center; color: var(--mute); margin-bottom: 20px; }
.pin { font: 600 24px var(--mono); letter-spacing: .4em; text-align: center; }
.lang { display: flex; justify-content: center; gap: 6px; margin-top: 18px; }

#toast { position: fixed; left: 50%; bottom: calc(var(--nav) + 18px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); max-width: min(92vw, 460px); padding: 11px 16px; border-radius: 10px; background: var(--ink); color: #fff; font-weight: 500; opacity: 0; pointer-events: none; transition: .2s; z-index: 50; }
#toast.on { opacity: 1; transform: translate(-50%, 0); }
#toast.err { background: var(--red); }
.offline { position: sticky; top: 0; z-index: 10; margin: -14px -16px 12px; padding: 7px 16px; background: var(--ink); color: #fff; font-size: 14.5px; text-align: center; }
