:root {
  --bg: #f4f5f7; --card: #fff; --text: #1d2330; --muted: #6b7280; --line: #e3e6eb;
  --accent: #2563eb; --accent-text: #fff; --ok: #15803d; --ok-bg: #e8f6ec;
  --warn: #b45309; --warn-bg: #fff4e0; --bad: #b91c1c; --bad-bg: #fdecec;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #14171c; --card: #1d2128; --text: #e7e9ee; --muted: #9aa3b2; --line: #2d333d;
    --accent: #4f8cff; --ok: #4ade80; --ok-bg: #16301f; --warn: #fbbf24; --warn-bg: #362a12;
    --bad: #f87171; --bad-bg: #3a1a1a; }
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg); color: var(--text); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0 0 16px; }
h2 { font-size: 17px; margin: 24px 0 10px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* admin layout */
.top { background: var(--card); border-bottom: 1px solid var(--line); padding: 0 16px;
  display: flex; gap: 4px; align-items: center; flex-wrap: wrap; position: sticky; top: 0; z-index: 5; }
.top .brand { font-weight: 700; margin-right: 12px; padding: 12px 0; }
.top a.nav { padding: 12px 10px; color: var(--muted); border-bottom: 2px solid transparent; }
.top a.nav.on, .top a.nav:hover { color: var(--text); border-bottom-color: var(--accent); text-decoration: none; }
.top .spacer { flex: 1; }
main.wrap { max-width: 1150px; margin: 0 auto; padding: 20px 16px 60px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin-bottom: 16px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 600; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table-wrap { overflow-x: auto; }

label { display: block; font-size: 13px; color: var(--muted); margin: 10px 0 4px; }
input[type=text], input[type=number], input[type=password], input[type=date], input:not([type]), select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--bg); color: var(--text); font: inherit; }
textarea { min-height: 70px; }
input.short { width: 90px; }
.check { display: flex; gap: 8px; align-items: center; margin: 6px 0; color: var(--text); font-size: 15px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.row > * { flex: 1 1 160px; }
.row > .btn, .row > button { flex: 0 0 auto; }

.btn, button { display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 16px; border-radius: 8px; border: 1px solid var(--accent); background: var(--accent);
  color: var(--accent-text); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn:hover, button:hover { filter: brightness(1.08); text-decoration: none; }
.btn.ghost, button.ghost { background: transparent; color: var(--accent); }
.btn.danger, button.danger { background: var(--bad); border-color: var(--bad); }
.btn.small, button.small { padding: 5px 10px; font-size: 13px; }
.btn.big, button.big { width: 100%; padding: 15px; font-size: 17px; border-radius: 12px; }
form.inline { display: inline; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: 12px; font-weight: 600;
  background: var(--line); color: var(--muted); white-space: nowrap; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }
.note { padding: 10px 14px; border-radius: 10px; margin: 10px 0; }
.note.ok { background: var(--ok-bg); color: var(--ok); }
.note.warn { background: var(--warn-bg); color: var(--warn); }
.note.bad { background: var(--bad-bg); color: var(--bad); }
.note ul { margin: 6px 0 0; padding-left: 20px; }

.bar { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; min-width: 80px; }
.bar > i { display: block; height: 100%; background: var(--accent); }
.bar.full > i { background: var(--ok); }

.thumbs { display: flex; gap: 10px; flex-wrap: wrap; }
.thumb { width: 170px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--bg); }
.thumb img { width: 100%; height: 170px; object-fit: cover; display: block; cursor: zoom-in; }
.thumb .meta { padding: 6px 8px; font-size: 12px; }
.thumb.dim { opacity: .55; }
.sample-img { max-width: 260px; border-radius: 10px; border: 1px solid var(--line); }
.linkbox { font-family: ui-monospace, Consolas, monospace; font-size: 13px; word-break: break-all;
  background: var(--bg); padding: 10px; border-radius: 8px; border: 1px dashed var(--line); }

/* lightbox */
#lb { position: fixed; inset: 0; background: rgba(0,0,0,.85); display: none; align-items: center;
  justify-content: center; z-index: 50; cursor: zoom-out; }
#lb img { max-width: 95vw; max-height: 95vh; }

