:root {
  --slate: #1F2A2E;
  --ink: #0B1114;
  --panel: #172124;
  --panel-2: #283439;
  --line: rgba(242, 237, 227, 0.12);
  --line-2: rgba(242, 237, 227, 0.22);
  --amber: #E0A458;
  --amber-deep: rgba(58, 35, 12, 0.45);
  --green: #A8D58B;
  --cream: #F2EDE3;
  --sand: #C9C2B4;
  --error: #D26A57;
  --serif: "Fraunces", Georgia, serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  --sans: "DM Sans", system-ui, -apple-system, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--slate); color: var(--cream); font-family: var(--sans); font-size: 15px; line-height: 1.45; }
a { color: var(--cream); text-decoration: none; }
a:hover { color: var(--amber); }
button { font: inherit; color: inherit; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; margin: 0; }
h1 { font-size: 34px; line-height: 1.1; }
h3 { font-size: 18px; line-height: 1.25; }
.mono { font-family: var(--mono); font-size: 13px; letter-spacing: .3px; }
.muted { color: var(--sand); opacity: .85; }
.small { font-size: 12px; }
.pad { padding: 12px 16px; }
.error-text { color: var(--error); }
.amber-text { color: var(--amber); }

.label { font-family: var(--mono); font-size: 10.5px; font-weight: 500; letter-spacing: 1.6px; text-transform: uppercase; color: var(--amber); }
.label.green { color: var(--green); }
.label.muted { color: var(--sand); }
.label.error { color: var(--error); }
.label.amber { color: var(--amber); }

.brand { display: flex; align-items: center; gap: 10px; font-family: var(--serif); font-size: 24px; font-weight: 600; }
.brand img { width: 36px; height: 36px; object-fit: contain; }
.brand.big { font-size: 34px; justify-content: center; margin-bottom: 18px; }
.brand.big img { width: 64px; height: 64px; }
.brand.small { font-size: 20px; }
.brand.small img { width: 28px; height: 28px; }

