:root {
  --bg: #f3f6fc;
  --glow-1: rgba(0, 150, 255, 0.16);
  --glow-2: rgba(91, 61, 255, 0.10);
  --panel: #ffffff;
  --panel-2: #f5f7fb;
  --glass: rgba(255, 255, 255, 0.78);
  --text: #0f172a;
  --text-2: #334155;
  --muted: #64748b;
  --border: #e3e8f1;
  --border-strong: #cfd7e6;
  --accent: #1f5bff;
  --accent-soft: #e9efff;
  --grad: linear-gradient(135deg, #00b4ff 0%, #1f5bff 55%, #5b3dff 100%);
  --grad-danger: linear-gradient(135deg, #ff5a6e 0%, #e11d48 100%);
  --green: #059669;
  --green-soft: #e3f7ef;
  --amber: #b45309;
  --amber-soft: #fff4dc;
  --red: #e11d48;
  --red-soft: #ffe8ec;
  --radius: 16px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05), 0 1px 3px rgba(15, 23, 42, 0.04);
  --shadow: 0 10px 30px -12px rgba(15, 23, 42, 0.18), 0 2px 6px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 30px 80px -20px rgba(15, 23, 42, 0.45);
  --glow: 0 8px 22px -8px rgba(31, 91, 255, 0.65);
  --gutter: 24px;
  /* Page width: wide screens keep the content in a centered column. */
  --side: max(var(--gutter), calc((100% - 1360px) / 2));

  /* Icons (masked, so they take the text color). */
  --i-refresh: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'><path d='M21 12a9 9 0 1 1-2.64-6.36L21 8'/><path d='M21 3v5h-5'/></svg>");
  --i-trash: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M3 6h18M8 6V4.5A1.5 1.5 0 0 1 9.5 3h5A1.5 1.5 0 0 1 16 4.5V6M18.5 6l-.8 13.1a2 2 0 0 1-2 1.9H8.3a2 2 0 0 1-2-1.9L5.5 6M10 11v6M14 11v6'/></svg>");
  --i-star: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='m12 3 2.8 5.7 6.2.9-4.5 4.4 1.1 6.2L12 17.3l-5.6 2.9 1.1-6.2L3 9.6l6.2-.9z'/></svg>");
  --i-check: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'><path d='M20 6 9 17l-5-5'/></svg>");
  --i-undo: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M3 7v6h6'/><path d='M21 17a9 9 0 0 0-15-6.7L3 13'/></svg>");
  --i-external: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'><path d='M7 17 17 7M8 7h9v9'/></svg>");
  --i-logout: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4M16 17l5-5-5-5M21 12H9'/></svg>");
  --i-plus: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round'><path d='M12 5v14M5 12h14'/></svg>");
  --i-alert: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M10.3 3.9 1.8 18a2 2 0 0 0 1.7 3h17a2 2 0 0 0 1.7-3L13.7 3.9a2 2 0 0 0-3.4 0zM12 9v4M12 17h.01'/></svg>");
  --i-info: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'><circle cx='12' cy='12' r='9'/><path d='M12 16v-4M12 8h.01'/></svg>");
  --i-link: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M10 13a5 5 0 0 0 7.5.5l3-3a5 5 0 0 0-7-7l-1.7 1.7'/><path d='M14 11a5 5 0 0 0-7.5-.5l-3 3a5 5 0 0 0 7 7l1.7-1.7'/></svg>");
  --i-inbox: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'><path d='M22 12h-6l-2 3h-4l-2-3H2'/><path d='M5.5 5.1 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.5-6.9A2 2 0 0 0 16.8 4H7.2a2 2 0 0 0-1.7 1.1z'/></svg>");
  --i-chevron: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'><path d='m6 9 6 6 6-6'/></svg>");
  --i-close: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round'><path d='M18 6 6 18M6 6l12 12'/></svg>");
  --i-sliders: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'><path d='M4 6h9M17 6h3M4 12h3M11 12h9M4 18h11M19 18h1'/><circle cx='15' cy='6' r='2'/><circle cx='9' cy='12' r='2'/><circle cx='17' cy='18' r='2'/></svg>");
  --i-search-muted: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.2' stroke-linecap='round'><circle cx='11' cy='11' r='7'/><path d='m20 20-3.5-3.5'/></svg>");
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a0e1a;
    --glow-1: rgba(0, 140, 255, 0.18);
    --glow-2: rgba(110, 70, 255, 0.14);
    --panel: #121829;
    --panel-2: #0e1322;
    --glass: rgba(14, 19, 34, 0.72);
    --text: #e7ecf6;
    --text-2: #c3cbdb;
    --muted: #8a94ab;
    --border: #1f2740;
    --border-strong: #2c3757;
    --accent: #5b8cff;
    --accent-soft: rgba(91, 140, 255, 0.14);
    --green: #34d399;
    --green-soft: rgba(52, 211, 153, 0.12);
    --amber: #fbbf24;
    --amber-soft: rgba(251, 191, 36, 0.12);
    --red: #fb7185;
    --red-soft: rgba(251, 113, 133, 0.13);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow: 0 14px 34px -14px rgba(0, 0, 0, 0.7), 0 2px 6px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 30px 90px -20px rgba(0, 0, 0, 0.85);
    color-scheme: dark;
  }
}