/* employee app */
.app { max-width: 560px; margin: 0 auto; padding: 16px 16px 80px; }
.app header { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.app header h1 { margin: 0; font-size: 20px; flex: 1; }
.tile { display: flex; align-items: center; gap: 12px; background: var(--card); border: 1px solid var(--line);
  border-radius: 14px; padding: 14px; margin-bottom: 10px; color: var(--text); }
.tile:hover { text-decoration: none; border-color: var(--accent); }
.tile .ico { width: 54px; height: 54px; border-radius: 10px; background: var(--bg); flex: 0 0 54px;
  display: flex; align-items: center; justify-content: center; font-size: 24px; overflow: hidden; }
.tile .ico img { width: 100%; height: 100%; object-fit: cover; }
.tile .body { flex: 1; min-width: 0; }
.tile .title { font-weight: 600; }
.tile.done { opacity: .7; }
.preview { width: 100%; border-radius: 12px; margin: 10px 0; display: none; }
.fields .row > * { flex: 1 1 140px; }
.spinner { display: inline-block; width: 18px; height: 18px; border: 3px solid var(--line);
  border-top-color: var(--accent); border-radius: 50%; animation: spin 1s linear infinite; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }
.hidden { display: none !important; }

.team-picker { position: relative; min-width: 0; }
.team-picker summary { display: flex; align-items: center; justify-content: space-between; gap: 10px; list-style: none; padding: 9px 12px; min-height: 42px; box-sizing: border-box; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); cursor: pointer; }
.team-picker summary::-webkit-details-marker { display: none; }
.team-picker summary::after { content: ''; width: 7px; height: 7px; border: solid var(--muted); border-width: 0 1.5px 1.5px 0; transform: translateY(-2px) rotate(45deg); }
.team-picker details[open] summary::after { transform: translateY(2px) rotate(225deg); }
.team-picker summary:focus-visible, .team-picker details[open] summary { outline: 2px solid var(--accent); outline-offset: 1px; }
.team-options { position: absolute; z-index: 5; top: calc(100% + 6px); left: 0; right: 0; max-height: 17rem; overflow-y: auto; padding: 6px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); box-shadow: 0 5px 18px #0002; }
.team-options .check { margin: 0; padding: 8px; cursor: pointer; border-radius: 5px; }
.team-options .check:hover, .team-options .check:focus-within { background: var(--bg); }
.team-list { margin: 12px 0 18px; padding: 0; list-style: none; }
.team-list li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.team-person { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; overflow-wrap: anywhere; }
.team-person a { font-weight: 600; }
.team-list button.team-remove { flex: none; padding: 5px 9px; border-color: var(--line); color: var(--muted); font-size: .85em; }
.team-list button.team-remove:hover { border-color: currentColor; color: var(--text); }
.team-add-controls { display: flex; gap: 8px; align-items: stretch; }
.team-add-controls select { min-width: 0; flex: 1; }
@media (max-width: 600px) { .team-options { position: static; margin-top: 5px; } }

.assistant-settings { scroll-margin-top: 64px; }
.assistant-heading, .assistant-actions { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.assistant-heading { justify-content: space-between; margin-bottom: 10px; }
.assistant-heading h2, .assistant-diagnostic h3 { margin: 0; }
.assistant-option { display: flex; align-items: flex-start; gap: 10px; color: var(--text); padding: 9px 0; margin: 0; cursor: pointer; }
.assistant-option input { margin-top: 4px; accent-color: var(--accent); }
.assistant-option strong, .assistant-option small { display: block; }
.assistant-option strong { font-size: 15px; }
.assistant-option small { margin-top: 2px; font-size: 13px; color: var(--muted); }
.assistant-actions { margin-top: 10px; }
.assistant-diagnostic { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 14px; scroll-margin-top: 64px; }
.assistant-diagnostic p { margin: 6px 0 10px; }

.product-line { display: flex; flex-wrap: wrap; align-items: baseline; gap: .65rem; margin-bottom: .45rem; }
.product-line small, .brand small, .role-help summary span { color: var(--muted); font-weight: 400; }
.role-help { margin-bottom: 1rem; border-bottom: 1px solid var(--line); }
.role-help summary { width: fit-content; padding: .65rem 0; color: var(--accent); cursor: pointer; }
.role-help ol { max-width: 65ch; padding-inline-start: 1.5rem; }
.role-help li { margin: .9rem 0; padding-inline-start: .25rem; }
.role-help p { margin: .2rem 0 0; }
