/* styles.css — SHAM EYE operator console.
 *
 * NO INLINE STYLE ANYWHERE IN THE PRODUCT. The CSP is a genuine
 * style-src 'self' with no 'unsafe-inline' escape hatch, which is only possible
 * because every rule lives in this file. A single style="" attribute added for
 * convenience would force that directive open for the whole application.
 *
 * MOBILE IS NOT AN AFTERTHOUGHT HERE. The owner approves production-affecting
 * actions from a phone, so the layout is authored narrow-first and widened at
 * breakpoints, rather than authored wide and squeezed.
 */

:root {
  --sidebar: #0b0f14;
  --sidebar-2: #121821;
  --sidebar-line: #1e2733;
  --sidebar-text: #8b97a6;
  --sidebar-text-active: #ffffff;

  --accent: #22c55e;
  --accent-dim: #16a34a;
  --accent-soft: rgba(34, 197, 94, 0.12);

  --bg: #f5f7fa;
  --card: #ffffff;
  --line: #e3e8ef;
  --text: #16202c;
  --muted: #64748b;

  --ok: #16a34a;
  --warn: #d97706;
  --danger: #dc2626;
  --info: #2563eb;

  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .1);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}
h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -0.01em; }
a { color: var(--accent-dim); }
.muted { color: var(--muted); font-size: 13px; margin: 0; }
.mono { font-family: var(--mono); font-size: 12px; }
[hidden] { display: none !important; }

/* ---------------------------------------------------------------- brand */
.eye { width: 30px; height: 16px; flex: none; color: var(--accent); }
.brand-mark { display: flex; align-items: center; gap: 9px; font-size: 15px; letter-spacing: .12em; }
.brand-mark b { font-weight: 800; }

