/* Lidor's colours: bordeaux leads, pink and white follow, slate blue and oat are accents. */
:root {
  --bordeaux: #78183b; --bordeaux-dark: #5c112c; --mauve: #c8a8b0; --rose: #d7a3b0; --rose-soft: #f3dfe5;
  --oat: #ddd0bc; --oat-soft: #f4eee4; --slate: #5f7c99; --slate-soft: #e3eaf1;
  --page: #fbf8f8; --card: #fff; --line: #e7dfe1; --text: #2a2226; --muted: #6f6368; --red: #b3261e; --red-soft: #fbe9e7;
  --radius: 8px;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--page); color: var(--text); font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, "Noto Sans Hebrew", sans-serif; display: flex; flex-direction: column; }
a { color: var(--bordeaux); }
h1, h2, h3, p { margin: 0; }
time { color: var(--muted); font-size: 0.8rem; white-space: nowrap; }
.ic { width: 14px; height: 14px; vertical-align: -2px; margin-inline-end: 3px; flex: none; }
button { font: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--bordeaux); outline-offset: 1px; }

/* top bar */
.top { display: flex; align-items: center; gap: 16px; padding: 8px 18px; background: var(--card); border-top: 4px solid var(--bordeaux); border-bottom: 1px solid var(--line); flex: none; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--bordeaux); font-weight: 700; font-size: 1.05rem; }
.brand img { height: 38px; width: 38px; object-fit: contain; }
.top-nav { margin-inline-start: auto; display: flex; align-items: center; gap: 16px; font-size: 0.9rem; }
.top-nav .me { color: var(--muted); }
.link { background: none; border: 0; padding: 0; color: var(--bordeaux); text-decoration: underline; }
.box-state { font-size: 0.82rem; color: var(--muted); }
.box-sample { background: var(--oat-soft); color: #5d4a22; padding: 2px 10px; border-radius: 99px; }
.box-error { background: var(--red-soft); color: var(--red); padding: 2px 10px; border-radius: 99px; }
.banner { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 8px 18px; background: var(--oat-soft); border-bottom: 1px solid var(--oat); font-size: 0.9rem; flex: none; }

/* buttons and chips */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 4px; padding: 7px 16px; border-radius: 6px; border: 1px solid var(--mauve); background: var(--card); color: var(--bordeaux); font-weight: 600; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--rose-soft); }
.btn-primary { background: var(--bordeaux); border-color: var(--bordeaux); color: #fff; }
.btn-primary:hover { background: var(--bordeaux-dark); }
.btn-quiet { border-color: transparent; color: var(--muted); font-weight: 500; }
.btn-small { padding: 4px 12px; font-size: 0.85rem; }
.btn-wide { width: 100%; }
.btn:disabled, .pick:disabled { opacity: 0.6; cursor: default; }
.chip { display: inline-block; padding: 1px 9px; border-radius: 99px; font-size: 0.76rem; font-weight: 600; white-space: nowrap; background: #eee; color: var(--text); }
.chip.ball-us { background: var(--rose-soft); color: var(--bordeaux); }
.chip.ball-agent, .chip.ball-insurer { background: var(--slate-soft); color: #36516b; }
.chip.ball-done { background: #ecebea; color: var(--muted); }
.chip.late { background: var(--red-soft); color: var(--red); }
.chip.cat { background: transparent; border: 1px solid var(--line); color: var(--muted); font-weight: 500; }
.hint { color: var(--muted); font-size: 0.82rem; }
.empty { padding: 28px 16px; color: var(--muted); text-align: center; }

/* the desk: mail, the open task, the queue */
.desk { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(250px, 23fr) minmax(380px, 47fr) minmax(280px, 30fr); gap: 12px; padding: 12px 18px 16px; }
.pane { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.pane-head, .read-head { padding: 12px 14px 0; border-bottom: 1px solid var(--line); flex: none; }
.pane-head h2, .read-head h2 { font-size: 1rem; color: var(--bordeaux); }
.read-head { padding-bottom: 10px; }
.read-head h2 { font-size: 1.1rem; color: var(--text); }
.scroll { flex: 1; min-height: 0; overflow-y: auto; }

.tabs { display: flex; gap: 14px; margin-top: 8px; }
.tab { padding: 6px 2px 8px; text-decoration: none; color: var(--muted); font-weight: 600; font-size: 0.9rem; }
.tab.on { color: var(--bordeaux); box-shadow: inset 0 -3px 0 var(--bordeaux); }
.count { background: var(--bordeaux); color: #fff; border-radius: 99px; padding: 0 7px; font-size: 0.72rem; font-weight: 700; }

.mrow { display: block; padding: 9px 14px; border-bottom: 1px solid var(--line); text-decoration: none; color: var(--text); border-inline-start: 3px solid transparent; }
.mrow:hover, .trow:hover { background: #faf4f6; }
.mrow.sel, .trow.sel { background: var(--rose-soft); }
.mrow.unread { border-inline-start-color: var(--bordeaux); }
.mrow-top { display: flex; justify-content: space-between; gap: 8px; }
.mrow-who { font-size: 0.9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mrow-subject { display: block; font-size: 0.88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mrow-subject .ic { margin-inline-start: 4px; color: var(--muted); }
.mrow-n { color: var(--muted); font-size: 0.78rem; }
.mrow-preview { display: block; color: var(--muted); font-size: 0.8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mrow.unread .mrow-who, .mrow.unread .mrow-subject { font-weight: 700; }
.mrow.unread time { color: var(--bordeaux); font-weight: 600; }

/* the queue */
.sums { display: flex; gap: 14px; padding: 8px 0 10px; font-size: 0.85rem; color: var(--muted); }
.sum b { color: var(--text); font-size: 1rem; }
.sum-late b { color: var(--red); }
.group { padding: 10px 14px 4px; font-size: 0.8rem; color: var(--muted); font-weight: 700; letter-spacing: 0.01em; }
.group b { font-weight: 600; }
.group-late { color: var(--red); }
.trow { display: block; padding: 8px 14px 9px; border-bottom: 1px solid var(--line); text-decoration: none; color: var(--text); border-inline-start: 4px solid #d9d4d6; }
.trow.cat-renewal { border-inline-start-color: var(--slate); }
.trow.cat-change { border-inline-start-color: #c2a777; }
.trow.cat-quote { border-inline-start-color: var(--bordeaux); }
.trow.cat-other { border-inline-start-color: #8d8388; }
.trow-title { display: block; font-weight: 600; font-size: 0.92rem; }
.trow-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin-top: 3px; font-size: 0.82rem; color: var(--muted); }
.urgent { color: var(--red); font-size: 0.78rem; font-weight: 700; white-space: nowrap; }
.done-group summary { padding: 10px 14px; font-size: 0.8rem; color: var(--muted); font-weight: 700; cursor: pointer; }
.done-group .trow-title { font-weight: 500; color: var(--muted); }

/* the open task */
.card { margin: 12px 14px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: #fdfbfb; }
.card-none, .card-closed { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.card-closed .history { flex-basis: 100%; }
.state { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 0.88rem; color: var(--muted); }
.asker { margin-inline-start: auto; }
.line { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; }
.lbl { width: 92px; flex: none; font-size: 0.82rem; color: var(--muted); }
.picks { display: flex; flex-wrap: wrap; gap: 6px; }
.pick { display: inline-flex; align-items: center; padding: 4px 12px; border-radius: 99px; border: 1px solid var(--line); background: var(--card); color: var(--text); font-size: 0.85rem; }
.pick:hover { border-color: var(--mauve); }
.pick.on { background: var(--bordeaux); border-color: var(--bordeaux); color: #fff; font-weight: 600; }
.pick.cat-renewal.on { background: var(--slate); border-color: var(--slate); }
.pick.cat-change.on { background: var(--oat); border-color: #c2a777; color: #4a3a17; }
.pick.cat-other.on { background: #8d8388; border-color: #8d8388; }
.pick-urgent { margin-inline-start: auto; }
.pick-urgent.on { background: var(--red); border-color: var(--red); }
.follow { display: flex; gap: 6px; align-items: center; }
.follow input { font: inherit; padding: 3px 8px; border: 1px solid var(--line); border-radius: 6px; }
.acts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.history { margin-top: 10px; font-size: 0.82rem; }
.history summary { cursor: pointer; color: var(--muted); }
.history ul { list-style: none; margin: 6px 0 0; padding: 0; }
.history li { display: flex; gap: 10px; padding: 3px 0; border-top: 1px dashed var(--line); }
.history li time { width: 88px; flex: none; }
.history li span { flex: 1; }
.history li i { color: var(--muted); font-style: normal; }

.thread { padding: 0 14px; }
.mail { border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 10px; background: var(--card); }
.mail-ours { background: #f7f9fb; border-color: #d5dfe8; }
.mail header { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; padding: 9px 12px; border-bottom: 1px solid var(--line); font-size: 0.88rem; }
.mail header .to { color: var(--muted); font-size: 0.8rem; }
.mail header time { margin-inline-start: auto; }
.attach { padding: 6px 12px; font-size: 0.82rem; color: var(--muted); border-bottom: 1px solid var(--line); }
.body { padding: 10px 12px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 0.92rem; unicode-bidi: plaintext; }
.reply { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 2px 14px 16px; }
.read-empty { flex: 1; display: flex; align-items: center; justify-content: center; text-align: center; color: var(--muted); padding: 24px; }

/* sign-in and short messages */
.login-wrap { flex: 1; display: flex; align-items: center; justify-content: center; background: var(--mauve); padding: 24px; }
.login-stack { width: 100%; max-width: 380px; text-align: center; }
.login-logo { width: 120px; height: 120px; object-fit: contain; margin-bottom: 14px; }
.login-card { background: var(--card); border-top: 4px solid var(--bordeaux); border-radius: var(--radius); padding: 24px; text-align: start; box-shadow: 0 6px 24px rgba(120, 24, 59, 0.15); }
.login-card h1 { font-size: 1.3rem; color: var(--bordeaux); }
.login-card .sub { color: var(--muted); margin: 4px 0 16px; }
.login-card label { display: block; font-size: 0.85rem; margin: 10px 0 4px; }
.login-card input { width: 100%; font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; }
.login-card .btn-wide { margin-top: 16px; }
.login-error { background: var(--red-soft); color: var(--red); padding: 8px 10px; border-radius: 6px; font-size: 0.88rem; }

/* settings */
.settings { width: 100%; max-width: 760px; margin: 0 auto; padding: 24px 18px 48px; overflow-y: auto; }
.settings h1 { color: var(--bordeaux); font-size: 1.4rem; margin-bottom: 14px; }
.settings section { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 14px; }
.settings h2 { font-size: 1.05rem; margin-bottom: 8px; }
.settings p + p { margin-top: 6px; }
.notice { background: var(--slate-soft); color: #36516b; padding: 8px 12px; border-radius: 6px; margin-bottom: 14px; }
.rules fieldset { border: 0; border-top: 1px solid var(--line); margin: 0; padding: 12px 0; }
.rules legend { font-weight: 600; padding: 0; }
.rules label { display: block; margin-top: 6px; }
.rules .days { display: flex; flex-wrap: wrap; gap: 4px 16px; }
.rules .days label { display: inline; }
.rules input[type="number"] { width: 70px; }
.rules input, .rules textarea { font: inherit; padding: 4px 8px; border: 1px solid var(--line); border-radius: 6px; }
.rules textarea { width: 100%; margin-top: 6px; }

@media (max-width: 1000px) {
  body { height: auto; }
  .desk { grid-template-columns: 1fr; }
  .pane { max-height: 70vh; }
  .pane-read { order: -1; }
}
