:root {
  --bg: #121418;
  --surface: #1B1F26;
  --surface-2: #242933;
  --surface-3: #2A303B;
  --line: #262B34;
  --line-2: #363D49;
  --text: #ECEDEF;
  --text-2: #C9CDD4;
  --muted: #9AA1AD;
  --accent: #FF8A3D;
  --on-accent: #121418;
  --teal: #2EC4B6;
  --teal-bg: #15252A;
  --teal-line: #1E4448;
  --warn-bg: #2A181C;
  --warn-line: #6B2B35;
  --warn-text: #FFC9CF;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: Manrope, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }
a:hover { color: #FFB07A; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.app { max-width: 560px; margin: 0 auto; height: 100%; display: flex; flex-direction: column; }

/* fejléc */
.top { padding: 22px 20px 12px; display: flex; flex-direction: column; gap: 8px; }
.top-meta { display: flex; align-items: center; gap: 8px; font-family: var(--mono); font-size: 12px; font-weight: 500; color: var(--muted); letter-spacing: .06em; }
.rec { width: 8px; height: 8px; border-radius: 4px; background: #FF4D4D; flex-shrink: 0; }
.top-meta .grow { flex: 1; }
.ai-ok { color: var(--teal); font-weight: 700; }
.top h1 { margin: 0; font-size: 28px; font-weight: 800; letter-spacing: -.02em; }
.progress { display: flex; align-items: center; gap: 12px; margin-top: 4px; }
.track { position: relative; flex: 1; height: 8px; border-radius: 2px; background: var(--line); }
.track .fill { height: 8px; border-radius: 2px; background: var(--teal); }
.track .head { position: absolute; top: -4px; width: 2px; height: 16px; margin-left: -1px; background: var(--accent); }
.mono-sm { font-family: var(--mono); font-size: 12px; font-weight: 700; color: var(--text-2); }

/* tartalom */
main { flex: 1; overflow-y: auto; padding: 4px 16px 20px; display: flex; flex-direction: column; gap: 18px; -webkit-overflow-scrolling: touch; }
section { display: flex; flex-direction: column; gap: 8px; }
.label { margin: 0 4px; font-family: var(--mono); font-size: 12px; font-weight: 700; color: var(--muted); letter-spacing: .1em; text-transform: uppercase; }
.title-lg { margin: 4px 4px 0; font-size: 17px; font-weight: 800; }
.card { background: var(--surface); border-radius: 14px; }
.pad { padding: 14px; }
.list { background: var(--surface); border-radius: 14px; display: flex; flex-direction: column; overflow: hidden; }
.row { display: flex; align-items: center; gap: 4px; padding: 4px 10px 4px 4px; min-height: 56px; border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: 0; }
.chk { width: 44px; height: 44px; flex-shrink: 0; border: 0; background: transparent; padding: 0; display: flex; align-items: center; justify-content: center; }
.chk .box { width: 22px; height: 22px; border-radius: 11px; border: 2px solid #5F6673; display: flex; align-items: center; justify-content: center; }
.chk.sq .box { border-radius: 6px; }
.chk .box svg { opacity: 0; }
.chk.on .box { background: var(--accent); border-color: var(--accent); }
.chk.on .box svg { opacity: 1; }
.open { flex: 1; min-width: 0; min-height: 48px; border: 0; background: transparent; padding: 4px 0; text-align: left; display: flex; align-items: center; gap: 8px; }
.bar { width: 4px; align-self: stretch; margin: 4px 0; border-radius: 2px; flex-shrink: 0; }
.txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.t1 { font-size: 15px; font-weight: 600; overflow-wrap: anywhere; }
.t1.done { color: var(--muted); text-decoration: line-through; }
.t2 { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 12px; font-weight: 500; color: var(--muted); }
.steps-n { font-family: var(--mono); font-weight: 700; color: var(--teal); }
.chip { flex-shrink: 0; font-family: var(--mono); font-size: 11px; font-weight: 700; color: var(--text-2); background: var(--surface-2); border-radius: 6px; padding: 5px 8px; text-transform: uppercase; }
.chip.late { color: var(--warn-text); background: var(--warn-bg); }
.chev { flex-shrink: 0; color: #5F6673; }
.empty { margin: 0 4px; font-size: 14px; line-height: 1.5; color: var(--muted); }

/* asszisztens kártyák */
.ai-card { background: var(--teal-bg); border: 1px solid var(--teal-line); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.ai-tag { display: flex; align-items: center; gap: 6px; font-family: var(--mono); font-size: 11px; font-weight: 700; color: var(--teal); letter-spacing: .1em; }
.ai-card p { margin: 0; font-size: 14px; line-height: 1.5; color: #DDE3E6; }
.prop { display: flex; align-items: center; gap: 10px; background: var(--surface); border-radius: 10px; padding: 10px 6px 10px 12px; }
.kind { font-family: var(--mono); font-size: 10px; font-weight: 700; letter-spacing: .1em; }
.warn-t { color: var(--warn-text); font-weight: 700; }

/* gombok */
.btns { display: flex; flex-wrap: wrap; gap: 8px; }
.btn { white-space: nowrap; min-height: 44px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--line-2); background: transparent; font-weight: 700; font-size: 14px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; color: var(--text); }
.btn.primary { border: 0; background: var(--accent); color: var(--on-accent); font-weight: 800; }
.btn.teal { border-color: var(--teal-line); color: var(--teal); background: transparent; }
.btn.ghost { border: 0; color: var(--teal); }
.btn.dashed { border-style: dashed; border-color: #4A5260; }
.btn.danger { border-color: var(--warn-line); color: var(--warn-text); }
.btn:disabled { opacity: .5; }
.icon-btn { width: 44px; height: 44px; flex-shrink: 0; border: 0; border-radius: 10px; background: transparent; color: var(--muted); display: flex; align-items: center; justify-content: center; }
.icon-btn:hover { color: var(--text); }
.back { align-self: flex-start; min-height: 44px; padding: 0 12px 0 6px; border: 0; background: transparent; display: flex; align-items: center; gap: 4px; font-weight: 700; font-size: 14px; color: var(--accent); }

/* űrlapok */
.field { display: flex; flex-direction: column; gap: 4px; }
.field > span { font-size: 12px; font-weight: 600; color: var(--muted); }
.inp { height: 44px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--surface-2); padding: 0 12px; font-size: 15px; color: var(--text); min-width: 0; width: 100%; }
.inp.time { font-family: var(--mono); }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.pick { min-height: 44px; padding: 0 12px; border-radius: 10px; border: 2px solid var(--line-2); background: transparent; display: inline-flex; align-items: center; gap: 8px; font-weight: 700; font-size: 14px; }
.pick.mono { font-family: var(--mono); font-size: 12px; justify-content: center; }
.pick[aria-pressed="true"] { background: var(--surface-2); border-color: var(--accent); }
.sw { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }

/* részletek */
.detail-head { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.detail-head h2 { margin: 0; font-size: 21px; font-weight: 800; letter-spacing: -.01em; line-height: 1.2; overflow-wrap: anywhere; }
.step { display: flex; align-items: center; gap: 4px; min-height: 52px; padding: 0 4px 0 4px; border-bottom: 1px solid var(--line); }
.step:last-child { border-bottom: 0; }
.step .num { font-family: var(--mono); font-size: 12px; font-weight: 700; color: var(--muted); width: 24px; flex-shrink: 0; }
.mail { background: var(--surface); border-radius: 10px; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.mail .body { font-size: 14px; line-height: 1.5; color: #DDE3E6; white-space: pre-line; user-select: text; }
.pre { white-space: pre-line; user-select: text; }

/* naptár */
.seg { display: flex; gap: 4px; padding: 4px; background: var(--surface); border-radius: 12px; }
.seg button { flex: 1; min-height: 40px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font-weight: 700; font-size: 14px; }
.seg button[aria-pressed="true"] { background: var(--surface-3); color: var(--text); }
.navrow { display: flex; align-items: center; gap: 4px; }
.navrow .grow { flex: 1; margin: 0 4px; display: flex; flex-direction: column; gap: 2px; }
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.wday { min-height: 74px; padding: 6px 0; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; }
.wday .d { font-family: var(--mono); font-size: 10px; font-weight: 700; letter-spacing: .06em; }
.wday .n { font-size: 17px; font-weight: 800; }
.hl { font-family: var(--mono); font-size: 9px; font-weight: 700; color: var(--text-2); min-height: 11px; }
.dbar { width: 72%; height: 4px; border-radius: 2px; }
.wday.today, .mday.today { border-color: var(--teal); }
.wday.sel, .mday.sel { border-color: var(--accent); background: var(--surface-3); }
.mhead { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; font-family: var(--mono); font-size: 10px; font-weight: 700; color: var(--muted); text-align: center; }
.month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.mday { min-height: 56px; padding: 4px 0 5px; border: 1px solid transparent; border-radius: 9px; background: var(--surface); display: flex; flex-direction: column; align-items: center; justify-content: space-between; }
.mday.out { opacity: .35; }
.mday .n { display: flex; align-items: center; gap: 3px; font-size: 13px; font-weight: 800; }
.mday.today .n { color: var(--teal); }
.edot { width: 4px; height: 4px; border-radius: 2px; background: #FFB07A; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 12px; padding: 0 4px; font-size: 11px; font-weight: 600; color: var(--muted); }
.legend span { display: flex; align-items: center; gap: 5px; }
.legend i { width: 12px; height: 4px; border-radius: 2px; display: inline-block; }
.stat-big { font-family: var(--mono); font-size: 34px; font-weight: 700; letter-spacing: -.02em; }
.stat-row { display: flex; align-items: center; gap: 10px; }
.stat-row .nm { width: 78px; flex-shrink: 0; font-size: 13px; font-weight: 600; }
.stat-row .tr { flex: 1; height: 8px; border-radius: 2px; background: var(--line); overflow: hidden; }
.stat-row .tr i { display: block; height: 8px; }
.stat-row .v { width: 66px; flex-shrink: 0; text-align: right; font-family: var(--mono); font-size: 12px; font-weight: 700; color: var(--text-2); }
.shift { display: flex; gap: 12px; align-items: center; padding: 12px 6px 12px 14px; border-left: 4px solid; }
.shift .hrs { font-family: var(--mono); font-size: 18px; font-weight: 700; }
.warn { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; background: var(--warn-bg); border: 1px solid var(--warn-line); border-radius: 14px; font-size: 14px; line-height: 1.45; color: var(--warn-text); }
.free { display: flex; flex-wrap: wrap; gap: 6px; }
.free span { font-family: var(--mono); font-size: 12px; font-weight: 700; color: var(--teal); background: var(--teal-bg); border: 1px solid var(--teal-line); border-radius: 8px; padding: 6px 9px; }
.ev { display: flex; gap: 12px; padding: 12px 6px 12px 14px; }
.ev .tm { display: flex; flex-direction: column; gap: 2px; width: 44px; flex-shrink: 0; font-family: var(--mono); }
.ev .tm b { font-size: 13px; }
.ev .tm small { font-size: 11px; color: var(--muted); }
.meta-l { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-2); }

/* projektek, lista */
.pgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.pcard { background: var(--surface); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 8px; min-height: 112px; border: 0; border-top: 3px solid; text-align: left; }
.pcard .nm { font-size: 15px; font-weight: 700; line-height: 1.2; }
.pcard .cnt { font-family: var(--mono); font-size: 11px; font-weight: 700; color: var(--muted); }
.pcard .nx { font-size: 12px; color: var(--text-2); line-height: 1.35; }
.footer { margin-top: 8px; padding: 0 4px; font-size: 12px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; }

/* beviteli sáv és navigáció */
.capture { background: var(--surface); border-top: 1px solid var(--line); padding: 10px 16px 8px; display: flex; flex-direction: column; gap: 6px; }
.capture form { display: flex; gap: 8px; margin: 0; }
.capture .hint { font-family: var(--mono); font-size: 11px; color: var(--muted); }
.tabs { background: var(--surface); border-top: 1px solid var(--line); display: flex; padding: 2px 4px calc(8px + var(--safe-b)); }
.tabs button { flex: 1; min-height: 56px; border: 0; background: transparent; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font-size: 11px; font-weight: 700; color: var(--muted); }
.tabs button[aria-current="page"] { color: var(--accent); }

.toast { position: fixed; left: 50%; bottom: calc(150px + var(--safe-b)); transform: translateX(-50%); background: #2F3540; color: var(--text); padding: 10px 16px; border-radius: 10px; font-size: 14px; font-weight: 600; box-shadow: 0 6px 24px rgba(0,0,0,.4); z-index: 50; max-width: calc(100% - 32px); }
.toast.err { background: var(--warn-bg); color: var(--warn-text); border: 1px solid var(--warn-line); }

/* belépés */
.login { min-height: 100%; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.login form { width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: 14px; }
.login h1 { margin: 0 0 4px; font-size: 30px; font-weight: 800; letter-spacing: -.02em; }
.login .err { padding: 10px 12px; border-radius: 10px; background: var(--warn-bg); border: 1px solid var(--warn-line); color: var(--warn-text); font-size: 14px; }

/* ---------------------------------------------------------------- oszlopok (mobilon egymás alatt) */
.cols, .col-a, .col-b, .narrow { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.brand, .dk, .kbd-hint { display: none; }
.mday .dbar { width: 76%; }

@media (hover: hover) {
  .row:hover, .step:hover { background: rgba(255,255,255,.025); }
  .open:hover .t1 { color: #fff; }
  .pcard:hover { background: #20252D; }
  .wday:hover, .mday:hover { border-color: var(--line-2); }
  .btn:hover { border-color: #4A5260; }
  .btn.primary:hover { background: #FF9B57; }
}

/* ---------------------------------------------------------------- asztali nézet */
@media (min-width: 1000px) {
  html, body { height: 100%; }
  .app {
    max-width: none;
    display: grid;
    grid-template-columns: 236px minmax(0, 1fr);
    grid-template-rows: auto auto minmax(0, 1fr);
    grid-template-areas: "nav top" "nav cap" "nav main";
  }

  /* bal oldali menü */
  .tabs {
    grid-area: nav;
    flex-direction: column; justify-content: flex-start; gap: 4px;
    padding: 26px 14px 20px;
    border-top: 0; border-right: 1px solid var(--line);
    overflow-y: auto;
  }
  .brand { display: flex; align-items: center; gap: 10px; padding: 4px 14px 22px; font-family: var(--mono); font-size: 15px; font-weight: 700; letter-spacing: .18em; color: var(--text); }
  .tabs button { flex: 0 0 auto; flex-direction: row; justify-content: flex-start; gap: 14px; min-height: 48px; padding: 0 14px; border-radius: 10px; font-size: 15px; }
  .tabs button:hover { color: var(--text); background: rgba(255,255,255,.03); }
  .tabs button[aria-current="page"] { background: var(--surface-2); }

  /* fejléc */
  .top { grid-area: top; padding: 28px 44px 10px; flex-direction: row; flex-wrap: wrap; align-items: flex-end; column-gap: 32px; }
  .top-meta { order: -1; width: 100%; }
  .top h1 { font-size: 32px; }
  .top .progress { flex: 1; max-width: 460px; margin: 0 0 6px auto; }

  /* beviteli sáv felül */
  .capture { grid-area: cap; background: transparent; border: 0; padding: 8px 44px 14px; }
  .capture form, .capture .hint { max-width: 1240px; }
  .capture .inp { height: 50px; font-size: 16px; background: var(--surface); }
  .capture .btn { height: 50px; min-width: 120px; }
  .kbd-hint { display: inline; }
  .kbd { font-family: var(--mono); font-size: 11px; padding: 1px 6px; border-radius: 5px; border: 1px solid var(--line-2); color: var(--text-2); }

  /* tartalom */
  main { grid-area: main; padding: 10px 44px 48px; }
  main > * { width: 100%; max-width: 1240px; }
  .cols { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 28px; align-items: start; }
  .cols.cal { grid-template-columns: minmax(0, 1.65fr) minmax(340px, 1fr); }
  .col-b { position: sticky; top: 0; }
  .narrow { max-width: 780px; }
  .pgrid { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }

  /* naptár */
  .seg { max-width: 320px; }
  .week { gap: 8px; }
  .wday { min-height: 150px; padding: 10px 8px; align-items: stretch; justify-content: flex-start; gap: 4px; text-align: left; }
  .wday .d { font-size: 11px; color: var(--muted); }
  .wday .n { font-size: 22px; line-height: 1.1; }
  .wday .hl { font-size: 11px; }
  .wday .dbar, .mday .dbar { width: 100%; margin-top: auto; }
  .wday .edot { display: none; }
  .month { gap: 6px; }
  .mhead { gap: 6px; font-size: 11px; }
  .mday { min-height: 112px; padding: 8px; align-items: stretch; justify-content: flex-start; gap: 4px; text-align: left; border-color: var(--line); }
  .mday .n { font-size: 15px; }
  .mday .hl { font-size: 11px; text-align: left; }
  .dk { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
  .mtag { display: block; font-size: 11px; font-weight: 700; color: var(--text); background: var(--surface-2); border-left: 3px solid; border-radius: 4px; padding: 2px 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .mtag.rest { border-color: #5F6673; color: var(--muted); }
  .mev { display: block; font-size: 11px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .mev.more { color: var(--muted); }
  .legend { font-size: 12px; }

  .toast { left: auto; right: 32px; bottom: 32px; transform: none; }
}

@media (min-width: 1500px) {
  .cols { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); }
  main > *, .capture form, .capture .hint { max-width: 1400px; }
}