/* --- Base ----------------------------------------------------------------------- */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 "Inter", "Segoe UI Variable Text", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
/* Soft color glows behind everything (a fixed layer, since iOS ignores background-attachment: fixed). */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(900px 520px at 8% -8%, var(--glow-1), transparent 65%),
    radial-gradient(800px 480px at 100% 0%, var(--glow-2), transparent 60%),
    radial-gradient(700px 500px at 50% 110%, var(--glow-2), transparent 60%);
}
html:has(.modal[open]) { overflow: hidden; }
h1, h2, h3 { margin: 0; letter-spacing: -0.015em; }
h1 { font-size: 19px; font-weight: 750; }
h2 { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); }
.muted { color: var(--muted); }
.grad-text { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
button, select, input { font: inherit; color: inherit; }
a { color: var(--accent); }
::selection { background: color-mix(in srgb, var(--accent) 25%, transparent); }

/* --- Buttons and fields ---------------------------------------------------------- */
button {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 38px; padding: 0 14px; border-radius: 11px; border: 1px solid var(--border);
  background: var(--panel); color: var(--text); font-weight: 550; cursor: pointer; white-space: nowrap;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, box-shadow 0.2s ease, border-color 0.2s ease, background-color 0.2s ease, color 0.2s ease, filter 0.2s ease;
}
button:hover { border-color: var(--border-strong); background: var(--panel-2); }
button:active { transform: scale(0.97); }
button:disabled { opacity: 0.6; cursor: progress; transform: none; }
button.primary { background: var(--grad); border-color: transparent; color: #fff; font-weight: 650; box-shadow: var(--glow); }
button.primary:hover { filter: brightness(1.08) saturate(1.1); box-shadow: 0 12px 28px -10px rgba(31, 91, 255, 0.75); }
button.soft { background: var(--accent-soft); border-color: transparent; color: var(--accent); font-weight: 650; box-shadow: none; }
button.soft:hover { background: color-mix(in srgb, var(--accent) 20%, transparent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Masked icons in front of a label (or alone). */
#run::before, #logout::before, #connect-upwork::before, .job-actions button::before, .add-box summary::before,
.ft-icon, .ft-arrow, .modal-icon::before, .run-result .close::before, .empty::before {
  content: ""; flex: none; width: 16px; height: 16px; background-color: currentColor;
  -webkit-mask: var(--icon) center / contain no-repeat; mask: var(--icon) center / contain no-repeat;
}
#run { --icon: var(--i-refresh); }
#run:disabled::before { animation: spin 0.9s linear infinite; }
#logout { --icon: var(--i-logout); }
#connect-upwork { --icon: var(--i-link); }

input[type="search"], input[type="text"], input[type="url"], input[type="password"], input[type="date"] {
  height: 40px; padding: 0 12px; border: 1px solid var(--border); border-radius: 11px;
  background: var(--panel-2); color: var(--text); width: 100%; min-width: 0;
  transition: border-color 0.2s, box-shadow 0.2s, background-color 0.2s;
}
input::placeholder { color: var(--muted); opacity: 0.85; }
input:hover { border-color: var(--border-strong); }
input:focus { outline: none; border-color: var(--accent); background: var(--panel); box-shadow: 0 0 0 4px var(--accent-soft); }
input[type="search"] { padding-left: 40px; background: var(--i-search-muted) 13px center / 17px no-repeat, var(--panel-2); }
input[type="search"]:focus { background: var(--i-search-muted) 13px center / 17px no-repeat, var(--panel); }

/* --- Header ---------------------------------------------------------------------- */
.topbar {
  display: flex; flex-wrap: wrap; gap: 14px; align-items: center; justify-content: space-between;
  padding: 14px var(--side); position: sticky; top: 0; z-index: 10;
  background: var(--glass); -webkit-backdrop-filter: saturate(180%) blur(18px); backdrop-filter: saturate(180%) blur(18px);
  border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
}
.brand { display: flex; gap: 12px; align-items: center; min-width: 0; }
.brand p { margin: 1px 0 0; font-size: 12px; }
.logo {
  display: block; width: 42px; height: 42px; padding: 6px; flex: none;
  background: var(--panel); border: 1px solid var(--border); border-radius: 13px; box-shadow: var(--shadow-sm);
}
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* --- Status cards (last scan, next scan, scheduler) ----------------------------- */
.notice {
  margin: 18px var(--side) 0; font-size: 13px; color: var(--muted);
  display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px;
}
.notice .sched-item {
  display: flex; flex-direction: column; gap: 2px; padding: 11px 14px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-sm);
}
.notice .sched-item > .muted { font-size: 11px; font-weight: 650; text-transform: uppercase; letter-spacing: 0.06em; }
.notice strong { color: var(--text); font-weight: 650; font-size: 13.5px; }
.notice .sched-item.busy { grid-column: 1 / -1; background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 30%, transparent); }
.notice .sched-item.busy > .muted::before {
  content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 7px; border-radius: 50%;
  background: var(--accent); vertical-align: 1px; animation: pulse 1.4s ease-in-out infinite;
}
.notice .sched-item.busy strong { color: var(--accent); }
.notice .sched-item.warn { grid-column: 1 / -1; background: var(--amber-soft); border-color: color-mix(in srgb, var(--amber) 35%, transparent); }
.notice .sched-item.warn, .notice .sched-item.warn strong, .notice .sched-item.warn .muted { color: var(--amber); }

/* --- Search result banner -------------------------------------------------------- */
.run-result {
  position: relative; margin: 14px var(--side) 0; padding: 14px 48px 14px 18px; font-size: 13px;
  background: var(--panel); border: 1px solid var(--border); border-left: 4px solid var(--accent);
  border-radius: 14px; box-shadow: var(--shadow); animation: slide-in 0.3s ease;
}
.run-result.error { border-color: color-mix(in srgb, var(--red) 40%, transparent); border-left-color: var(--red); background: var(--red-soft); }
.run-result ul { margin: 6px 0 0; padding-left: 18px; color: var(--text-2); }
.run-result .warn { color: var(--amber); }
.run-result .err { color: var(--red); }
.run-result .close {
  --icon: var(--i-close); position: absolute; top: 10px; right: 10px; width: 30px; height: 30px; padding: 0;
  border: 0; background: transparent; box-shadow: none; color: var(--muted); border-radius: 9px;
}
.run-result .close::before { width: 14px; height: 14px; }
.run-result .close:hover { background: var(--panel-2); color: var(--text); }

/* --- Layout ---------------------------------------------------------------------- */
.layout { display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 22px; padding: 20px var(--side) 56px; }
/* Grid children default to min-width:auto; without this, long rows stretch the page sideways. */
.layout > * { min-width: 0; }

/* --- Filters sidebar ------------------------------------------------------------- */
.sidebar {
  background: var(--panel); border: 1px solid var(--border); border-radius: 20px; padding: 16px; box-shadow: var(--shadow);
  align-self: start; position: sticky; top: 92px; max-height: calc(100vh - 110px); overflow: auto; scrollbar-width: thin;
}
.sidebar-title { padding: 2px 6px 0; }
.sidebar ul { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 4px; }
.sidebar li { border-radius: 13px; transition: background-color 0.2s, box-shadow 0.2s; }
.sidebar li button.pick {
  width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 10px; height: auto; min-height: 40px;
  border: 0; background: transparent; box-shadow: none; text-align: left; padding: 9px 12px; color: inherit; white-space: normal; font-weight: 600;
}
.sidebar li button.pick:active { transform: none; }
.sidebar li:hover { background: var(--panel-2); }
.sidebar li.active { background: var(--grad); box-shadow: var(--glow); }
.sidebar li.active button.pick, .sidebar li.active .count, .sidebar li.active .tools, .sidebar li.active .tools a, .sidebar li.active .tools button { color: #fff; }
.sidebar li button.pick.disabled .name { color: var(--muted); text-decoration: line-through; }
.sidebar .tools { display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: center; padding: 0 12px 9px; font-size: 12px; }
.sidebar .tools a { color: var(--accent); text-decoration: none; font-weight: 600; }
.sidebar .tools a:hover { text-decoration: underline; }
.sidebar .tools .warn { color: var(--amber); }
.sidebar .sched { padding: 0 12px 4px; margin-top: -4px; font-size: 11.5px; color: var(--muted); }
.sidebar .sched .warn { color: var(--amber); }
.sidebar li.active .sched, .sidebar li.active .sched .warn, .sidebar li.active .tools .warn { color: rgba(255, 255, 255, 0.85); }
button.link { border: 0; background: none; box-shadow: none; padding: 0; height: auto; font-size: 12px; font-weight: 600; cursor: pointer; }
button.link:hover { background: none; text-decoration: underline; }
button.link.danger { color: var(--red); }
.sidebar li.active button.link.danger { color: #fff; opacity: 0.9; }
.count { font-size: 12px; color: var(--muted); white-space: nowrap; font-weight: 500; }
.count b { display: inline-block; padding: 1px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.sidebar li.active .count b { background: rgba(255, 255, 255, 0.22); color: #fff; }

.add-box { margin-top: 14px; }
.add-box summary {
  --icon: var(--i-plus); list-style: none; display: flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; padding: 8px 12px; border: 1.5px dashed var(--border-strong); border-radius: 13px;
  cursor: pointer; font-weight: 650; color: var(--accent); transition: background-color 0.2s, border-color 0.2s;
}
.add-box summary::-webkit-details-marker { display: none; }
.add-box summary:hover { background: var(--accent-soft); border-color: var(--accent); }
.add-box[open] summary { border-style: solid; background: var(--accent-soft); border-color: transparent; }
.add-box[open] summary::before { transform: rotate(45deg); }
.add-box summary::before { transition: transform 0.2s; }
.add-box form { display: grid; gap: 7px; margin-top: 12px; }
.add-box label { font-size: 12px; font-weight: 600; color: var(--muted); }
.add-box button[type="submit"] { margin-top: 4px; height: 42px; }
.add-msg { margin: 4px 0 0; font-size: 12px; }
.add-msg.err { color: var(--red); }

/* --- Toolbar: search, date, review state ---------------------------------------- */
.toolbar {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 18px; padding: 12px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow);
}
.toolbar input[type="search"] { flex: 1 1 240px; width: auto; }
.datepick { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.datepick label { font-size: 12px; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.datepick input[type="date"] { width: auto; }
.day-buttons { display: flex; gap: 6px; }
.day-buttons button { height: 40px; background: var(--panel-2); box-shadow: none; }
.day-buttons #day-clear { color: var(--accent); background: var(--accent-soft); border-color: transparent; }
.segmented { display: inline-flex; gap: 2px; padding: 4px; border-radius: 13px; background: var(--panel-2); border: 1px solid var(--border); }
.segmented button { height: 32px; border: 0; border-radius: 9px; background: transparent; box-shadow: none; color: var(--muted); padding: 0 14px; }
.segmented button:hover { color: var(--text); background: transparent; }
.segmented button.active { background: var(--panel); color: var(--accent); font-weight: 700; box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08), 0 4px 12px -4px rgba(15, 23, 42, 0.15); }

.list-title { margin: 0 0 12px; font-size: 20px; font-weight: 750; text-transform: none; letter-spacing: -0.02em; color: var(--text); }
.day {
  display: flex; align-items: center; gap: 10px; margin: 22px 0 2px; font-size: 13px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-2);
}
.day::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, var(--border-strong), transparent); }
.day:first-child { margin-top: 0; }
.day .muted { font-weight: 600; font-size: 12px; text-transform: none; letter-spacing: 0; }

/* --- Job cards ------------------------------------------------------------------- */
.jobs { display: grid; gap: 12px; }
.job {
  position: relative; overflow-wrap: anywhere;
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px;
  box-shadow: var(--shadow-sm); transition: transform 0.2s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}
@media (hover: hover) {
  .job:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--accent) 35%, var(--border)); }
}
/* Just found: a gradient frame. */
.job.fresh { border: 1.5px solid transparent; background: linear-gradient(var(--panel), var(--panel)) padding-box, linear-gradient(135deg, #10b981, #00b4ff 50%, #1f5bff) border-box; }
.job-head { display: flex; gap: 12px; justify-content: space-between; align-items: flex-start; }
.title { font-weight: 700; font-size: 16px; line-height: 1.4; letter-spacing: -0.01em; color: var(--text); text-decoration: none; }
.title[href]:hover { color: var(--accent); }
.badges { display: flex; flex-wrap: wrap; gap: 5px; justify-content: flex-end; flex: none; max-width: 45%; }
.badge {
  display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent); white-space: nowrap; text-transform: capitalize;
}
.badge.ok { background: var(--green-soft); color: var(--green); }
.badge.ok::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; animation: pulse 1.6s ease-in-out infinite; }
.badge.muted { background: var(--panel-2); color: var(--muted); border: 1px solid var(--border); }
.badge.err { background: var(--red-soft); color: var(--red); }
.pill[hidden] { display: none; }
.meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; font-size: 12.5px; color: var(--muted); }
.meta > span { padding: 4px 10px; border-radius: 9px; background: var(--panel-2); border: 1px solid var(--border); }
.meta strong { color: var(--text); font-weight: 650; }
.meta > span:first-child { background: var(--green-soft); border-color: transparent; color: var(--green); }
.meta > span:first-child strong { color: var(--green); }
.snippet { margin: 12px 0 0; color: var(--text-2); line-height: 1.6; }
.snippet:empty { display: none; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.chips:empty { display: none; }
.chip { font-size: 11.5px; font-weight: 550; padding: 3px 10px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--border); color: var(--text-2); }
.chip.filter { background: var(--accent-soft); border-color: transparent; color: var(--accent); font-weight: 700; }

