/* ===== RF Sight — shared console chrome =====
   Common styling for the admin and technician consoles (and any future
   console). Served across every subdomain at /shared/base.css. Each page adds
   only its own delta stylesheet on top of this. */
:root {
  color-scheme: dark;
  --bg: #0b0f15;
  --panel: #131b25;
  --panel-2: #0f161e;
  --item: #161f2a99;
  --accent: #e67e22;
  --brand-a: #143b52;
  --brand-b: #1f6089;
  --text: #e7ecf3;
  --muted: #94a2b4;
  --border: #26313f;
  --input-bg: #0d131a;
  --shadow: rgba(0, 0, 0, .55);
  --danger: #e74c3c;
}
* { box-sizing: border-box; }
body {
  margin: 0; font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg); color: var(--text); min-height: 100vh;
}
h1, h2, h3 { margin: 0; }

/* ===== buttons ===== */
.btn {
  background: var(--item); color: var(--text); border: 1px solid var(--border);
  border-radius: 8px; padding: 10px; font-size: .95em; font-weight: 600; cursor: pointer;
  font-family: inherit; transition: filter .15s, background .15s, border-color .15s, box-shadow .15s;
}
.btn:hover { filter: brightness(1.08); border-color: var(--accent); }
.btn:active { filter: brightness(.96); }
.btn.hidden { display: none; }
.btn.primary { background: var(--accent); color: #fff; border: none; }
.btn.primary:hover { filter: brightness(1.1); box-shadow: 0 2px 10px rgba(230, 126, 34, .4); }
.btn.danger { background: #c0392b; color: #fff; border: none; }
.btn.danger:hover { filter: brightness(1.1); box-shadow: 0 2px 10px rgba(192, 57, 43, .35); }
.btn.ghost { background: transparent; color: var(--muted); border-color: transparent; }
.btn.ghost:hover { filter: none; color: var(--text); border-color: var(--border); }
.btn.sm, .btn.small { padding: 5px 12px; font-size: .82em; }
.icon-btn {
  background: transparent; border: 1px solid var(--border); border-radius: 6px;
  cursor: pointer; padding: 4px 8px; font-size: .9em; color: var(--text); flex-shrink: 0;
}
.icon-btn:hover { background: var(--panel-2); filter: brightness(1.2); }
.icon-btn.del:hover { color: #e74c3c; }

/* ===== brand — eye logo + flashlight wordmark ===== */
.brand-wrap { display: inline-flex; align-items: center; gap: 9px; direction: ltr; }
.brand-eye { height: 1.75em; width: auto; flex: 0 0 auto; display: block; overflow: visible; }
.brand-eye .eye-outline { fill: none; stroke: rgba(255, 255, 255, 0.66); stroke-width: 22; stroke-linejoin: round; stroke-linecap: round; }
.brand-eye .eye-wave { fill: none; stroke: #00A3E0; stroke-width: 16; stroke-linecap: round; }
.brand-eye .eye-pupil { fill: rgba(255, 255, 255, 0.66); }
.brand-eye .eye-pupil { animation: eyePupil 5s ease-in-out infinite; }
.brand-eye .eye-wave.w1 { animation: eyeWave1 5s ease-in-out infinite; }
.brand-eye .eye-wave.w2 { animation: eyeWave2 5s ease-in-out infinite; }
.brand-eye .eye-wave.w3 { animation: eyeWave3 5s ease-in-out infinite; }
@keyframes eyePupil {
  0%, 100% { fill: rgba(255, 255, 255, 0.66); filter: none; }
  3%       { fill: #ffffff; filter: drop-shadow(0 0 3px #7fe0ff); }
  11%      { fill: rgba(255, 255, 255, 0.66); filter: none; }
}
@keyframes eyeWave1 {
  0%, 1%, 16%, 100% { stroke: #00A3E0; filter: none; }
  8%                { stroke: #eafcff; filter: drop-shadow(0 0 3px #7fe0ff); }
}
@keyframes eyeWave2 {
  0%, 8%, 22%, 100% { stroke: #00A3E0; filter: none; }
  14%               { stroke: #eafcff; filter: drop-shadow(0 0 3px #7fe0ff); }
}
@keyframes eyeWave3 {
  0%, 14%, 26%, 100% { stroke: #00A3E0; filter: none; }
  20%                { stroke: #eafcff; filter: drop-shadow(0 0 3px #7fe0ff); }
}
.brand { font-family: 'Audiowide', 'Segoe UI', sans-serif; font-weight: 400; font-size: 1.4em; letter-spacing: 2px; color: #fff; }
header .brand, .auth-brand .brand {
  background: linear-gradient(100deg,
      rgba(255,255,255,0.66) 0%, rgba(255,255,255,0.66) 42%,
      #ffffff 49%, #ffffff 51%,
      rgba(255,255,255,0.66) 58%, rgba(255,255,255,0.66) 100%);
  background-size: 300% 100%;
  background-position: 150% 0;
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: brand-flashlight 5s ease-in-out infinite;
}
@keyframes brand-flashlight {
  0%, 16% { background-position: 150% 0; }
  60%     { background-position: -50% 0; }
  100%    { background-position: -50% 0; }
}
@media (prefers-reduced-motion: reduce) {
  header .brand, .auth-brand .brand { animation: none; -webkit-text-fill-color: #fff; }
  .brand-eye .eye-pupil, .brand-eye .eye-wave { animation: none !important; }
}

/* ===== login ===== */
.auth-overlay {
  position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 20px;
  background: radial-gradient(1200px 600px at 50% -10%, var(--brand-a), var(--bg) 70%);
}
.auth-overlay[hidden] { display: none; }
:root.has-session .auth-overlay { display: none; }
.auth-card {
  width: min(400px, 94vw); background: var(--panel); border: 1px solid var(--border);
  border-radius: 16px; box-shadow: 0 24px 70px var(--shadow); padding: 28px 26px;
  display: flex; flex-direction: column; gap: 18px; margin: 0;
}
.auth-brand { display: flex; align-items: center; justify-content: center; gap: 12px; }
.auth-brand .brand-eye { width: 56px; height: auto; }
.auth-brand .brand { font-size: 1.5em; letter-spacing: .5px; color: var(--text); }
.auth-card h2 { text-align: center; font-size: 1.15em; }
.auth-card .btn.primary { padding: 12px; font-size: 1em; }
.auth-card label, .modal-box label { display: flex; flex-direction: column; gap: 5px; font-size: .85em; color: var(--muted); }
.auth-card input, .modal-box input {
  background: var(--input-bg); color: var(--text); border: 1px solid var(--border);
  border-radius: 9px; padding: 11px 12px; font-family: inherit; font-size: 1em;
}
.auth-card input:focus, .modal-box input:focus, .add-row input:focus, .add-user input:focus { outline: none; border-color: var(--accent); }
.msg { font-size: .85em; border-radius: 8px; padding: 8px 10px; line-height: 1.4; }
.msg[hidden] { display: none; }
.msg.err { background: color-mix(in srgb, var(--danger) 16%, var(--item)); color: #ff9b8f; border: 1px solid var(--danger); }

/* ===== header ===== */
header {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  min-height: 55px; padding: 12px 20px;
  background: linear-gradient(135deg, var(--brand-a), var(--brand-b));
  color: #fff; flex-shrink: 0;
}
.tag { font-size: .7em; text-transform: uppercase; letter-spacing: 1px; background: rgba(255, 255, 255, .18); padding: 2px 8px; border-radius: 20px; align-self: center; }
.head-tools { display: flex; align-items: center; gap: 14px; }
.admin-email, .user-email { color: rgba(255, 255, 255, .85); font-size: .88em; }
.pill-btn {
  background: rgba(255, 255, 255, .18); color: #fff; border: none; cursor: pointer;
  font-weight: 700; font-size: .8em; padding: 5px 12px; border-radius: 12px;
}
.pill-btn:hover { background: rgba(255, 255, 255, .3); }
.user-wrap { position: relative; display: inline-flex; }
.user-menu {
  position: absolute; top: calc(100% + 8px); inset-inline-end: 0; z-index: 150;
  min-width: 200px; background: var(--panel); border: 1px solid var(--border);
  border-radius: 10px; box-shadow: 0 12px 34px var(--shadow); padding: 8px;
  display: flex; flex-direction: column; gap: 4px;
}
.user-menu[hidden] { display: none; }
.user-info { padding: 6px 8px 8px; border-bottom: 1px solid var(--border); margin-bottom: 4px; display: flex; flex-direction: column; gap: 2px; }
.user-info strong { color: var(--text); font-size: .92em; }
.user-info span { color: var(--muted); font-size: .8em; overflow: hidden; text-overflow: ellipsis; }
.user-menu button {
  background: none; border: none; text-align: start; color: var(--text);
  padding: 8px; border-radius: 7px; cursor: pointer; font: inherit; font-size: .88em;
}
.user-menu button:hover { background: var(--item); }

/* ===== panels ===== */
.panel { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 16px; }
.panel-head { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; cursor: pointer; user-select: none; }
.panel-head h2 { font-size: 1.02em; color: var(--text); }
.panel-collapse {
  margin-left: auto; flex-shrink: 0; background: transparent; border: 0; color: var(--muted);
  cursor: pointer; font-size: 1.1em; line-height: 1; padding: 4px; border-radius: 6px;
  display: inline-flex; align-items: center; justify-content: center; transition: transform .2s, color .15s;
  transform-origin: center; transform: rotate(180deg); /* open: arrow points up */
}
.panel-collapse:hover { color: var(--text); }
.panel-collapse .collapse-caret { display: block; transform-origin: center; }
.panel.collapsed .panel-collapse { transform: rotate(0deg); } /* closed: arrow points down */
.panel.collapsed .panel-head { margin-bottom: 0; }
.panel.collapsed > *:not(.panel-head) { display: none; }
/* tab / panel counter — matches the operator dashboard */
.count {
  color: var(--muted); font-weight: 700; font-size: .72rem;
  background: transparent; border: 1px solid var(--border); border-radius: 6px; padding: 1px 8px;
  position: relative; top: 2px;
}
.hint { color: var(--muted); font-size: .82em; }
.empty { color: var(--muted); font-size: .9em; padding: 20px 4px; text-align: center; }

/* ===== draggable splitter (side-by-side panels / management columns) ===== */
/* shared by the admin & technician consoles (.mgmt-resizer) and the operator
   dashboard's management columns + ops map/panel splitter (.splitter) */
.mgmt-resizer, .splitter {
  width: 16px; flex-shrink: 0; z-index: 5; align-self: stretch;
  display: flex; align-items: center; justify-content: center;
  cursor: col-resize; user-select: none;
}
.mgmt-resizer-line, .splitter-line {
  width: 3px; height: 48px; border-radius: 3px;
  background: var(--brand-b); transition: background .2s, height .2s;
}
.mgmt-resizer:hover .mgmt-resizer-line, .mgmt-resizer.active .mgmt-resizer-line,
.splitter:hover .splitter-line, .splitter.active .splitter-line { background: var(--muted); height: 72px; }
body.resizing { user-select: none; cursor: col-resize; }

/* ===== list search + sort toolbar ===== */
.list-tools { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; }
.list-tools[hidden] { display: none; }
.list-search {
  flex: 1; min-width: 0; background: var(--input-bg); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px; padding: 8px 11px; font: inherit; font-size: .9em;
}
.list-search:focus { outline: none; border-color: var(--accent); }
.list-sort {
  flex: 0 0 auto; width: 116px; box-sizing: border-box; background: var(--input-bg); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px; padding: 8px; font: inherit; font-size: .9em; cursor: pointer;
}
.list-sort:hover { border-color: var(--accent); filter: brightness(1.08); }
.list-sort:focus { outline: none; border-color: var(--accent); }

/* ===== generic list rows (companies / saved incidents / …) ===== */
.list { display: flex; flex-direction: column; gap: 8px; }
.row {
  display: flex; align-items: center; gap: 10px; background: var(--item);
  border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px;
}
.row.selected { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.row.clickable { cursor: pointer; transition: border-color .15s; }
.row.clickable:hover { border-color: var(--accent); }
.row .main { flex: 1; min-width: 0; cursor: pointer; }
.row .name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .sub { color: var(--muted); font-size: .8em; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .acts { display: flex; gap: 6px; flex-shrink: 0; flex-wrap: wrap; justify-content: flex-end; }

/* ===== modal ===== */
.modal-overlay {
  position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center;
  background: rgba(0, 0, 0, .55); padding: 20px;
}
.modal-overlay[hidden] { display: none; }
.modal-box {
  width: min(420px, 94vw); background: var(--panel); border: 1px solid var(--border);
  border-radius: 14px; box-shadow: 0 24px 70px var(--shadow); padding: 22px; display: flex; flex-direction: column; gap: 14px; margin: 0;
}
.modal-box h3 { font-size: 1.05em; }
.modal-box .hint { color: var(--muted); font-weight: 400; font-size: .85em; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 4px; }

/* ===== toasts ===== */
.toast-container {
  position: fixed; inset-block-end: 16px; inset-inline-end: 16px;
  display: flex; flex-direction: column; gap: 8px; z-index: 10001;
}
.toast {
  background: var(--panel); color: var(--text); border: 1px solid var(--border);
  border-inline-start: 4px solid var(--accent); border-radius: 8px;
  padding: 10px 16px; font-size: .9em; box-shadow: 0 8px 24px var(--shadow);
  animation: slidein .25s ease;
}
.toast.ok { border-inline-start-color: #27ae60; }
.toast.err { border-inline-start-color: #c0392b; }
@keyframes slidein { from { opacity: 0; transform: translateY(8px); } }

/* ===== themed confirm dialog ===== */
.overlay {
  position: fixed; inset: 0; background: rgba(0, 0, 0, .55);
  display: none; align-items: center; justify-content: center; z-index: 300;
}
.overlay.show { display: flex; }
.confirm-box {
  background: var(--panel); border: 1px solid var(--border); border-radius: 14px;
  width: min(380px, 92vw); padding: 20px; box-shadow: 0 20px 60px var(--shadow);
  display: flex; flex-direction: column; gap: 18px;
}
.confirm-msg { color: var(--text); font-size: 1em; line-height: 1.4; }
.confirm-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.confirm-actions .btn { min-width: 92px; }

/* ===== change-password / compact auth form (in a confirm-box) ===== */
.auth-form { display: flex; flex-direction: column; gap: 14px; margin: 0; }
.auth-form.compact { gap: 12px; }
.auth-form h2 { margin: 0; font-size: 1.15em; color: var(--text); text-align: center; }
.auth-form input {
  background: var(--input-bg); color: var(--text); border: 1px solid var(--border);
  border-radius: 9px; padding: 11px 12px; font-family: inherit; font-size: 1em;
}
.auth-form input:focus { outline: none; border-color: var(--accent); }
.auth-form .btn.primary { padding: 12px; font-size: 1em; }
