/* מיס אילה · טיקטים. Design system: context/miss-ayala/design-system.md.
   Discovery_Fs at every level; the contrast is weight (Black vs Light), not font.
   Purple dominant, teal for labels, #FF2B78 only on the action buttons.
   Rounded corners always, no shadows (the designer's note), mobile first. */

@font-face { font-family: "Discovery_Fs"; font-weight: 300; src: url("fonts/Discovery_Fs-Light.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "Discovery_Fs"; font-weight: 400; src: url("fonts/Discovery_Fs-Regular.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "Discovery_Fs"; font-weight: 700; src: url("fonts/Discovery_Fs-Bold.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "Discovery_Fs"; font-weight: 900; src: url("fonts/Discovery_Fs-Black.woff2") format("woff2"); font-display: swap; }

:root {
  --purple: #6545A1;  --teal: #20A4C4;  --cyan: #4FC8E0;  --lime: #B2EF03;
  --pink-action: #FF2B78; --pink-action-dark: #e01e63;
  --ink: #121212; --bg: #fafafa; --card: #ffffff;
  --g300: #dee2e6; --g500: #adb5bd; --g600: #6c757d; --g700: #495057;
  --success: #28a745; --danger: #dc3545;
  --purple-18: rgba(101,69,161,.18); --teal-18: rgba(32,164,196,.18); --cyan-18: rgba(79,200,224,.18);
  --lime-18: rgba(178,239,3,.18); --pink-18: rgba(254,145,236,.18);
  --radius: 16px; --radius-sm: 12px; --gap: 22px;
  --line: 1px solid var(--purple-18);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: "Discovery_Fs", "Heebo", system-ui, -apple-system, sans-serif;
  font-weight: 300; font-size: 16px; line-height: 1.5;
  min-height: 100dvh; padding-bottom: calc(76px + env(safe-area-inset-bottom));
  position: relative; overflow-x: hidden;
}
a { color: var(--purple); text-decoration: none; }
b, strong { font-weight: 700; }
input, textarea, select, button { font: inherit; }

.blobs { position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
.blobs span { position: absolute; border-radius: 50%; filter: blur(60px); opacity: .55; }
.blobs .b1 { width: 420px; height: 420px; background: var(--pink-18); top: -120px; right: -120px; }
.blobs .b2 { width: 360px; height: 360px; background: var(--cyan-18); bottom: 10%; left: -140px; }

/* ---------------------------------------------------------------- header */
.top { display: flex; align-items: center; gap: 14px; padding: 14px 18px 8px; padding-top: calc(14px + env(safe-area-inset-top)); flex-wrap: wrap; }
.brand img { display: block; width: 56px; height: auto; }
.top-title { flex: 1; min-width: 140px; }
.t1 { margin: 0; font-weight: 900; font-size: 36px; line-height: 1; color: var(--purple); letter-spacing: -.5px; }
.t2 { font-weight: 300; font-size: 18px; color: var(--teal); margin-top: 2px; }
.top-nav { display: none; align-items: center; gap: 18px; }
.top-nav a { font-weight: 700; color: var(--purple); padding: 6px 2px; border-bottom: 2px solid transparent; }
.top-nav a.active { border-bottom-color: var(--purple); }
.top-nav a.btn-action { border-bottom: 0; }

.wrap { max-width: 860px; margin: 0 auto; padding: 8px 16px 24px; }
.h2 { font-weight: 300; font-size: 24px; color: var(--purple); margin: 18px 0 6px; }
.h2 small { font-weight: 700; font-size: 14px; color: var(--teal); background: var(--teal-18); border-radius: 999px; padding: 2px 10px; vertical-align: middle; margin-inline-start: 6px; }
.hint { color: var(--g600); font-size: 15px; margin: 0 0 12px; }
.hint em, .lbl em { font-style: normal; color: var(--g500); font-weight: 300; }

.flash { max-width: 860px; margin: 6px auto 0; padding: 12px 16px; border-radius: var(--radius-sm); font-weight: 700; }
.flash.ok { background: var(--lime-18); color: #3d5a00; }
.flash.err { background: rgba(220,53,69,.12); color: var(--danger); }
@media (min-width: 860px) { .flash { margin-inline: auto; } }
@media (max-width: 859px) { .flash { margin-inline: 16px; } }

/* ---------------------------------------------------------------- cards */
.card { background: var(--card); border: var(--line); border-radius: var(--radius); padding: 16px; }
.cards { display: grid; gap: 12px; }
@media (min-width: 720px) { .cards { grid-template-columns: 1fr 1fr; } }
.ticket-card { display: block; color: var(--ink); transition: border-color .15s, transform .15s; border-inline-start-width: 5px; }
.ticket-card:active { transform: scale(.995); }
.ticket-card:hover { border-color: var(--purple); }
.p-urgent { border-inline-start-color: var(--danger); }
.p-normal { border-inline-start-color: #e0a800; }
.p-later { border-inline-start-color: var(--success); }
.card-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.num { font-weight: 900; color: var(--purple); font-size: 15px; }
.prio { font-size: 14px; font-weight: 700; color: var(--g700); }
.card-title { font-weight: 700; font-size: 18px; line-height: 1.3; color: var(--ink); }
.card-sum { font-size: 15px; color: var(--g700); margin-top: 4px; }
.card-meta { display: flex; gap: 6px; flex-wrap: wrap; color: var(--g600); font-size: 14px; margin-top: 8px; }
.card-meta .lane { color: var(--teal); font-weight: 700; }
.dot { color: var(--g300); }

.tag { display: inline-block; border-radius: 999px; padding: 2px 10px; font-size: 13px; font-weight: 700; line-height: 1.5; white-space: nowrap; }
.s-new     { background: var(--teal-18); color: #15738a; }
.s-working { background: var(--purple-18); color: var(--purple); }
.s-ayala   { background: var(--lime-18); color: #4a6a00; }
.s-ido     { background: rgba(108,117,125,.16); color: var(--g700); }
.s-atara   { background: var(--pink-18); color: var(--purple); }
.s-done    { background: rgba(40,167,69,.14); color: #1e7e34; }
.s-closed  { background: rgba(173,181,189,.2); color: var(--g600); }
.s-wont    { background: rgba(220,53,69,.12); color: var(--danger); }
.lane-tag  { background: var(--cyan-18); color: #15738a; }

.group { margin-bottom: 10px; }
details.finished summary { list-style: none; cursor: pointer; }
details.finished summary::-webkit-details-marker { display: none; }
details.finished summary .h2::before { content: "▸ "; font-size: 16px; color: var(--g500); }
details.finished[open] summary .h2::before { content: "▾ "; }
details.finished .cards { opacity: .85; }

.empty { text-align: center; padding: 36px 16px; }
.empty-icon { font-size: 40px; margin-bottom: 6px; }
.empty p { margin: 4px 0; font-size: 18px; }
.empty .btn-action { margin-top: 12px; }

.counters { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 8px; }
.counter { background: var(--card); border: var(--line); border-radius: var(--radius-sm); padding: 10px 6px; text-align: center; color: var(--ink); }
.counter b { display: block; font-weight: 900; font-size: 26px; color: var(--purple); line-height: 1.1; }
.counter span { font-size: 13px; color: var(--g600); }
.counter.hot b { color: var(--pink-action); }
.filter-note { color: var(--g600); font-size: 14px; margin: 8px 0 0; }

/* ---------------------------------------------------------------- buttons */
.btn-action, .btn-ghost {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 48px; padding: 0 22px; border-radius: 999px; font-weight: 700; font-size: 17px;
  border: 2px solid transparent; cursor: pointer; text-decoration: none; transition: background .15s, border-color .15s;
}
.btn-action { background: var(--pink-action); color: #fff; }
.btn-action:hover { background: var(--pink-action-dark); }
.btn-ghost { background: transparent; color: var(--purple); border-color: var(--purple); }
.btn-ghost:hover { background: var(--purple-18); }
.btn-ghost.danger { color: var(--danger); border-color: var(--danger); }
.btn-action.small, .btn-ghost.small { min-height: 36px; padding: 0 14px; font-size: 15px; }
.actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 14px; }
.actions form { margin: 0; }

/* ---------------------------------------------------------------- forms */
.form-card { margin-top: 12px; }
.form { display: grid; gap: 16px; }
.field { display: block; }
.lbl { display: block; font-weight: 700; color: var(--teal); font-size: 14px; margin-bottom: 6px; }
.field input[type=text], .field input[type=url], .field textarea, .inline-form input[type=text], .inline-form select, .field select {
  width: 100%; border: 1.5px solid var(--g300); border-radius: var(--radius-sm); padding: 12px 14px; background: #fff; color: var(--ink);
  font-weight: 300; font-size: 17px; outline: none; transition: border-color .15s;
}
.field textarea { resize: vertical; min-height: 96px; }
.field input:focus, .field textarea:focus { border-color: var(--purple); }
.field.bad input, .field.bad textarea { border-color: var(--danger); }
.err { display: block; color: var(--danger); font-size: 14px; margin-top: 4px; }

.prio-pick { display: grid; gap: 8px; }
@media (min-width: 620px) { .prio-pick { grid-template-columns: 1fr 1fr 1fr; } }
.prio-opt { display: block; border: 1.5px solid var(--g300); border-radius: var(--radius-sm); padding: 12px 14px; cursor: pointer; background: #fff; }
.prio-opt input { position: absolute; opacity: 0; pointer-events: none; }
.prio-opt:has(input:checked) { border-color: var(--purple); background: var(--purple-18); }
.prio-label { display: block; font-weight: 700; font-size: 17px; }
.prio-hint { display: block; color: var(--g600); font-size: 14px; }

.seg { display: inline-flex; border: 1.5px solid var(--g300); border-radius: 999px; overflow: hidden; background: #fff; }
.seg-opt { position: relative; }
.seg-opt input { position: absolute; opacity: 0; pointer-events: none; }
.seg-opt span { display: block; padding: 8px 18px; font-weight: 700; color: var(--g700); cursor: pointer; }
.seg-opt:has(input:checked) span { background: var(--purple); color: #fff; }

.drop { position: relative; border: 1.5px dashed var(--g300); border-radius: var(--radius-sm); padding: 14px; text-align: center; background: #fff; }
.drop:focus-within, .drop.over { border-color: var(--purple); background: var(--purple-18); }
.drop input[type=file] { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; }
.drop-text { color: var(--g600); font-size: 15px; pointer-events: none; }
.drop.compact { padding: 10px; }
.previews { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-top: 8px; position: relative; z-index: 1; pointer-events: none; }
.previews:empty { display: none; }
.previews img, .previews .pv { width: 84px; height: 84px; object-fit: cover; border-radius: 10px; border: var(--line); background: var(--g300); display: grid; place-items: center; font-size: 12px; color: var(--g700); padding: 4px; overflow: hidden; }

.inline-form { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; margin-top: 12px; }
.inline-form label { display: grid; gap: 4px; font-weight: 700; color: var(--teal); font-size: 14px; }
.inline-form label.grow { flex: 1; min-width: 160px; }
.inline-form input[type=text], .inline-form select { min-width: 150px; padding: 9px 12px; font-size: 15px; }

/* ---------------------------------------------------------------- ticket */
.ticket { display: grid; gap: 14px; margin-top: 10px; }
.ticket-head { border-inline-start-width: 5px; }
.ticket-title { margin: 6px 0 4px; font-weight: 900; font-size: 24px; line-height: 1.25; color: var(--purple); }
.ticket-body { white-space: pre-wrap; font-size: 17px; }
.ticket-link { margin-top: 8px; font-size: 14px; word-break: break-all; }
.confirm { background: var(--lime-18); border-color: transparent; }
.confirm.quiet { background: var(--cyan-18); }
.confirm p { margin: 0; }
.admin-tools { background: var(--purple-18); border-color: transparent; }
.admin-tools .inline-form { margin-top: 0; }

.files { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.file { display: grid; gap: 4px; width: 132px; color: var(--ink); }
.file img { width: 132px; height: 100px; object-fit: cover; border-radius: 10px; border: var(--line); background: var(--g300); }
.file-ico { display: grid; place-items: center; width: 132px; height: 100px; border-radius: 10px; border: var(--line); font-size: 34px; background: #fff; }
.file-name { font-size: 13px; color: var(--g700); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-name small { color: var(--g500); }

.thread { display: grid; gap: 12px; }
.status-line { display: flex; align-items: center; justify-content: center; gap: 10px; color: var(--g600); font-size: 13px; }
.status-line::before, .status-line::after { content: ""; flex: 1; height: 1px; background: var(--g300); }
.status-line time { color: var(--g500); }
.msg { display: flex; gap: 10px; align-items: flex-start; }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-weight: 900; color: #fff; flex: none; font-size: 15px; }
.from-atara .avatar { background: var(--purple); }
.from-claude .avatar { background: var(--teal); }
.from-ayala .avatar { background: #7fa300; }
.from-system .avatar { background: var(--g500); }
.from-claude, .from-system { flex-direction: row-reverse; }
.bubble { background: var(--card); border: var(--line); border-radius: var(--radius); padding: 12px 14px; max-width: min(92%, 640px); flex: 0 1 auto; }
.from-atara .bubble { border-color: var(--purple-18); background: #fff; }
.from-claude .bubble { background: var(--cyan-18); border-color: transparent; }
.from-ayala .bubble { background: var(--lime-18); border-color: transparent; }
.ido-draft .bubble { border: 2px dashed var(--g500); background: #fff; }
.msg-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 4px; font-size: 14px; }
.msg-head b { color: var(--purple); }
.msg-head time { color: var(--g500); margin-inline-start: auto; }
.msg-body { white-space: pre-wrap; font-size: 16px; }

.reply-card { margin-bottom: 20px; }

/* ---------------------------------------------------------------- links */
table.links { width: 100%; border-collapse: collapse; margin: 10px 0; font-size: 15px; }
table.links th { text-align: right; color: var(--teal); font-weight: 700; padding: 8px 6px; border-bottom: var(--line); }
table.links td { padding: 8px 6px; border-bottom: 1px solid var(--g300); vertical-align: middle; }
table.links tr.revoked td { color: var(--g500); }
table.links .url input { width: 100%; border: 1px solid var(--g300); border-radius: 8px; padding: 6px 8px; font-size: 13px; font-family: ui-monospace, monospace; }
.row-actions { display: flex; gap: 6px; }
.row-actions form { margin: 0; }
@media (max-width: 700px) { table.links th:nth-child(4), table.links td:nth-child(4) { display: none; } }

/* ---------------------------------------------------------------- footer / bottom nav */
.foot { display: flex; justify-content: space-between; gap: 10px; padding: 12px 18px; color: var(--g500); font-size: 13px; max-width: 860px; margin: 0 auto; }
.bottom-nav { position: fixed; bottom: 0; inset-inline: 0; display: flex; background: #fff; border-top: var(--line); padding: 6px 12px calc(6px + env(safe-area-inset-bottom)); z-index: 5; }
.bottom-nav a { flex: 1; display: grid; place-items: center; gap: 0; font-size: 22px; color: var(--purple); line-height: 1; padding: 6px 0; border-radius: 12px; }
.bottom-nav a span { font-size: 12px; font-weight: 700; }
.bottom-nav a.primary { background: var(--pink-action); color: #fff; margin: 0 8px; }

@media (min-width: 760px) {
  body { padding-bottom: 24px; }
  .bottom-nav { display: none; }
  .top { padding: 22px 24px 10px; }
  .top-nav { display: flex; }
  .t1 { font-size: 44px; }
  .t2 { font-size: 20px; }
  .h2 { font-size: 26px; }
  .ticket-title { font-size: 28px; }
}