.job-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 16px; padding-top: 14px; border-top: 1px dashed var(--border); }
.job-actions button { height: 36px; font-size: 13px; padding: 0 13px; background: var(--panel-2); box-shadow: none; }
.job-actions button::before { width: 15px; height: 15px; }
.job-actions [data-act="saved"] { --icon: var(--i-star); }
.job-actions [data-act="saved"]:hover { color: var(--amber); background: var(--amber-soft); border-color: transparent; }
.job-actions [data-act="reviewed"] { --icon: var(--i-check); }
.job-actions [data-act="reviewed"]:hover { color: var(--green); background: var(--green-soft); border-color: transparent; }
.job-actions [data-act="new"] { --icon: var(--i-undo); }
.job-actions [data-act="new"]:hover { color: var(--accent); background: var(--accent-soft); border-color: transparent; }
.job-actions button.delete { --icon: var(--i-trash); color: var(--red); }
.job-actions button.delete:hover { background: var(--red-soft); border-color: transparent; }
.job-actions .open {
  margin-left: auto; display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 16px;
  border-radius: 11px; background: var(--grad); color: #fff; font-size: 13px; font-weight: 650; text-decoration: none; box-shadow: var(--glow);
  transition: filter 0.2s, transform 0.15s;
}
.job-actions .open::after {
  content: ""; width: 14px; height: 14px; background: currentColor;
  -webkit-mask: var(--i-external) center / contain no-repeat; mask: var(--i-external) center / contain no-repeat;
}
.job-actions .open:hover { filter: brightness(1.08) saturate(1.1); }
.job-actions .open:active { transform: scale(0.97); }

.empty {
  --icon: var(--i-inbox); display: flex; flex-direction: column; align-items: center; gap: 12px;
  padding: 48px 24px; text-align: center; border: 1.5px dashed var(--border-strong); border-radius: 20px;
  color: var(--muted); background: color-mix(in srgb, var(--panel) 70%, transparent);
}
.empty::before { width: 44px; height: 44px; color: var(--accent); opacity: 0.7; }