/* buttons and fields */
.btn { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; min-height: 40px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--line-2); background: transparent; color: var(--cream); font-weight: 600; cursor: pointer; }
.btn:hover { border-color: var(--amber); }
.btn.primary { background: var(--amber); color: #1B1A17; border: none; font-weight: 700; }
.btn.primary:hover { filter: brightness(1.06); }
.btn.danger { border-color: rgba(210, 106, 87, .6); color: #F0B3A6; }
.btn.danger:hover { background: rgba(210, 106, 87, .12); }
.btn.small { min-height: 32px; padding: 0 12px; font-size: 13px; }
.btn.wide { width: 100%; min-height: 50px; font-size: 16px; }
.btn:disabled { opacity: .5; cursor: default; }
.link { background: none; border: none; padding: 0; color: var(--amber); cursor: pointer; font-weight: 600; }
.link.center { display: block; margin: 14px auto 0; }
.field { display: flex; flex-direction: column; gap: 6px; margin-top: 14px; }
.field span { font-family: var(--mono); font-size: 11px; letter-spacing: 1.2px; text-transform: uppercase; color: var(--sand); }
input, select { font: inherit; color: var(--cream); background: rgba(11, 17, 20, .6); border: 1px solid var(--line-2); border-radius: 10px; min-height: 44px; padding: 0 12px; }
input:focus, select:focus { outline: 2px solid var(--amber); outline-offset: 1px; border-color: transparent; }
.select { min-height: 40px; }
.search { min-width: 260px; flex: 1; max-width: 420px; }

.notice { border-radius: 10px; padding: 10px 14px; margin: 12px 0; border: 1px solid var(--line-2); background: rgba(11, 17, 20, .5); font-size: 14px; }
.notice.error { border-color: var(--error); }
.notice.ok { border-color: rgba(168, 213, 139, .6); }
.loading { display: flex; align-items: center; gap: 10px; padding: 24px 0; color: var(--sand); }
.loading.full { justify-content: center; min-height: 100vh; }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgba(224, 164, 88, .25); border-top-color: var(--amber); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty { padding: 40px 20px; text-align: center; color: var(--sand); border: 1px dashed var(--line-2); border-radius: 12px; }

/* sign in */
.signin { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.signin-card { width: 100%; max-width: 400px; background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 32px 28px; text-align: left; }
.signin-card > .label { display: block; text-align: center; }
.signin-card > .sub { text-align: center; margin: 6px 0 8px; }
.signin-card .btn.wide { margin-top: 20px; }

/* shell */
.shell { display: flex; min-height: 100vh; }
.side { width: 248px; flex: none; background: var(--ink); border-right: 1px solid var(--line); padding: 22px 16px; display: flex; flex-direction: column; gap: 22px; position: sticky; top: 0; height: 100vh; }
.venue { display: flex; flex-direction: column; gap: 6px; }
.venue-name { font-family: var(--serif); font-size: 18px; }
.venue .select { width: 100%; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; border-radius: 8px; color: var(--sand); font-weight: 500; }
.nav a:hover { color: var(--cream); background: rgba(242, 237, 227, .05); }
.nav a.on { color: var(--cream); background: rgba(224, 164, 88, .12); box-shadow: inset 2px 0 0 var(--amber); }
.badge { font-family: var(--mono); font-size: 11px; background: var(--amber); color: #1B1A17; border-radius: 4px; padding: 1px 6px; font-weight: 600; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.main { flex: 1; min-width: 0; }
.topbar { display: none; }
.content { max-width: 1120px; margin: 0 auto; padding: 36px 40px 80px; }

.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head .sub { color: var(--sand); margin: 8px 0 0; max-width: 680px; }
.head-actions { display: flex; gap: 10px; }
.back { display: inline-block; margin-bottom: 14px; color: var(--sand); font-size: 14px; }

/* tiles and panels */
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 20px; }
.tile { display: flex; flex-direction: column; gap: 6px; padding: 16px; border-radius: 10px; border: 1px solid rgba(224, 164, 88, .35); background: rgba(11, 17, 20, .35); }
a.tile:hover { border-color: var(--amber); color: var(--cream); }
.tile.attention { border-color: rgba(224, 164, 88, .75); background: var(--amber-deep); }
.tile.attention .tile-value, .tile.attention .tile-label { color: var(--amber); }
.tile-value { font-family: var(--mono); font-size: 28px; font-weight: 600; }
.tile-label { font-family: var(--mono); font-size: 10.5px; letter-spacing: 1.4px; color: var(--sand); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.panel { background: rgba(11, 17, 20, .3); border: 1px solid var(--line); border-radius: 12px; margin-bottom: 16px; overflow: hidden; }
.panel-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.rows { list-style: none; margin: 0; padding: 0; }
.rows li { border-bottom: 1px solid var(--line); }
.rows li:last-child { border-bottom: none; }
.row { display: flex; align-items: center; gap: 14px; padding: 12px 16px; }
a.row:hover { background: rgba(242, 237, 227, .04); }
.row-main { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rows.compact .row { padding: 9px 16px; }
.dupe { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px 10px; padding: 12px 16px; }
.dupe .label { min-width: 86px; }

.bar { display: flex; height: 10px; margin: 16px; border-radius: 5px; overflow: hidden; background: rgba(242, 237, 227, .08); }
.bar-phone { background: var(--green); }
.bar-ai { background: var(--amber); }
.bar-person { background: var(--sand); }
.legend { display: flex; gap: 22px; flex-wrap: wrap; padding: 0 16px 16px; font-size: 13px; color: var(--sand); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; }
.dot.green { background: var(--green); } .dot.amber { background: var(--amber); } .dot.sand { background: var(--sand); }

/* tables */
.toolbar { display: flex; gap: 10px; align-items: center; margin: 0 0 14px; flex-wrap: wrap; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-family: var(--mono); font-size: 10.5px; letter-spacing: 1.3px; text-transform: uppercase; color: var(--sand); font-weight: 500; padding: 11px 14px; border-bottom: 1px solid var(--line); background: rgba(11, 17, 20, .45); position: sticky; top: 0; }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr:last-child td { border-bottom: none; }
.table .num { text-align: right; white-space: nowrap; }
.table tr.click { cursor: pointer; }
.table tr.click:hover td { background: rgba(242, 237, 227, .035); }
.tabs { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }
.tabs a, .tabs button { padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line); background: none; color: var(--sand); cursor: pointer; font-weight: 500; display: inline-flex; gap: 8px; align-items: center; }
.tabs .on { border-color: var(--amber); color: var(--cream); background: rgba(224, 164, 88, .1); }

/* pictures */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 16px; }
.card { background: rgba(11, 17, 20, .35); border: 1px solid rgba(224, 164, 88, .45); border-radius: 14px; overflow: hidden; display: flex; flex-direction: column; }
.card-pics { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 4px; padding: 10px; background: var(--ink); }
.card-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.card-body .sub { color: var(--sand); margin: 0; font-size: 13px; }
.ai-note { font-size: 13px; color: var(--sand); margin: 2px 0 0; }
.actions { display: flex; gap: 8px; margin-top: auto; padding-top: 10px; flex-wrap: wrap; }
.pic { margin: 0; position: relative; border-radius: 6px; overflow: hidden; background: #0f1719; aspect-ratio: 1 / 2; }
.pic.main { outline: 2px solid var(--amber); }
.pic img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pic figcaption { position: absolute; left: 0; right: 0; bottom: 0; font-family: var(--mono); font-size: 9.5px; letter-spacing: 1px; padding: 3px 5px; background: rgba(11, 17, 20, .8); color: var(--sand); }
.pic.main figcaption { color: var(--amber); }
.pic.revoked { opacity: .45; }
.pic-ph { width: 100%; height: 100%; background: repeating-linear-gradient(135deg, #142023 0 8px, #182628 8px 16px); }
.pic-ph.small { width: 44px; height: 66px; border-radius: 4px; flex: none; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; padding: 14px 16px; }

/* recognition log */
.log { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.log-item { display: flex; align-items: center; gap: 14px; padding: 10px 14px; border: none; border-bottom: 1px solid var(--line); background: none; text-align: left; cursor: pointer; }
.log-item:last-child { border-bottom: none; }
.log-item:hover, .log-item.open { background: rgba(242, 237, 227, .04); }
.log-item img { width: 44px; height: 66px; object-fit: cover; border-radius: 4px; flex: none; background: #0f1719; }
.log-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.log-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100%); background: var(--ink); border-left: 1px solid var(--line-2); z-index: 20; display: flex; flex-direction: column; box-shadow: -20px 0 40px rgba(0, 0, 0, .35); }
.drawer-head { display: flex; justify-content: space-between; align-items: center; padding: 16px; border-bottom: 1px solid var(--line); }
.report { margin: 0; padding: 16px; overflow: auto; flex: 1; font-family: var(--mono); font-size: 11.5px; line-height: 1.55; white-space: pre-wrap; word-break: break-word; color: var(--sand); }

/* phone and tablet */
@media (max-width: 900px) {
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid2 { grid-template-columns: 1fr; }
  .content { padding: 24px 16px 60px; }
}
@media (max-width: 760px) {
  .side { position: fixed; left: 0; top: 0; z-index: 30; transform: translateX(-100%); transition: transform .2s ease; box-shadow: 20px 0 40px rgba(0, 0, 0, .4); }
  .side.open { transform: none; }
  .topbar { display: flex; align-items: center; gap: 14px; padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--ink); position: sticky; top: 0; z-index: 10; }
  h1 { font-size: 28px; }
  .search { min-width: 0; width: 100%; max-width: none; }
  .cards { grid-template-columns: 1fr; }
  .table th, .table td { padding: 10px; }
}

/* team */
.role-chip { align-self: flex-start; font-family: var(--mono); font-size: 10.5px; letter-spacing: 1.4px; text-transform: uppercase; color: var(--amber); border: 1px solid rgba(224, 164, 88, .5); border-radius: 4px; padding: 2px 7px; }
.invite { display: flex; gap: 10px; padding: 16px; flex-wrap: wrap; }
.invite input[type=email] { flex: 1; min-width: 220px; }
.link-field { width: 100%; font-family: var(--mono); font-size: 12px; margin-bottom: 10px; }
.actions.inline { display: inline-flex; padding: 0; margin: 0; }
.center-text { text-align: center; }
