:root {
  --bg: #f4f6f9; --fg: #1b2430; --muted: #66707d; --card: #fff; --line: #dde3ea;
  --pri: #123a5c; --pri2: #1d5b8f; --ok: #1f7a4a; --warn: #a86400; --err: #b3261e;
  --them: #eef4fb; --agent: #f1f8f2; --user: #fff7e6; --sys: #f3f3f3;
  --r: 10px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--fg); }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; }
button {
  border: 1px solid var(--line); background: #fff; color: var(--fg); border-radius: 8px;
  padding: .5em .9em; cursor: pointer; min-height: 40px;
}
button:hover:not(:disabled) { border-color: var(--pri2); }
button:disabled { opacity: .45; cursor: default; }
button.primary { background: var(--pri); color: #fff; border-color: var(--pri); }
button.danger { background: #fff; color: var(--err); border-color: #e6b8b4; }
button.ghost { background: transparent; color: #dbe7f2; border-color: transparent; }
button.small { min-height: 32px; padding: .3em .7em; font-size: .9em; }
button.big { font-size: 1.1em; padding: .6em 1.2em; min-height: 48px; }
input, select, textarea {
  width: 100%; padding: .5em .6em; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--fg);
}
textarea { resize: vertical; }
label { display: block; margin: .5em 0; font-weight: 500; }
label > input, label > select, label > textarea { margin-top: .25em; font-weight: 400; }
label.check { display: flex; gap: .5em; align-items: flex-start; font-weight: 400; }
label.check input { width: auto; margin-top: .25em; }
fieldset { border: 1px solid var(--line); border-radius: var(--r); margin: .8em 0; padding: .4em .9em .8em; }
fieldset.sensitive { border-color: #e8c98a; background: #fffcf4; }
legend { font-weight: 600; padding: 0 .3em; }
h2 { margin: .3em 0 .6em; font-size: 1.35em; }
h3 { margin: 1em 0 .4em; font-size: 1.05em; }
.muted { color: var(--muted); font-size: .92em; font-weight: 400; }
.err { color: var(--err); }

.top {
  display: flex; align-items: center; justify-content: space-between; gap: 1em; flex-wrap: wrap;
  background: var(--pri); color: #fff; padding: .5em 1em; padding-top: max(.5em, env(safe-area-inset-top));
  position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: center; gap: .5em; font-weight: 700; font-size: 1.1em; }
.brand img { width: 30px; height: 30px; border-radius: 7px; }
.top nav { display: flex; gap: .3em; flex-wrap: wrap; }
.top nav button { background: rgba(255,255,255,.1); color: #fff; border-color: transparent; min-height: 36px; }
.top nav button.active { background: rgba(255,255,255,.25); }

main { padding: 1em; max-width: 1400px; margin: 0 auto; }
.view.narrow { max-width: 420px; margin: 2em auto; }
.view { max-width: 920px; margin: 0 auto; }
.view.wide { max-width: 1400px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 1em; margin: .8em 0; }
.row { display: flex; align-items: center; }
.row.between { justify-content: space-between; flex-wrap: wrap; gap: .6em; }
.row.gap { gap: .5em; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1em; }
.banner { padding: .7em 1em; border-radius: var(--r); margin: .6em 0; }
.banner.warn { background: #fff4e0; border: 1px solid #f0cf8f; color: #6b4300; }
.banner.ok { background: #e7f6ec; border: 1px solid #a9dbb9; color: #14532d; }
.banner.err { background: #fdecea; border: 1px solid #f1b6b0; color: #7a1c15; }
#compat { margin: .6em 1em; }

/* kart listesi */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: .8em; }
.task { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: .9em; display: flex; flex-direction: column; gap: .35em; }
.task h3 { margin: 0; font-size: 1.05em; }
.task .meta { color: var(--muted); font-size: .9em; }
.task .actions { display: flex; gap: .4em; margin-top: auto; padding-top: .5em; }
.task .actions button.primary { flex: 1; }
.badge { display: inline-block; font-size: .78em; padding: .1em .5em; border-radius: 99px; background: #e8eef5; color: var(--pri); }
.badge.warn { background: #fff1d6; color: #7a4b00; }
.badge.in { background: #e3f1ff; color: #0b4f8a; }
.badge.rehearsal { background: #f3e8ff; color: #5b2a86; }
.badge.consult { background: #e2f5ea; color: #1f6b43; }

/* düzenleme */
.kv .kvrow { display: grid; grid-template-columns: 1fr 1.4fr auto; gap: .4em; margin: .35em 0; align-items: center; }
.kv .kvrow.sens { grid-template-columns: 1fr 1.2fr auto auto; }
.kv .kvrow .chk { display: flex; gap: .3em; align-items: center; font-size: .85em; white-space: nowrap; font-weight: 400; margin: 0; }
.kv .kvrow .chk input { width: auto; }
.sticky-actions { position: sticky; bottom: 0; background: #fff; padding: .6em 0; border-top: 1px solid var(--line); margin-top: 1em; }
.note { background: #f0f5fa; border-left: 4px solid var(--pri2); padding: .6em .8em; border-radius: 6px; margin: .6em 0; font-size: .93em; }

/* görüşme */
.call-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1em; flex-wrap: wrap; }
.call-head h2 { margin-bottom: .3em; }
.pills { display: flex; gap: .4em; flex-wrap: wrap; }
.pill { font-size: .85em; padding: .2em .65em; border-radius: 99px; background: #e8eef5; color: var(--pri); }
.pill.on { background: #d9f2e1; color: var(--ok); }
.pill.busy { background: #fff1d6; color: #7a4b00; }
.pill.alert { background: var(--err); color: #fff; }
.pill.practice { background: #6b3fa0; color: #fff; font-weight: 700; letter-spacing: .04em; }
.pill.consult { background: #1f7a4a; color: #fff; font-weight: 600; }
.pill:empty { display: none; }
.controls { display: flex; gap: .4em; flex-wrap: wrap; }
.controls .mode.active { background: var(--pri2); color: #fff; border-color: var(--pri2); }
.prep { border-color: #c7d6e6; }
.question {
  background: #fff3cd; border: 3px solid #e0a800; border-radius: var(--r); padding: 1em; margin: .8em 0;
  position: sticky; top: 64px; z-index: 10; box-shadow: 0 4px 14px rgba(0,0,0,.12);
}
.q-label { font-weight: 600; color: #7a4b00; }
.q-text { font-size: 1.3em; font-weight: 700; margin: .3em 0 .7em; }
.call-body { display: grid; grid-template-columns: 1fr 320px; gap: 1em; align-items: start; }
.transcript-wrap { background: #fff; border: 1px solid var(--line); border-radius: var(--r); min-height: 300px; }
.t-head { display: grid; grid-template-columns: 1fr 1fr; gap: 1em; padding: .5em .9em; border-bottom: 1px solid var(--line); font-weight: 600; color: var(--muted); font-size: .9em; }
.transcript { padding: .4em .5em; max-height: calc(100vh - 360px); min-height: 240px; overflow-y: auto; }
.transcript.static { max-height: none; }
.tr-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1em; padding: .45em .5em; border-radius: 8px; margin: .2em 0; }
.tr-row .who { grid-column: 1 / -1; font-size: .75em; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.tr-row.them { background: var(--them); }
.tr-row.agent { background: var(--agent); }
.tr-row.user, .tr-row.ask { background: var(--user); }
.tr-row.sys, .tr-row.note { background: var(--sys); }
.tr-row.ask { border: 1px solid #f0cf8f; }
.tr-row.note .tr { font-weight: 600; }
.tr-row .tr { color: #29445e; }
.tr-row.wide .tr { grid-column: 1 / -1; }
.tr-row.temp { opacity: .65; }
.tr-row.consult .tr { color: var(--fg); font-size: 1.05em; }
.tr-row .phrase { grid-column: 1 / -1; margin-top: .3em; padding: .4em .6em; background: #fff; border: 1px dashed #9cc3a8; border-radius: 6px; font-style: italic; }
.tr-row .phrase .muted { font-style: normal; }
fieldset.kinds { margin-top: 0; }
fieldset.kinds label.check { margin: .35em 0; }
.interim { padding: .4em 1em .7em; color: var(--muted); font-style: italic; border-top: 1px dashed var(--line); }
.side .card-view { font-size: .93em; }
.side details { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: .6em .8em; }
.side summary { font-weight: 600; cursor: pointer; }
.card-view dt { font-weight: 600; margin-top: .5em; font-size: .85em; color: var(--muted); }
.card-view dd { margin: 0; }
.card-view ul { margin: .2em 0; padding-left: 1.1em; }
.tell {
  display: flex; gap: .5em; align-items: stretch; margin-top: .8em; background: #fff; border: 1px solid var(--line);
  border-radius: var(--r); padding: .6em; position: sticky; bottom: 0; padding-bottom: max(.6em, env(safe-area-inset-bottom));
}
.tell textarea { flex: 1; }
.tell-btns { display: flex; flex-direction: column; gap: .3em; }
.tell-btns button.rec { background: var(--err); color: #fff; }

.human-alert { position: fixed; inset: 0; background: rgba(179, 38, 30, .92); z-index: 100; display: flex; align-items: center; justify-content: center; }
.ha-box { background: #fff; border-radius: 16px; padding: 2em; text-align: center; max-width: 90vw; }
.ha-big { font-size: 2.2em; font-weight: 800; color: var(--err); margin-bottom: .3em; }
#ha-sub { font-size: 1.15em; margin-bottom: 1em; }

.list .item { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: .7em .9em; margin: .5em 0; display: flex; justify-content: space-between; gap: 1em; cursor: pointer; }
.list .item:hover { border-color: var(--pri2); }
.toast { position: fixed; bottom: 1.2em; left: 50%; transform: translateX(-50%); background: #1b2430; color: #fff; padding: .7em 1.1em; border-radius: 10px; z-index: 200; max-width: 92vw; }
progress { width: 100%; }

@media (max-width: 900px) {
  .call-body { grid-template-columns: 1fr; }
  .side { order: -1; }
  .side details:not([open]) { padding: .5em .8em; }
}
@media (max-width: 640px) {
  main { padding: .6em; }
  .cols { grid-template-columns: 1fr; }
  .top { padding: .4em .6em; position: static; }
  .brand span { font-size: .95em; }
  .top nav button { padding: .3em .55em; font-size: .9em; }
  .t-head { display: none; }
  .tr-row { grid-template-columns: 1fr; gap: .15em; }
  .tr-row .tr { border-top: 1px dashed rgba(0,0,0,.08); padding-top: .15em; }
  .tr-row .tr:empty { display: none; }
  .controls { width: 100%; display: grid; grid-template-columns: 1fr 1fr; }
  .controls #c-start, .controls #c-end { grid-column: span 1; }
  .controls #c-agent { grid-column: 1 / -1; }
  .transcript { max-height: none; }
  .question { top: 0; }
  .question .row input { flex-basis: 100%; order: 3; }
  .question .row #q-send { order: 4; }
  .q-text { font-size: 1.15em; }
  .kv .kvrow { grid-template-columns: 1fr 1.3fr auto; gap: .3em; }
  .kv .kvrow.sens { grid-template-columns: 1fr 1fr; }
  .kv .kvrow.sens .del { justify-self: end; }
  .kv .kvrow .del { min-height: 36px; padding: .2em .5em; }
  .tell { flex-direction: column; }
  .tell-btns { flex-direction: row; }
  .tell-btns button { flex: 1; }
}