/* --- Log in ---------------------------------------------------------------------- */
.login { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 16px; }
.login-box {
  width: min(380px, 100%); display: grid; gap: 8px; padding: 32px 28px 28px; text-align: left;
  background: var(--panel); border: 1px solid var(--border); border-radius: 24px; box-shadow: var(--shadow-lg);
  animation: pop 0.35s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
.login-box .logo { width: 56px; height: 56px; padding: 8px; border-radius: 16px; margin-bottom: 8px; }
.login-box h1 { font-size: 24px; }
.login-sub { margin: 0 0 14px; font-size: 13.5px; }
.login-box label { font-size: 12px; font-weight: 650; color: var(--muted); }
.login-box input { height: 44px; }
.login-box button { height: 46px; margin-top: 6px; font-size: 15px; }

/* --- Connect Upwork panel -------------------------------------------------------- */
.connect-panel {
  margin: 14px var(--side) 0; padding: 18px 20px; border-radius: 18px; box-shadow: var(--shadow);
  border: 1.5px solid transparent; background: linear-gradient(var(--panel), var(--panel)) padding-box, var(--grad) border-box;
}
.connect-panel h2 { margin: 0 0 8px; color: var(--accent); }
.connect-panel ol { margin: 0 0 14px; padding-left: 20px; font-size: 14px; line-height: 1.6; color: var(--text-2); }
.connect-panel code { font-size: 12px; padding: 1px 6px; border-radius: 6px; background: var(--panel-2); border: 1px solid var(--border); }
.connect-panel form { display: flex; gap: 8px; flex-wrap: wrap; }
.connect-panel input { flex: 1 1 320px; width: auto; }

/* --- Centered dialog (confirmations and errors) ---------------------------------- */
.modal {
  position: fixed; inset: 0; margin: auto; width: min(420px, calc(100% - 32px)); height: fit-content;
  max-height: calc(100% - 32px); padding: 0; overflow: auto; border: 1px solid var(--border); border-radius: 24px;
  background: var(--panel); color: var(--text); box-shadow: var(--shadow-lg);
}
.modal::backdrop { background: rgba(5, 9, 20, 0.55); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.modal[open] { animation: pop 0.28s cubic-bezier(0.2, 0.9, 0.3, 1.25); }
.modal[open]::backdrop { animation: fade 0.2s ease; }
.modal-box { display: flex; flex-direction: column; align-items: center; padding: 30px 24px 22px; text-align: center; }
.modal-icon {
  --icon: var(--i-info); display: grid; place-items: center; width: 60px; height: 60px; margin-bottom: 16px; border-radius: 50%;
  color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 8px color-mix(in srgb, var(--accent-soft) 50%, transparent);
}
.modal-icon::before { width: 28px; height: 28px; }
.modal[data-tone="danger"] .modal-icon { --icon: var(--i-trash); color: var(--red); background: var(--red-soft); box-shadow: 0 0 0 8px color-mix(in srgb, var(--red-soft) 50%, transparent); }
.modal[data-tone="error"] .modal-icon { --icon: var(--i-alert); color: var(--amber); background: var(--amber-soft); box-shadow: 0 0 0 8px color-mix(in srgb, var(--amber-soft) 50%, transparent); }
.modal h2 { font-size: 19px; font-weight: 750; text-transform: none; letter-spacing: -0.015em; color: var(--text); overflow-wrap: anywhere; }
.modal p { margin: 8px 0 0; color: var(--muted); font-size: 14px; line-height: 1.55; white-space: pre-line; overflow-wrap: anywhere; }
.modal-actions { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 10px; width: 100%; margin-top: 24px; }
.modal-actions button { height: 46px; font-size: 14.5px; border-radius: 13px; }
.modal[data-tone="danger"] #modal-ok { background: var(--grad-danger); box-shadow: 0 8px 22px -8px rgba(225, 29, 72, 0.7); }

/* --- Jobs / Insights switch ------------------------------------------------------ */
/* Sits in the status row (#schedule), right after the "Every" card. */
.view-tabs { margin: 18px var(--side) 0; display: flex; align-items: stretch; }
.notice .view-tabs { margin: 0; }
.view-tabs .segmented { display: flex; width: 100%; align-items: center; background: var(--panel); box-shadow: var(--shadow-sm); border-radius: 14px; }
.view-tabs .segmented button { flex: 1 1 0; height: 100%; min-height: 40px; padding: 0 18px; font-size: 14px; }

/* --- Insights -------------------------------------------------------------------- */
.insights { padding: 16px var(--side) 56px; }
.ins-layout { display: grid; grid-template-columns: 270px minmax(0, 1fr); gap: 22px; align-items: start; }
.ins-layout > * { min-width: 0; }
.ins-main { display: grid; gap: 18px; min-width: 0; }
.ins-body { display: grid; gap: 18px; }
.up { color: var(--green); }
.down { color: var(--red); }
.accent { color: var(--accent); }

/* Missed-scan banner. */
.ins-alert {
  display: flex; align-items: center; gap: 12px; margin-bottom: 18px; padding: 12px 14px;
  background: var(--amber-soft); border: 1px solid color-mix(in srgb, var(--amber) 35%, transparent); border-radius: 14px; color: var(--amber);
  animation: slide-in 0.3s ease;
}
.ins-alert p { margin: 0; flex: 1; font-size: 13px; line-height: 1.5; }
.ins-alert strong { text-transform: uppercase; font-size: 11.5px; letter-spacing: 0.05em; }
.ins-alert-icon { flex: none; width: 18px; height: 18px; background: currentColor; -webkit-mask: var(--i-alert) center / contain no-repeat; mask: var(--i-alert) center / contain no-repeat; }
.ins-alert .review { height: 32px; border: 0; background: var(--amber); color: #fff; font-size: 12.5px; font-weight: 700; box-shadow: none; border-radius: 999px; }
.ins-alert .review:hover { background: var(--amber); filter: brightness(1.08); }
.ins-alert .close {
  flex: none; width: 30px; height: 30px; padding: 0; border: 0; background: transparent; box-shadow: none; color: inherit;
}
.ins-alert .close::before { content: ""; width: 14px; height: 14px; background: currentColor; -webkit-mask: var(--i-close) center / contain no-repeat; mask: var(--i-close) center / contain no-repeat; }

/* Configured filters. */
.ins-side {
  background: var(--panel); border: 1px solid var(--border); border-radius: 20px; padding: 16px; box-shadow: var(--shadow);
  position: sticky; top: 16px;
}
.ins-side-head { display: flex; align-items: center; justify-content: space-between; padding: 2px 4px 0; }
.ins-side-head h2 { color: var(--text); font-size: 12px; }
.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--border); font-size: 11.5px; font-weight: 700; color: var(--text-2); white-space: nowrap; }
.ins-filters { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 10px; }
.ins-filters li { border: 1px solid var(--border); border-radius: 14px; background: var(--panel); transition: background-color 0.2s, box-shadow 0.2s; }
.ins-filters li:hover { border-color: var(--border-strong); }
.ins-filters li button.pick {
  width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 10px; height: auto;
  border: 0; background: transparent; box-shadow: none; text-align: left; padding: 11px 12px 4px; color: var(--text); font-weight: 700; white-space: normal;
}
.ins-filters li button.pick:active { transform: none; }
.ins-filters .pill { background: var(--accent-soft); border-color: transparent; color: var(--accent); }
.ins-filters .meta-line { display: flex; justify-content: space-between; gap: 8px; padding: 0 12px 10px; font-size: 11.5px; color: var(--muted); }
.ins-filters .meta-line strong { color: var(--text-2); }
.ins-filters .tools { padding: 0 12px 10px; margin-top: -4px; font-size: 12px; }
.ins-filters .tools a { font-weight: 650; text-decoration: none; }
.ins-filters li.active { background: var(--grad); border-color: transparent; box-shadow: var(--glow); }
.ins-filters li.active button.pick, .ins-filters li.active .meta-line, .ins-filters li.active .meta-line strong, .ins-filters li.active .tools a { color: #fff; }
.ins-filters li.active .pill { background: rgba(255, 255, 255, 0.22); color: #fff; }

/* Toolbar. */
.ins-toolbar { margin: 0; gap: 10px 12px; }
.ins-select { display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 6px 0 12px; border: 1px solid var(--border); border-radius: 11px; background: var(--panel-2); }
.ins-select-label { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.ins-select select { height: 34px; border: 0; background: transparent; font-weight: 700; color: var(--text); cursor: pointer; min-width: 0; max-width: 220px; }
.ins-select select:focus { outline: none; }
.ins-select:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.ins-range-pills { display: flex; gap: 4px; margin-left: auto; flex-wrap: wrap; }
.ins-range-pills button { height: 36px; border: 0; background: transparent; box-shadow: none; color: var(--text-2); padding: 0 12px; }
.ins-range-pills button.on { background: var(--grad); color: #fff; font-weight: 700; box-shadow: var(--glow); }
.ins-toolbar input[type="date"] { width: auto; height: 38px; }

/* Section cards. */
.ins-card {
  min-width: 0; padding: 22px; background: var(--panel); border: 1px solid var(--border);
  border-radius: 20px; box-shadow: var(--shadow); scroll-margin-top: 16px;
}
.ins-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.ins-title { flex: 1 1 320px; min-width: 0; }
.ins-title h3 { display: flex; align-items: center; gap: 10px; font-size: 18px; font-weight: 750; }
.ins-title p { margin: 6px 0 0; font-size: 13px; line-height: 1.5; max-width: 640px; }
.ins-num { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; background: var(--accent-soft); color: var(--accent); font-size: 13px; font-weight: 800; }
.ins-head-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.ins-head-tools.col { flex-direction: column; align-items: flex-end; }
.ins-date { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 4px 0 12px; border: 1px solid var(--border); border-radius: 11px; background: var(--panel-2); }
.ins-date span { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); white-space: nowrap; }
.ins-date input[type="date"] { width: auto; height: 34px; border: 0; background: transparent; padding: 0 6px; font-weight: 650; }
.ins-date input[type="date"]:focus { box-shadow: none; background: transparent; }
.ins-date:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.ins-check { display: inline-flex; align-items: center; gap: 7px; height: 38px; padding: 0 12px; border: 1px solid var(--border); border-radius: 11px; font-size: 13px; font-weight: 600; cursor: pointer; }
.ins-check input { width: 16px; height: 16px; accent-color: var(--accent); margin: 0; }

/* KPI tiles. */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.kpi {
  display: flex; flex-direction: column; gap: 4px; min-width: 0; padding: 16px;
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 16px;
}
.kpi.hero { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 25%, transparent); }
.kpi-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.kpi-value { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; color: var(--text); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; line-height: 1.15; }
.kpi.hero .kpi-value { color: var(--accent); font-size: 32px; }
.kpi-sub { font-size: 12px; color: var(--muted); font-weight: 550; }
.kpi-sub.up { color: var(--green); }
.kpi-sub.down { color: var(--red); }
.kpi-sub.dot-amber { color: var(--text-2); }
.kpi-sub.dot-amber::first-letter { color: var(--amber); }

/* Chart panels. */
.ins-panel { margin-top: 18px; padding: 18px; border: 1px solid var(--border); border-radius: 16px; background: var(--panel); scroll-margin-top: 16px; }
.panel-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.panel-head h4 { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 0; font-size: 13.5px; font-weight: 750; color: var(--text); text-transform: uppercase; letter-spacing: 0.02em; }
.panel-head h4 .chip { text-transform: none; letter-spacing: 0; }
.panel-head p { margin: 4px 0 0; font-size: 12px; }
.panel-head .segmented button { height: 34px; padding: 0 12px; font-size: 12.5px; }
.legend-inline { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12px; font-weight: 600; color: var(--text-2); }
.lg::before { content: ""; display: inline-block; width: 10px; height: 10px; margin-right: 6px; border-radius: 50%; vertical-align: -1px; background: var(--accent); }
.lg-cmp::before { background: color-mix(in srgb, var(--muted) 45%, var(--panel)); }
.readout { margin: 0 0 10px; min-height: 21px; font-size: 13px; color: var(--text-2); }

/* Hourly bars. */
.hbars { display: grid; grid-template-columns: repeat(24, minmax(0, 1fr)); gap: 6px; height: 190px; align-items: end; }
.hbar-col { display: grid; grid-template-rows: 1fr 18px; height: 100%; min-width: 0; border-radius: 6px; outline-offset: 1px; cursor: default; }
.hbar-col:hover { background: var(--panel-2); }
.hbar-track { display: flex; align-items: flex-end; justify-content: center; gap: 2px; height: 100%; }
.hbar { flex: 0 1 18px; min-width: 3px; border-radius: 5px 5px 2px 2px; background: color-mix(in srgb, var(--accent) 65%, var(--panel)); transition: height 0.3s ease; }
.hbar.cmp { background: color-mix(in srgb, var(--muted) 35%, var(--panel)); }
.hbar.zero { background: var(--border-strong); }
.hbar-col:hover .hbar:not(.cmp), .hbar-col:focus-visible .hbar:not(.cmp) { background: var(--accent); }
.hbar-col.peak .hbar:not(.cmp) { background: var(--accent); box-shadow: 0 6px 16px -6px var(--accent); }
.hbar-label { font-size: 9.5px; color: var(--muted); text-align: center; white-space: nowrap; overflow: hidden; align-self: end; font-weight: 600; }

/* Daily trend. */
.trend-info {
  display: grid; grid-template-columns: auto 1fr; gap: 10px 22px; align-items: center; margin-bottom: 16px; padding: 14px;
  border: 1px solid var(--border); border-radius: 14px; background: var(--panel-2);
}
.trend-range { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.trend-range .ins-date { background: var(--panel); }
.trend-stats { display: flex; flex-wrap: wrap; gap: 4px 22px; font-size: 13px; color: var(--text-2); }
.trend-stats p { margin: 0; }
.trend-info .hint { grid-column: 1 / -1; margin: 0; font-size: 12px; }
.dbars { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 10px; height: 230px; align-items: end; }
.dbars.dense { gap: 3px; }
.dbar-col {
  display: grid; grid-template-rows: 20px 1fr 36px; height: 100%; min-width: 0; padding: 0 1px;
  border: 0; border-radius: 10px; background: transparent; box-shadow: none; color: var(--text-2); font-weight: 600;
}
.dbar-col:hover, .dbar-col:focus-visible { background: var(--panel-2); }
.dbar-col:active { transform: none; }
.dbar-col.sel { background: var(--accent-soft); }
.dbar-val { font-size: 11.5px; color: var(--accent); font-variant-numeric: tabular-nums; font-weight: 700; }
.dbar-track { display: flex; align-items: flex-end; justify-content: center; gap: 2px; height: 100%; }
.dbar { flex: 0 1 52px; min-width: 3px; border-radius: 7px 7px 3px 3px; background: color-mix(in srgb, var(--accent) 65%, var(--panel)); transition: height 0.3s ease; }
.dbar.cmp { background: color-mix(in srgb, var(--muted) 35%, var(--panel)); }
.dbar.zero { background: var(--border-strong); }
.dbar-col:hover .dbar:not(.cmp), .dbar-col.sel .dbar:not(.cmp) { background: var(--accent); }
.dbar-col.peak .dbar:not(.cmp) { background: linear-gradient(180deg, #5b3dff, #1f5bff); }
.dbar-day { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; line-height: 1.2; overflow: hidden; }
.dbar-day strong { font-size: 12.5px; color: var(--text); }
.dbar-day span { font-size: 9.5px; color: var(--muted); letter-spacing: 0.04em; }
.dbars.dense .dbar-val { font-size: 9.5px; }
.dbars.dense .dbar-day strong { font-size: 10.5px; }
.dbars.dense .dbar-day span { display: none; }
.month-sum { margin: 0 0 12px; font-size: 13px; color: var(--text-2); }
.ins-panel .legend-inline { margin-top: 10px; }

/* Reliability matrix. */
.matrix { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; }
.mx { --c: var(--muted); --c-soft: var(--panel-2); display: flex; flex-direction: column; gap: 3px; min-width: 0; padding: 14px; border: 1px solid var(--border); border-radius: 14px; background: var(--panel-2); }
.mx-top { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.mx-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--c); }
.mx-dot.icon { width: 15px; height: 15px; border-radius: 0; background: var(--muted); -webkit-mask: var(--i-sliders) center / contain no-repeat; mask: var(--i-sliders) center / contain no-repeat; }
.mx .kpi-value { font-size: 26px; }
.mx .kpi-sub { color: var(--c); overflow-wrap: anywhere; }
.mx.st-total .kpi-sub { color: var(--muted); }
.mx.st-completed { border-color: color-mix(in srgb, var(--green) 30%, transparent); }
.mx.st-completed .kpi-value { color: var(--text); }
.mx.alert { background: var(--c-soft); border-color: color-mix(in srgb, var(--c) 45%, transparent); }
.mx.alert .kpi-value { color: var(--c); }
.mx.st-missed.alert { border-width: 2px; padding: 13px; }
.sla { display: inline-flex; align-items: center; height: 32px; padding: 0 12px; border-radius: 999px; font-size: 12.5px; font-weight: 750; white-space: nowrap; }
.sla.good { background: var(--green-soft); color: var(--green); }
.sla.warn { background: var(--amber-soft); color: var(--amber); }
.sla.bad { background: var(--red-soft); color: var(--red); }
.diag { margin-top: 16px; padding: 14px; border: 1px solid var(--border); border-radius: 14px; background: var(--panel-2); }
.diag-head { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 10px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; }
.diag-head .muted { text-transform: none; letter-spacing: 0; }
.diag-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.cause { padding: 11px 13px; border-radius: 12px; background: var(--panel); border: 1px solid color-mix(in srgb, var(--c) 35%, transparent); }
.cause strong { color: var(--c); font-size: 13px; }
.cause p { margin: 4px 0 0; font-size: 12px; color: var(--c); opacity: 0.9; line-height: 1.45; overflow-wrap: anywhere; }
.more-causes { align-self: center; margin: 0; font-size: 12px; }

/* Status labels: icon + word, never color alone. */
.st {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px 2px 3px; border-radius: 999px;
  font-size: 12px; font-weight: 700; white-space: nowrap; background: var(--panel-2); color: var(--muted);
}
.st-icon {
  display: inline-grid; place-items: center; width: 17px; height: 17px; border-radius: 50%;
  font-size: 10.5px; font-weight: 800; line-height: 1; background: currentColor;
}
.st .st-icon { color: #fff; }
.st-completed { --c: var(--green); --c-soft: var(--green-soft); }
.st-delayed { --c: #ea580c; --c-soft: color-mix(in srgb, #ea580c 12%, var(--panel)); }
.st-failed { --c: var(--amber); --c-soft: var(--amber-soft); }
.st-missed { --c: var(--red); --c-soft: var(--red-soft); }
.st-pending, .st-running { --c: var(--accent); --c-soft: var(--accent-soft); }
.st.st-completed, .st.st-delayed, .st.st-missed, .st.st-failed, .st.st-pending, .st.st-running { background: var(--c-soft); color: var(--c); }
.st .st-icon { background: var(--c); }
.st.st-missed .st-icon { background: transparent; color: var(--c); box-shadow: inset 0 0 0 1.5px var(--c); }

/* Schedule table. */
.pills { display: flex; flex-wrap: wrap; gap: 4px; padding: 4px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--border); }
.pill-btn { height: 30px; padding: 0 11px; border: 0; background: transparent; box-shadow: none; font-size: 12.5px; font-weight: 650; color: var(--text-2); border-radius: 9px; }
.pill-btn.p-missed { color: var(--red); }
.pill-btn.p-failed { color: var(--amber); }
.pill-btn.p-delayed { color: #ea580c; }
.pill-btn.p-completed { color: var(--green); }
.pill-btn.on { background: var(--panel); box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08), 0 4px 12px -4px rgba(15, 23, 42, 0.15); font-weight: 750; }
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 14px; -webkit-overflow-scrolling: touch; }
.ins-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.ins-table th {
  padding: 11px 12px; text-align: left; background: var(--panel-2); vertical-align: bottom;
  font-size: 10.5px; font-weight: 750; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); border-bottom: 1px solid var(--border);
}
.ins-table td { padding: 12px; border-bottom: 1px solid var(--border); vertical-align: middle; color: var(--text-2); }
.ins-table tr:last-child td { border-bottom: 0; }
.ins-table td.strong { font-weight: 750; color: var(--text); white-space: nowrap; }
.ins-table td.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 12px; white-space: nowrap; }
.ins-table tr.r-missed td.mono:nth-child(3) { color: var(--red); font-weight: 700; }
.ins-table .chips { margin: 0; gap: 4px; min-width: 130px; }
.ins-table .chip { font-size: 11px; padding: 2px 8px; font-weight: 650; }
.chip.bad { background: var(--red-soft); border-color: transparent; color: var(--red); }
.new-pill { display: inline-block; padding: 2px 9px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-weight: 750; font-size: 12px; white-space: nowrap; }
.ins-table button.inspect { font-size: 12.5px; color: var(--text); font-weight: 750; }
.ins-table .empty-row { padding: 28px; text-align: center; color: var(--muted); }
.detail-row td { background: var(--panel-2); padding: 0; }
.inspect-box { padding: 12px 16px; font-size: 12.5px; }
.inspect-box p { margin: 0 0 6px; color: var(--muted); }
.inspect-box ul { margin: 0; padding-left: 18px; display: grid; gap: 3px; }
.table-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 12px; font-size: 12.5px; }
.foot-right { display: flex; align-items: center; gap: 16px; }
.table-foot button.csv { font-size: 12.5px; color: var(--accent); }

/* Status row: scan health card. */
.notice .sched-item.health .health-sub { font-size: 11.5px; font-weight: 600; color: var(--red); }
.notice .sched-item.health.good strong { color: var(--green); }
.notice .sched-item.health.fair strong { color: var(--amber); }
.notice .sched-item.health.bad strong { color: var(--red); }

@media (max-width: 1100px) {
  .ins-layout { grid-template-columns: 1fr; }
  .ins-side { position: static; }
  .ins-filters { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
  .matrix { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 820px) {
  .view-tabs { margin: 14px max(var(--gutter), env(safe-area-inset-left)) 0; }
  .notice .view-tabs { margin: 0; grid-column: 1 / -1; }
  .insights { padding: 12px max(var(--gutter), env(safe-area-inset-right)) calc(100px + env(safe-area-inset-bottom)) max(var(--gutter), env(safe-area-inset-left)); }
  .ins-card { padding: 16px 14px; border-radius: 18px; }
  .ins-panel { padding: 14px 12px; }
  .ins-range-pills { margin-left: 0; }
  .hbars { gap: 2px; height: 160px; }
  .hbar-label { font-size: 8px; }
  .hbar-col:nth-child(odd) .hbar-label { visibility: hidden; }
  .dbars { gap: 4px; height: 200px; }
  .trend-info { grid-template-columns: 1fr; }
  .panel-head .segmented { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); width: 100%; }
  .panel-head .segmented button { padding: 0 6px; white-space: normal; line-height: 1.15; }
  .ins-head-tools, .ins-head-tools.col { justify-content: flex-start; align-items: flex-start; }
}
@media (max-width: 560px) {
  .ins-side { padding: 12px; }
  .ins-filters { grid-template-columns: 1fr; }
  .kpis { gap: 8px; }
  .kpi { padding: 12px; }
  .kpi-value { font-size: 20px; }
  .kpi.hero .kpi-value { font-size: 26px; }
  .matrix { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .ins-alert { flex-wrap: wrap; }
  .ins-alert p { flex-basis: calc(100% - 70px); }
  .ins-select { flex: 1 1 100%; }
  .ins-select select { max-width: none; flex: 1; }
  .ins-toolbar input[type="date"] { flex: 1; }
  .dbar-val { font-size: 9.5px; }
  .dbar-day span { display: none; }
  .hbar-col:not(:nth-child(6n + 1)) .hbar-label { visibility: hidden; }
}

/* --- Animations ------------------------------------------------------------------ */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.45; transform: scale(0.8); } }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(0.94); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes slide-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after, .modal::backdrop { animation: none !important; transition: none !important; }
}

/* Show more (phones only) and the folded filter list's button (phones only). */
.more { display: none; }
.filters-toggle { display: none; }
button, a, summary { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }

/* --- Tablets and phones: one column ------------------------------------------- */
@media (max-width: 820px) {
  :root { --gutter: 16px; --side: var(--gutter); }
  .layout {
    grid-template-columns: 1fr; gap: 14px;
    padding: 14px max(var(--gutter), env(safe-area-inset-right)) calc(40px + env(safe-area-inset-bottom)) max(var(--gutter), env(safe-area-inset-left));
  }
  .topbar { padding: max(12px, env(safe-area-inset-top)) max(var(--gutter), env(safe-area-inset-right)) 12px max(var(--gutter), env(safe-area-inset-left)); gap: 10px; }
  .brand { flex: 1 1 auto; }
  .brand > div { min-width: 0; }
  .notice, .run-result, .connect-panel { margin-left: max(var(--gutter), env(safe-area-inset-left)); margin-right: max(var(--gutter), env(safe-area-inset-right)); }
  .notice { margin-top: 14px; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .actions { margin-left: auto; }

  /* Filters fold behind one button; tapping it opens the full list. */
  .sidebar { position: static; max-height: none; padding: 0; overflow: hidden; border-radius: 18px; }
  .sidebar-title { display: none; }
  .filters-toggle {
    display: flex; align-items: center; gap: 10px; width: 100%; height: auto; min-height: 56px;
    padding: 10px 16px; border: 0; border-radius: 0; background: transparent; box-shadow: none; text-align: left;
  }
  .filters-toggle:active { transform: none; }
  .ft-icon {
    --icon: var(--i-sliders); width: 34px; height: 34px; border-radius: 11px; background: var(--grad);
    -webkit-mask: none; mask: none; position: relative; box-shadow: var(--glow);
  }
  .ft-icon::after {
    content: ""; position: absolute; inset: 8px; background: #fff;
    -webkit-mask: var(--i-sliders) center / contain no-repeat; mask: var(--i-sliders) center / contain no-repeat;
  }
  .ft-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
  .ft-current { flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: 8px; font-weight: 700; }
  .ft-current .ft-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .ft-current b { flex: none; font-size: 11.5px; padding: 2px 9px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }
  .ft-arrow { --icon: var(--i-chevron); width: 18px; height: 18px; color: var(--muted); transition: transform 0.2s; }
  .sidebar.open .ft-arrow { transform: rotate(180deg); }
  .filters-body { display: none; padding: 4px 10px 12px; border-top: 1px solid var(--border); }
  .sidebar.open .filters-body { display: block; animation: slide-in 0.2s ease; }
  .sidebar ul { margin-top: 8px; }
  .sidebar li button.pick { min-height: 46px; padding: 10px 12px; }
  .sidebar .sched { padding: 0 12px 4px; font-size: 12px; }
  .sidebar .tools { gap: 4px 18px; padding: 0 12px 8px; }
  .sidebar .tools a, .sidebar .tools button.link { display: inline-flex; align-items: center; min-height: 32px; font-size: 13px; }

  /* Search, date and tabs: full width, easy to tap. */
  .toolbar { gap: 10px; padding: 12px; margin-bottom: 14px; }
  .toolbar input[type="search"] { flex: 1 1 100%; width: 100%; height: 44px; }
  .datepick { width: 100%; flex-wrap: nowrap; }
  .datepick label { flex: none; }
  .datepick input[type="date"] { flex: 1 1 auto; min-width: 0; height: 42px; }
  .day-buttons { flex: none; }
  .day-buttons button { height: 42px; }
  .segmented { display: flex; width: 100%; }
  .segmented button { flex: 1 1 0; min-width: 0; height: 38px; padding: 0 6px; }

  /* Job cards: badges above the title, roomier buttons. */
  .job { padding: 16px; }
  .job-head { flex-direction: column; gap: 8px; }
  .badges { order: -1; justify-content: flex-start; max-width: none; }
  .badges:empty { display: none; }
  .job-actions button { height: 42px; }
  .job-actions .open { margin-left: 0; }

  /* Inputs at 16px: iPhones zoom the page into any smaller field. */
  input, select, textarea { font-size: 16px !important; }
  button, select { min-height: 40px; }
  button.link, .run-result .close { min-height: 0; }
}

/* --- Phones ---------------------------------------------------------------------- */
@media (max-width: 560px) {
  h1 { font-size: 18px; }
  .brand p { font-size: 11.5px; line-height: 1.4; }
  .logo { width: 38px; height: 38px; padding: 5px; border-radius: 12px; }

  /* Header: brand and a round log-out button on one row; "Search now" floats at the bottom. */
  .topbar { flex-wrap: wrap; -webkit-backdrop-filter: none; backdrop-filter: none; background: var(--glass); position: static; }
  .brand { flex: 1 1 0; align-items: flex-start; }
  .actions { display: contents; }
  #logout { order: 2; width: 42px; height: 42px; padding: 0; font-size: 0; gap: 0; border-radius: 13px; }
  #logout::before { width: 18px; height: 18px; }
  #connect-upwork { order: 3; flex: 1 1 100%; height: 44px; }
  #run {
    position: fixed; z-index: 20; right: max(16px, env(safe-area-inset-right)); bottom: max(18px, calc(env(safe-area-inset-bottom) + 10px));
    height: 54px; padding: 0 22px; border-radius: 999px; font-size: 15px; max-width: calc(100% - 32px);
    box-shadow: 0 14px 34px -10px rgba(31, 91, 255, 0.85), 0 0 0 1px rgba(255, 255, 255, 0.12) inset;
  }
  #run::before { width: 18px; height: 18px; }
  /* Room under the last card for the floating button. */
  .layout { padding-bottom: calc(100px + env(safe-area-inset-bottom)); }

  .notice { font-size: 12.5px; margin-top: 12px; }
  .notice .sched-item { padding: 10px 12px; border-radius: 13px; }
  .notice .sched-item > .muted { font-size: 10.5px; }
  .notice strong { font-size: 12.5px; }
  .run-result { padding: 12px 44px 12px 14px; }
  .connect-panel { padding: 14px 16px; }
  .connect-panel ol { padding-left: 18px; font-size: 13.5px; }
  .connect-panel input { flex: 1 1 100%; min-width: 0; }
  .connect-panel form button { flex: 1 1 0; min-height: 46px; }

  /* Date: "Posted on [date]" on one line, Today / Yesterday / All dates under it. */
  .datepick { flex-wrap: wrap; }
  .datepick input[type="date"] { flex: 1 1 140px; }
  .day-buttons { flex: 1 1 100%; }
  .day-buttons button { flex: 1 1 0; }

  .list-title { font-size: 18px; margin: 2px 2px 10px; }
  .day { font-size: 12px; margin-top: 18px; }
  .title { font-size: 15.5px; line-height: 1.38; }
  .meta { gap: 5px; font-size: 12px; }
  .meta > span { padding: 3px 9px; }
  .snippet { font-size: 13.5px; }
  /* Long descriptions show four lines until "Show more". */
  .snippet:not(.expanded) { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 4; line-clamp: 4; overflow: hidden; }
  .more:not([hidden]) {
    display: inline-flex; height: auto; min-height: 32px; margin-top: 2px; padding: 4px 0; border: 0; background: none; box-shadow: none;
    font-size: 13px; font-weight: 700; color: var(--accent);
  }
  .chip { font-size: 11.5px; }

  /* Save / Reviewed / Delete share one row; "Open on Upwork" gets its own full-width row. */
  .job-actions { gap: 7px; }
  .job-actions button { flex: 1 1 0; min-width: 0; padding: 0 6px; gap: 5px; font-size: 12.5px; }
  .job-actions .open { flex: 1 1 100%; height: 46px; font-size: 14.5px; border-radius: 13px; }
  .empty { padding: 36px 16px; }

  .modal-box { padding: 26px 20px 18px; }
  .modal-actions button { height: 48px; }
}

/* --- Very narrow phones (iPhone SE 1st gen, small Androids) ------------------------ */
@media (max-width: 360px) {
  :root { --gutter: 12px; }
  .notice { grid-template-columns: 1fr; }
  .job { padding: 14px 12px; }
  .job-actions button { font-size: 12px; padding: 0 4px; }
  .job-actions button::before { display: none; }
  .segmented button { font-size: 13px; padding: 0 4px; }
  .datepick input[type="date"] { flex-basis: 120px; }
}

/* Phones turned sideways: short screens, so keep the header compact. */
@media (max-height: 500px) and (orientation: landscape) {
  .topbar { flex-direction: row; align-items: center; position: static; }
  .sidebar { position: static; max-height: none; }
}

/* --- Motion and hover effects ------------------------------------------------------ */
/* Entrance animations only play on elements marked by the scripts (first paint, a new view,
   newly found jobs), never on the quiet background refreshes. "backwards" fill keeps hover
   transforms working once an entrance has finished. Reduced-motion users get none (see above). */
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes rise-sm { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes grow-y { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes leave { to { opacity: 0; transform: translateX(24px) scale(0.98); } }
@keyframes flow { 0%, 100% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } }
@keyframes drop-in { from { opacity: 0; transform: translateY(-6px); clip-path: inset(0 0 100% 0); } to { opacity: 1; transform: none; clip-path: inset(0); } }
:root { --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1); --ease-spring: cubic-bezier(0.3, 1.4, 0.5, 1); }

/* Brand: the gradient word drifts slowly. */
.grad-text { background-size: 200% 200%; animation: flow 8s ease-in-out infinite; }

/* Views fade in when switched (the browser replays this when [hidden] is lifted). */
.insights:not([hidden]), #jobs-view:not([hidden]) { animation: rise-sm 0.35s var(--ease-out) backwards; }

/* Status row, first paint only. */
.notice.enter > * { animation: rise 0.45s var(--ease-out) backwards; }
.notice.enter > :nth-child(2) { animation-delay: 50ms; }
.notice.enter > :nth-child(3) { animation-delay: 100ms; }
.notice.enter > :nth-child(4) { animation-delay: 150ms; }
.notice.enter > :nth-child(5) { animation-delay: 200ms; }
.notice.enter > :nth-child(n + 6) { animation-delay: 250ms; }

/* Job cards: new ones rise in, staggered; deleted ones slide away. */
.job.enter { animation: rise 0.45s var(--ease-out) backwards; animation-delay: calc(var(--i, 0) * 45ms); }
.job.leaving { animation: leave 0.25s ease-in forwards; pointer-events: none; }

/* Insights: cards, tiles, chart bars and table rows. */
.ins-body[data-anim="full"] .ins-card,
.ins-body[data-anim="full"] .kpi,
.ins-body[data-anim="full"] .mx,
.ins-body[data-anim="full"] .cause,
.ins-body[data-anim="full"] .ins-panel { animation: rise 0.5s var(--ease-out) backwards; animation-delay: calc(var(--i, 0) * 60ms); }
.ins-body[data-anim="full"] .hbar,
.ins-body[data-anim="full"] .dbar { transform-origin: bottom; animation: grow-y 0.6s var(--ease-out) backwards; animation-delay: calc(150ms + var(--i, 0) * 22ms); }
.ins-body[data-anim="full"] .sched-table tbody tr:not(.detail-row),
.ins-body[data-anim="rows"] .sched-table tbody tr:not(.detail-row) { animation: rise-sm 0.35s var(--ease-out) backwards; animation-delay: calc(var(--i, 0) * 25ms); }
.ins-filters.enter li { animation: rise 0.45s var(--ease-out) backwards; animation-delay: calc(var(--i, 0) * 50ms); }
.detail-row.opening .inspect-box { animation: drop-in 0.28s var(--ease-out) backwards; }

/* Smooth state changes everywhere. */
.sched-item, .sidebar li, .ins-filters li, .kpi, .mx, .cause, .ins-card, .ins-panel, .chip, .pill-btn, .new-pill,
.ins-table tbody tr td, .dbar, .hbar, .logo, .ins-range-pills button, .st, .meta > span, .sla, .ins-date, .ins-check, .ins-select {
  transition: transform 0.25s var(--ease-out), box-shadow 0.25s ease, border-color 0.25s ease, background-color 0.2s ease, color 0.2s ease, filter 0.2s ease;
}
.ins-table tbody tr td { transition-property: background-color; }
.dbar, .hbar { transition: height 0.4s var(--ease-out), filter 0.2s ease, background-color 0.2s ease, transform 0.25s var(--ease-out); }

/* Primary buttons: the gradient slides on hover. */
button.primary, .job-actions .open, .ins-range-pills button.on { background-size: 180% 180%; background-position: 0% 50%; transition: background-position 0.5s var(--ease-out), filter 0.2s, transform 0.15s, box-shadow 0.25s; }

@media (hover: hover) {
  button.primary:hover, .job-actions .open:hover, .ins-range-pills button.on:hover { background-position: 100% 50%; transform: translateY(-1px); }
  button.primary:active, .job-actions .open:active { transform: scale(0.97); }
  button.soft:hover, #logout:hover, .day-buttons button:hover, .job-actions button:hover, .ins-alert .review:hover { transform: translateY(-1px); }
  .ins-range-pills button:not(.on):hover { background: var(--accent-soft); color: var(--accent); }
  .segmented button:not(.active):hover { background: color-mix(in srgb, var(--accent-soft) 60%, transparent); color: var(--accent); }

  /* Header. */
  .logo:hover { transform: rotate(-8deg) scale(1.06); box-shadow: var(--glow); }
  .notice .sched-item:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--accent) 30%, var(--border)); }
  .notice .sched-item.warn:hover, .notice .sched-item.busy:hover { transform: none; }

  /* Job cards: a gradient line runs across the top; the Upwork arrow nudges. */
  .job::before {
    content: ""; position: absolute; left: 18px; right: 18px; top: -1px; height: 2px; border-radius: 2px;
    background: var(--grad); transform: scaleX(0); transform-origin: left; transition: transform 0.35s var(--ease-out);
  }
  .job:hover::before { transform: scaleX(1); }
  .job-actions .open::after { transition: transform 0.2s var(--ease-out); }
  .job-actions .open:hover::after { transform: translate(2px, -2px); }
  .job .chip:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); color: var(--accent); }
  .job .meta > span:hover { border-color: var(--border-strong); }

  /* Filter lists. */
  .sidebar li:not(.active):hover { transform: translateX(3px); }
  .ins-filters li:not(.active):hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--accent) 35%, var(--border)); }
  .ins-filters li.active:hover { filter: brightness(1.05); }

  /* Insights tiles and cards. */
  .kpi:hover, .mx:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--accent) 30%, var(--border)); }
  .mx.alert:hover { border-color: var(--c); }
  .cause:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
  .ins-card:hover { box-shadow: 0 18px 40px -16px rgba(15, 23, 42, 0.25), 0 2px 6px rgba(15, 23, 42, 0.05); }
  .ins-panel:hover { border-color: var(--border-strong); }
  .ins-date:hover, .ins-check:hover, .ins-select:hover { border-color: var(--border-strong); }
  .sla:hover { transform: scale(1.04); }

  /* Chart bars brighten; the hovered day column lifts its bar. */
  .hbar-col:hover .hbar:not(.cmp) { filter: brightness(1.12); transform: scaleY(1.03); transform-origin: bottom; }
  .dbar-col:hover .dbar:not(.cmp) { filter: brightness(1.1) saturate(1.1); }
  .dbar-col:hover .dbar-val { transform: translateY(-2px); }
  .dbar-val { display: inline-block; transition: transform 0.2s var(--ease-out); }

  /* Schedule table rows. */
  .sched-table tbody tr:not(.detail-row):hover td { background: color-mix(in srgb, var(--accent-soft) 55%, transparent); }
  .sched-table tbody tr:hover .st { transform: scale(1.05); }
  .ins-table button.inspect:hover { color: var(--accent); }
  .pill-btn:not(.on):hover { background: var(--panel); }
  .new-pill:hover { transform: scale(1.06); }
}
