/* Shared foundation for the portal and the agent console. MOBILE-FIRST: every bare rule is
   the ~360px phone layout; wider screens are layered on with min-width media queries.
   Logical properties (inline-start/end) everywhere so Hebrew (RTL) mirrors for free.
   The brand tokens (--accent, --on-accent, --tint, --ink, --deep, --ring) are overridden per
   request by a tiny inline <style> that follows this file. */

:root {
  --accent: #3a693a;
  --on-accent: #ffffff;
  --tint: #eef4ee;
  --ink: #2f5a2f;
  --deep: #2d522d;
  --ring: #a9c6a9;

  --bg: #f6f7f9;
  --card: #ffffff;
  --text: #1b1f27;
  --muted: #5f6775;
  --faint: #8a919e;
  --line: #e3e6eb;
  --line-soft: #eef0f3;

  --danger: #b42318;
  --danger-bg: #fef3f2;
  --warn: #93370d;
  --warn-bg: #fffaeb;
  --ok: #067647;
  --ok-bg: #ecfdf3;
  --info: #1d4ed8;
  --info-bg: #eff4ff;

  --r: 14px;
  --r-sm: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 6px 20px rgba(16, 24, 40, .06);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Noto Sans Hebrew", "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  font: 16px/1.55 var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow-wrap: anywhere;            /* a long URL or token must never force sideways scroll */
}
img, svg, video { max-width: 100%; }
a { color: var(--ink); }
a:hover { color: var(--deep); }
h1, h2, h3 { line-height: 1.2; margin: 0; letter-spacing: -.01em; }
p { margin: 0 0 1em; }
:focus-visible { outline: 3px solid var(--ring); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }

.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.skip {
  position: absolute; inset-inline-start: 8px; top: -60px; z-index: 100;
  background: var(--text); color: #fff; padding: 10px 14px; border-radius: 8px; text-decoration: none;
}
.skip:focus { top: 8px; }
.wrap { width: 100%; max-width: 1080px; margin-inline: auto; padding-inline: 16px; }
.muted { color: var(--muted); }
.ltr { direction: ltr; unicode-bidi: isolate; display: inline-block; }
.ico { flex: none; vertical-align: middle; }

/* ---- buttons ------------------------------------------------------------------------ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 10px 20px; border-radius: 12px; border: 1px solid transparent;
  background: var(--accent); color: var(--on-accent);
  font: inherit; font-weight: 650; text-decoration: none; cursor: pointer; text-align: center;
  transition: filter .15s, background .15s, box-shadow .15s;
}
.btn:hover { filter: brightness(.94); color: var(--on-accent); }
.btn:active { filter: brightness(.88); }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn--ghost { background: transparent; color: var(--text); border-color: var(--line); }
.btn--ghost:hover { background: var(--line-soft); color: var(--text); filter: none; }
.btn--danger { background: var(--danger); color: #fff; }
.btn--danger:hover { color: #fff; }
.btn--sm { min-height: 40px; padding: 6px 14px; font-size: .9rem; border-radius: 10px; }
.btn--block { width: 100%; }
.linkbtn { background: none; border: 0; padding: 0; font: inherit; color: var(--ink); text-decoration: underline; cursor: pointer; min-height: 40px; }

/* ---- forms ------------------------------------------------------------------------- */
.field { display: grid; gap: 6px; margin-bottom: 16px; }
.field > label, .label { font-weight: 600; font-size: .92rem; }
.hint { font-size: .85rem; color: var(--muted); }
input[type=text], input[type=email], input[type=search], input[type=password], input[type=url],
input[type=number], select, textarea {
  width: 100%; min-height: 46px; padding: 10px 12px;
  font: inherit; font-size: 16px;                 /* 16px: iOS Safari does not zoom the page on focus */
  color: var(--text); background: #fff;
  border: 1px solid #cfd4dc; border-radius: var(--r-sm);
  transition: border-color .15s, box-shadow .15s;
}
textarea { min-height: 150px; resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); }
input[readonly] { background: var(--line-soft); color: var(--muted); }
.field--err input, .field--err textarea, .field--err select { border-color: var(--danger); }
.err { color: var(--danger); font-size: .88rem; font-weight: 550; }
input[type=file] { font: inherit; font-size: 15px; max-width: 100%; padding: 6px 0; color: var(--muted); }
input[type=file]::file-selector-button {
  font: inherit; font-weight: 600; color: var(--text); background: #fff; border: 1px solid #cfd4dc; border-radius: 10px;
  padding: 9px 14px; margin-inline-end: 12px; min-height: 42px; cursor: pointer;
}
input[type=file]::file-selector-button:hover { background: var(--line-soft); }
input[type=color] { width: 54px; min-height: 46px; padding: 3px; border: 1px solid #cfd4dc; border-radius: var(--r-sm); background: #fff; }
.check { display: flex; align-items: center; gap: 10px; min-height: 40px; }
.check input { width: 20px; height: 20px; flex: none; accent-color: var(--accent); }
.hp { position: absolute; inset-inline-start: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ---- surfaces ---------------------------------------------------------------------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; box-shadow: var(--shadow); }
.alert { padding: 12px 14px; border-radius: var(--r-sm); border: 1px solid; margin-bottom: 16px; font-size: .95rem; }
.alert--err  { background: var(--danger-bg); color: var(--danger); border-color: #fecdca; }
.alert--ok   { background: var(--ok-bg); color: var(--ok); border-color: #abefc6; }
.alert--warn { background: var(--warn-bg); color: var(--warn); border-color: #fedf89; }
.alert--info { background: var(--info-bg); color: var(--info); border-color: #c7d7fe; }
.secret {
  display: block; margin-top: 8px; padding: 10px 12px; background: #fff; color: var(--text);
  border: 1px dashed #98a2b3; border-radius: 8px; font: 600 1rem ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  direction: ltr; text-align: start; user-select: all; word-break: break-all;
}

/* ---- chips ------------------------------------------------------------------------- */
.chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 999px;
  font-size: .78rem; font-weight: 650; line-height: 1.6; white-space: nowrap;
  background: var(--line-soft); color: var(--muted);
}
.chip--status-open     { background: #e8f0fe; color: #1d4ed8; }
.chip--status-pending  { background: #fef3c7; color: #92400e; }
.chip--status-solved   { background: #dcfce7; color: #166534; }
.chip--status-closed   { background: #eceef2; color: #475467; }
.chip--priority-low    { background: #eef0f3; color: #667085; }
.chip--priority-normal { background: #eef0f3; color: #475467; }
.chip--priority-high   { background: #ffedd5; color: #9a3412; }
.chip--priority-urgent { background: #fee2e2; color: #b42318; }
.bpill { display: inline-flex; align-items: center; gap: 6px; font-size: .8rem; font-weight: 650; color: var(--text); white-space: nowrap; }
.bpill__dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); flex: none; }

time { white-space: nowrap; }
.msg-body { white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word; }
.msg-body a { color: var(--ink); }

/* ticket id chip (portal + console) */
.id-chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; background: var(--tint); color: var(--ink); border-radius: 8px; font: 700 .9rem ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; direction: ltr; }