/* ---------------------------------------------------------------- login */
.login-body { background: var(--sidebar); color: #e6edf3; }
.login-wrap { display: grid; grid-template-columns: 1fr; min-height: 100vh; max-width: 1100px; margin: 0 auto; }
.login-brand { padding: 44px 26px 0; }
.login-brand h1 { font-size: 26px; margin: 26px 0 8px; }
.brand-sub { color: var(--sidebar-text); margin: 0 0 22px; }
.brand-points { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.brand-points li { color: var(--sidebar-text); font-size: 13px; }
.brand-points span { display: block; color: var(--accent); font-weight: 650; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; }
.login-panel { padding: 30px 26px 44px; display: flex; flex-direction: column; justify-content: center; }
.login-card { background: var(--card); color: var(--text); border-radius: var(--radius); padding: 26px; box-shadow: var(--shadow); }
.login-card h2 { font-size: 20px; margin-bottom: 4px; }
.login-card label { display: block; font-size: 12px; font-weight: 650; margin: 16px 0 6px; color: var(--muted); }
.login-card input { width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); font-size: 15px; font-family: inherit; }
.login-card input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
.login-foot { text-align: center; color: var(--sidebar-text); font-size: 12px; margin-top: 18px; }
@media (min-width: 860px) {
  .login-wrap { grid-template-columns: 1.05fr .95fr; align-items: center; gap: 40px; }
  .login-brand { padding: 0 0 0 20px; }
  .login-panel { padding: 0 20px 0 0; }
}

/* ---------------------------------------------------------------- shell */
.app-body { background: var(--bg); }
.shell { display: flex; flex-direction: column; min-height: 100vh; }

.sidebar {
  background: var(--sidebar);
  color: var(--sidebar-text);
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px;
  position: sticky; top: 0; z-index: 40;
  border-bottom: 1px solid var(--sidebar-line);
}
.sidebar-brand { color: #fff; flex: 1; min-width: 0; }
.nav { display: none; }
.sidebar-foot { display: flex; align-items: center; gap: 10px; }
.who-name { color: #fff; font-size: 13px; font-weight: 600; line-height: 1.1; }
.who-role { color: var(--accent); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; }

/* Mobile navigation: a bottom bar, because a hamburger hides exactly the
 * thing an operator on a phone needs to reach fastest. */
.mobilenav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
  background: var(--sidebar); border-top: 1px solid var(--sidebar-line);
  display: flex; justify-content: space-around;
  padding: 6px 2px calc(6px + env(safe-area-inset-bottom, 0px));
}
.mobilenav .nav-item {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
  background: none; border: 0; color: var(--sidebar-text);
  font-size: 10px; font-family: inherit; padding: 5px 2px; cursor: pointer;
  border-radius: var(--radius-sm); min-width: 0;
}
.mobilenav .nav-item span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.mobilenav .nav-item .dot { width: 5px; height: 5px; border-radius: 50%; background: transparent; }
.mobilenav .nav-item.active { color: var(--sidebar-text-active); }
.mobilenav .nav-item.active .dot { background: var(--accent); }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; padding-bottom: 68px; }
.topbar {
  background: var(--card); border-bottom: 1px solid var(--line);
  padding: 12px 16px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  position: sticky; top: 52px; z-index: 30;
}
.topbar-left { flex: 1; min-width: 0; }
.topbar h1 { font-size: 17px; }
.topbar-right { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.view { padding: 16px; flex: 1; }

.appfoot {
  padding: 18px 16px 22px; text-align: center; color: var(--muted);
  font-size: 12px; border-top: 1px solid var(--line); background: var(--card);
}
.appfoot .dev { display: block; margin-top: 3px; }

@media (min-width: 900px) {
  .shell { flex-direction: row; }
  .sidebar {
    width: 232px; flex: none; flex-direction: column; align-items: stretch;
    padding: 20px 14px; border-bottom: 0; border-right: 1px solid var(--sidebar-line);
    height: 100vh; position: sticky; top: 0;
  }
  .sidebar-brand { flex: none; margin-bottom: 26px; }
  .nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
  .nav .nav-item {
    display: flex; align-items: center; gap: 10px; width: 100%;
    background: none; border: 0; color: var(--sidebar-text);
    font-family: inherit; font-size: 14px; text-align: left;
    padding: 9px 11px; border-radius: var(--radius-sm); cursor: pointer;
  }
  .nav .nav-item:hover { background: var(--sidebar-2); color: #cbd5e1; }
  .nav .nav-item.active { background: var(--accent-soft); color: var(--sidebar-text-active); font-weight: 600; }
  .nav .nav-item .dot { width: 6px; height: 6px; border-radius: 50%; background: transparent; flex: none; }
  .nav .nav-item.active .dot { background: var(--accent); }
  .nav .nav-item .count {
    margin-left: auto; background: var(--sidebar-2); color: var(--accent);
    border-radius: 999px; padding: 1px 7px; font-size: 11px; font-weight: 700;
  }
  .sidebar-foot { border-top: 1px solid var(--sidebar-line); padding-top: 14px; }
  .mobilenav { display: none; }
  .main { padding-bottom: 0; }
  .topbar { top: 0; padding: 14px 24px; }
  .topbar h1 { font-size: 19px; }
  .view { padding: 22px 24px; }
}

/* ---------------------------------------------------------------- cards */
.grid { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 620px) { .grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1180px) { .grid { grid-template-columns: repeat(4, 1fr); } .grid.grid-2 { grid-template-columns: repeat(2, 1fr); } }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow); min-width: 0;
}
.card + .card, .grid + .card, .card + .grid, .grid + .grid { margin-top: 12px; }
.card-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.card-head h2 { font-size: 12px; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.card-head .spacer { flex: 1; }
.stat { font-size: 30px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; }
.stat-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.stat.ok { color: var(--ok); } .stat.warn { color: var(--warn); }
.stat.danger { color: var(--danger); } .stat.info { color: var(--info); }

.rowlist { display: flex; flex-direction: column; gap: 8px; }
.row {
  display: flex; align-items: center; gap: 10px; padding: 11px 12px;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--card);
  text-align: left; width: 100%; font-family: inherit; font-size: 14px; cursor: pointer;
}
.row:hover { border-color: var(--accent); background: #fbfefc; }
.row-main { flex: 1; min-width: 0; }
.row-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-sub { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-aside { text-align: right; flex: none; font-size: 12px; color: var(--muted); }
/* An unread notification is marked by a border, not by colour alone: colour
   alone is invisible to a monochrome or colour-blind reader, and this is the
   list whose whole job is 'which of these still needs you'. */
.row.unread { border-left: 3px solid var(--accent); font-weight: 600; }
.row.unread .row-sub { font-weight: 400; }

/* ---------------------------------------------------------------- chips */
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  background: #eef2f7; color: var(--muted);
  border-radius: 999px; padding: 3px 10px; font-size: 11px; font-weight: 650;
  white-space: nowrap;
}
.chip.ok { background: #e8f8ee; color: var(--ok); }
.chip.warn { background: #fdf3e3; color: var(--warn); }
.chip.danger { background: #fdecec; color: var(--danger); }
.chip.info { background: #e8f0fe; color: var(--info); }
.chip.stage { background: var(--accent-soft); color: var(--accent-dim); }
.chip-lg { font-size: 12px; padding: 5px 12px; }

/* The seven .dash-* rules that styled the hard-coded "Batch 50 …" lines were
   removed with the markup they styled (Sprint C). They described a release
   from weeks earlier on the owner's primary screen. Nothing replaced them:
   the live release identity now has a real home on the System page, read from
   the release stamp rather than from a string in a template. */

/* A checkbox field in the composer: the control and its label on one line,
   with a touch-sized target, rather than the stacked label/input the plain
   .field rule produces. */
.field-check { display: flex; align-items: center; gap: .5rem; margin: .5rem 0; }
.field-check input[type="checkbox"] { width: 18px; height: 18px; margin: 0; flex: none; }
.field-check label { margin: 0; font-weight: 500; }

/* Arabic acknowledgement line at the very top of the dashboard. Kept visually
   quiet on purpose: it sits above the live status banner and must not compete
   with it for the owner's first glance. */
.dash-note {
  margin: 0 0 8px; text-align: center;
  font-size: 14px; font-weight: 700; letter-spacing: .02em;
  color: var(--text);
}

.dash-hello {
  margin: 0 0 8px; text-align: center;
  font-size: 15px; font-weight: 700; letter-spacing: .02em;
  color: var(--text);
}

.dash-credit {
  margin: 0 0 8px; text-align: center;
  font-size: 13px; font-weight: 600; letter-spacing: .04em;
  color: var(--muted);
}

.dash-hamd {
  margin: 0 0 10px; text-align: center;
  font-size: 15px; font-weight: 700; color: var(--accent-dim);
  background: var(--accent-soft); border-radius: var(--radius);
  padding: 9px 14px;
}

.banner {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  background: var(--sidebar); color: #cbd5e1; border-radius: var(--radius);
  padding: 11px 14px; margin-bottom: 14px; font-size: 12px;
}
.banner b { color: var(--accent); }
.banner .sep { color: #334155; }

/* ---------------------------------------------------------------- progress */
.track { height: 6px; background: #eef2f7; border-radius: 999px; overflow: hidden; margin: 10px 0 4px; }
.track > i { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.stages { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.stages .s { font-size: 10px; padding: 2px 7px; border-radius: 999px; background: #eef2f7; color: var(--muted); }
.stages .s.done { background: var(--accent-soft); color: var(--accent-dim); }
.stages .s.now { background: var(--accent); color: #fff; font-weight: 700; }

/* ---------------------------------------------------------------- timeline */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: flex; gap: 11px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.timeline li:last-child { border-bottom: 0; }
.timeline .t { font-family: var(--mono); font-size: 11px; color: var(--muted); flex: none; width: 58px; padding-top: 2px; }
.timeline .b { min-width: 0; flex: 1; }
.timeline .b .txt { font-size: 13px; font-weight: 550; }
.timeline .b .dt { font-size: 11px; color: var(--muted); word-break: break-word; font-family: var(--mono); }
.timeline .b .unknown { color: var(--warn); }

/* ---------------------------------------------------------------- buttons */
.btn {
  font-family: inherit; font-size: 14px; font-weight: 600; border-radius: var(--radius-sm);
  padding: 9px 14px; border: 1px solid transparent; cursor: pointer; background: #eef2f7; color: var(--text);
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-sm { font-size: 12px; padding: 6px 10px; }
.btn-block { width: 100%; display: block; margin-top: 18px; }
.btn-primary { background: var(--accent); color: #05240f; }
.btn-primary:hover:not(:disabled) { background: var(--accent-dim); color: #fff; }
.btn-secondary { background: var(--card); border-color: var(--line); color: var(--text); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-ghost { background: transparent; color: var(--sidebar-text); border-color: var(--sidebar-line); }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }

.field { margin-top: 12px; }
.field label { display: block; font-size: 12px; font-weight: 650; color: var(--muted); margin-bottom: 5px; }
.field input, .field textarea, .field select {
  width: 100%; padding: 10px 11px; border: 1px solid var(--line);
  border-radius: var(--radius-sm); font-family: inherit; font-size: 15px; background: var(--card); color: var(--text);
}
.field textarea { min-height: 96px; resize: vertical; }
.field input:focus, .field textarea:focus, .field select:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
.hint { font-size: 11px; color: var(--muted); margin-top: 4px; }

.alert { border-radius: var(--radius-sm); padding: 10px 12px; font-size: 13px; margin-top: 10px; }
.alert-error { background: #fdecec; color: #991b1b; }
.alert-warn { background: #fdf3e3; color: #92400e; }
.alert-info { background: #e8f0fe; color: #1e40af; }
.alert-ok { background: #e8f8ee; color: #14532d; }

.empty { text-align: center; padding: 30px 14px; color: var(--muted); font-size: 13px; }

.kv { display: grid; grid-template-columns: 1fr; gap: 6px; margin-top: 8px; }
@media (min-width: 620px) { .kv { grid-template-columns: repeat(2, 1fr); } }
.kv div { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; padding: 5px 0; border-bottom: 1px dashed var(--line); min-width: 0; }
.kv div b { font-weight: 600; text-align: right; word-break: break-word; }
.kv div span { color: var(--muted); flex: none; }

/* ---------------------------------------------------------------- modal / toast */
.modal-backdrop { position: fixed; inset: 0; background: rgba(11, 15, 20, .55); display: flex; align-items: flex-end; justify-content: center; z-index: 100; }
.modal { background: var(--card); border-radius: var(--radius) var(--radius) 0 0; padding: 20px; width: 100%; max-width: 520px; max-height: 88vh; overflow: auto; }
@media (min-width: 620px) { .modal-backdrop { align-items: center; } .modal { border-radius: var(--radius); } }
.modal h3 { font-size: 17px; margin-bottom: 8px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: 84px; background: var(--sidebar); color: #fff; padding: 10px 16px; border-radius: 999px; font-size: 13px; z-index: 120; box-shadow: var(--shadow); }
@media (min-width: 900px) { .toast { bottom: 24px; } }

/* Conversation thread. Message bodies wrap and preserve the owner's line breaks
 * without ever being treated as markup -- the renderer escapes, this only wraps. */
.msg { font-size: 14px; white-space: pre-wrap; word-break: break-word; margin-top: 3px; }
.row .row-main .msg { max-width: 100%; }

/* ---------------------------------------------------------------- a11y
 *
 * VISIBLE FOCUS IS NOT OPTIONAL. A keyboard operator who cannot see where they
 * are cannot use the product at all, and `outline: none` is the single most
 * common way that happens. Focus is styled UP here rather than removed.
 */
:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}
.sidebar :focus-visible, .mobilenav :focus-visible { outline-color: #fff; }

/* Announced to assistive technology, invisible on screen. Not display:none,
 * which would remove it from the accessibility tree as well. */
.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* Touch targets. 44px is the platform guidance; the bottom bar was already
 * close and is now explicit rather than incidental. */
.mobilenav .nav-item { min-height: 44px; }
.btn { min-height: 40px; }
.btn-sm { min-height: 32px; }

/* THE COMPOSER MUST SURVIVE THE ON-SCREEN KEYBOARD.
 * On a phone the keyboard shrinks the viewport; a composer pinned with vh units
 * ends up underneath it. dvh tracks the *dynamic* viewport, and the scroll
 * margin keeps a focused field clear of the bottom navigation. */
.field textarea { max-height: 40dvh; }
.field input, .field textarea, .field select { scroll-margin-bottom: 96px; }

/* Attachment + member rows */
.member-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.member-row .grow { flex: 1; min-width: 140px; }
.att { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.att .name { font-size: 12px; color: var(--muted); word-break: break-all; }
.transcript {
  margin-top: 6px; padding: 8px 10px; background: #f6f8fa;
  border-left: 3px solid var(--accent); border-radius: 4px;
  font-size: 13px; white-space: pre-wrap; word-break: break-word;
}
.spinner { display: inline-block; width: 12px; height: 12px; border: 2px solid var(--line);
  border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } }

/* ===========================================================================
   SPRINT AB — thread task cards, batch approval rows
   ===========================================================================
   Mobile first, like everything above: these appear inside a thread row that is
   already narrow on a phone, so they stack and wrap rather than assuming width.
*/

/* The task a chat reply produced, shown inline under the message. Indented with
   a rule rather than a box so it reads as belonging to the message above it
   instead of competing with it. */
.threadtask {
  margin: 8px 0 2px;
  padding: 8px 0 2px 10px;
  border-left: 3px solid var(--accent);
}
.threadtask .btn-row { margin-top: 6px; flex-wrap: wrap; gap: 6px; }
/* 44px is the platform touch guidance and these are the controls an owner uses
   one-handed while waiting for a reply. */
.threadtask .btn-sm { min-height: 44px; }

/* A batch row is a <label> so the whole row is the hit target, not just the
   12px checkbox -- on a phone the checkbox alone is not reliably tappable. */
.batchrow { cursor: pointer; align-items: center; }
.batchrow .row-main { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.batchrow .row-title { font-weight: 600; }
.batchrow .row-sub { width: 100%; }
/* Deliberately larger than the browser default: this is the control that
   decides whether a piece of work is approved. */
.batchpick { width: 20px; height: 20px; flex: none; accent-color: var(--accent); }

/* ===========================================================================
   FULL AUTO — the badge, the bar, the estimate.
   The bar is driven by a server-supplied percentage and has no animation of
   its own: nothing here moves unless the workflow moved. A stopped automation
   keeps its bar visible and recolours it rather than emptying it, because how
   far the task got is exactly what an owner needs when it hands back.
   =========================================================================== */
.btn-auto { background: var(--accent, #4f46e5); color: #fff; border: 1px solid transparent; }
.btn-auto:hover { filter: brightness(1.08); }
.btn-auto:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }

.fa-head { margin-bottom: .5rem; }
.fa-badge {
  display: inline-block; padding: .15rem .5rem; border-radius: 999px;
  font-size: .75rem; font-weight: 700; letter-spacing: .06em;
  background: var(--accent, #4f46e5); color: #fff;
}
.fa-badge-stop { background: var(--danger, #b91c1c); }

.fa-bar {
  height: 10px; border-radius: 999px; overflow: hidden;
  background: var(--surface-2, rgba(127,127,127,.22));
}
.fa-bar-fill { height: 100%; background: var(--accent, #4f46e5); transition: width .4s linear; }
.fa-bar-stopped { background: var(--danger, #b91c1c); }
.fa-pct { margin-top: .25rem; font-variant-numeric: tabular-nums; font-weight: 700; }
.fa-phase { margin-top: .35rem; }
.fa-eta { margin-top: .2rem; opacity: .85; font-variant-numeric: tabular-nums; }
.fa-stop { margin-top: .35rem; }

/* Respect a reader who has asked for less motion: the width change is the only
   movement here, and it is not essential to understanding the number. */
@media (prefers-reduced-motion: reduce) { .fa-bar-fill { transition: none; } }
