/* ===== FoundIt UI ===== a single hand-rolled stylesheet, tokens at top, light + dark. */

.visually-hidden {
  position: absolute !important; width: 1px !important; height: 1px !important;
  padding: 0 !important; margin: -1px !important; overflow: hidden !important;
  clip: rect(0,0,0,0) !important; white-space: nowrap !important; border: 0 !important;
}

:root {
  color-scheme: light;
  --brand: #0d9488;
  --brand-dark: #0f766e;
  --brand-soft: #e3f6f3;

  --bg: #f4f6f7;
  --surface: #ffffff;
  --surface-2: #fafbfc;
  --surface-3: #f1f3f5;
  --border: #e7eaec;
  --border-strong: #d6dadd;

  --text: #161a1d;
  --text-soft: #3a4248;
  --muted: #6a747b;
  --muted-2: #99a2a8;

  --green: #15a34a; --green-soft: #e6f6ec;
  --amber: #d97706; --amber-soft: #fdf1de;
  --red:   #e0413a; --red-soft:   #fdebea;
  --blue:  #2563eb; --blue-soft:  #e8efff;
  --gray-soft: #eceff1;

  --sidebar: #10161a;

  --radius-xs: 7px; --radius-sm: 10px; --radius: 16px; --radius-lg: 22px;
  --shadow-sm: 0 1px 2px rgba(18,28,32,.06), 0 1px 3px rgba(18,28,32,.05);
  --shadow: 0 4px 14px -3px rgba(18,28,32,.10), 0 2px 6px -2px rgba(18,28,32,.07);
  --shadow-lg: 0 26px 60px -16px rgba(18,28,32,.26);

  --sans: "Inter", -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --ease: cubic-bezier(.4,0,.2,1);
}

[data-theme="dark"] {
  color-scheme: dark;
  --brand-soft: #0c3b37;
  --bg: #0b0e10;
  --surface: #14181b;
  --surface-2: #1a1f23;
  --surface-3: #222a2e;
  --border: #262d31;
  --border-strong: #38424700;
  --border-strong: #384247;
  --text: #eceef0;
  --text-soft: #c3c9cd;
  --muted: #8b949b;
  --muted-2: #5f696f;
  --green-soft: #11291c;
  --amber-soft: #2f2410;
  --red-soft:   #311714;
  --blue-soft:  #14233f;
  --gray-soft:  #222a2e;
  --sidebar: #0a0e10;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.45);
  --shadow: 0 6px 18px -4px rgba(0,0,0,.55);
  --shadow-lg: 0 28px 64px -14px rgba(0,0,0,.7);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--sans);
  background: var(--bg); color: var(--text);
  line-height: 1.55; font-size: 14.5px;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 23px; letter-spacing: -.022em; font-weight: 800; }
h2 { font-size: 17px; letter-spacing: -.014em; font-weight: 700; }
h3 { font-size: 15px; font-weight: 700; }
img { max-width: 100%; display: block; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.mt { margin-top: 14px; }
.mb { margin-bottom: 14px; }
.center { text-align: center; }
.center-text { text-align: center; }
.req { color: var(--red); }

@keyframes reveal { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ===== App shell ===== */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 244px; background: var(--sidebar); color: #aeb6bd; flex-shrink: 0;
  display: flex; flex-direction: column; padding: 16px 0 12px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.brand {
  display: flex; align-items: center; gap: 8px; color: #fff; font-weight: 800;
  font-size: 19px; letter-spacing: -.02em; padding: 4px 20px 16px; text-decoration: none;
}
.brand span { color: var(--brand); }
.brand:hover { text-decoration: none; }
.brand .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 25%, transparent); }
.sidebar nav { display: flex; flex-direction: column; gap: 1px; padding: 0 10px; }
.sidebar nav a {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: var(--radius-sm);
  color: #aeb6bd; font-size: 13.5px; font-weight: 500; text-decoration: none; transition: all .15s var(--ease);
}
.sidebar nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar nav a.active { background: var(--brand); color: #fff; }
.sidebar nav a .ico { width: 20px; text-align: center; font-size: 14px; opacity: .95; }
.nav-group { font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: #5f6a72; padding: 14px 14px 5px; font-weight: 700; }
.nav-badge { margin-left: auto; background: var(--red); color: #fff; font-size: 10.5px; font-weight: 700; border-radius: 9px; padding: 1px 7px; }
.spacer { flex: 1; }
.org-box { margin: 8px 14px 0; padding: 10px 12px; background: rgba(255,255,255,.05); border-radius: var(--radius-sm); display: block; text-decoration: none; }
.org-box:hover { background: rgba(255,255,255,.09); text-decoration: none; }
.org-box .name { color: #fff; font-weight: 700; font-size: 13px; }
.org-box .plan { color: #7d878e; font-size: 11.5px; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 26px; background: var(--surface); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 50;
}
.topbar-left { display: flex; align-items: center; gap: 12px; }
.topbar-heading { font-size: 16px; font-weight: 700; }
.menu-toggle { display: none; background: none; border: none; font-size: 20px; cursor: pointer; color: var(--text); }
.user { display: flex; align-items: center; gap: 12px; }
.icon-btn { background: var(--surface-3); border: 1px solid var(--border); border-radius: 9px; width: 34px; height: 34px; cursor: pointer; font-size: 15px; color: var(--text); }
.theme-ico-dark { display: none; }
[data-theme="dark"] .theme-ico-light { display: none; }
[data-theme="dark"] .theme-ico-dark { display: inline; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--brand); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; }
.topbar-username { font-size: 13.5px; font-weight: 600; }
.signout-link { font-size: 12.5px; color: var(--muted); }
.content { padding: 24px 26px 60px; max-width: 1180px; width: 100%; animation: reveal .4s var(--ease) both; }

.nav-scrim { display: none; }

/* ===== Flash ===== */
.flash { display: flex; align-items: center; gap: 10px; padding: 11px 15px; border-radius: var(--radius-sm); margin-bottom: 14px; font-size: 13.5px; font-weight: 500; }
.flash.success { background: var(--green-soft); color: var(--green); }
.flash.error { background: var(--red-soft); color: var(--red); }

/* ===== Buttons ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  background: var(--brand); color: #fff; border: 1px solid transparent;
  padding: 9px 16px; border-radius: var(--radius-sm); font-size: 13.5px; font-weight: 600;
  cursor: pointer; text-decoration: none; transition: all .15s var(--ease); font-family: inherit;
}
.btn:hover { background: var(--brand-dark); text-decoration: none; }
.btn.ghost { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn.ghost:hover { background: var(--surface-3); }
.btn.small { padding: 6px 12px; font-size: 12.5px; }
.btn.tiny { padding: 4px 9px; font-size: 11.5px; }
.btn.big { padding: 12px 24px; font-size: 15px; }
.btn.block { width: 100%; }
.page-actions { display: flex; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* ===== Pills ===== */
.pill { display: inline-block; padding: 2px 10px; border-radius: 99px; font-size: 11.5px; font-weight: 700; line-height: 1.6; white-space: nowrap; }
.pill.blue { background: var(--blue-soft); color: var(--blue); }
.pill.green { background: var(--green-soft); color: var(--green); }
.pill.amber { background: var(--amber-soft); color: var(--amber); }
.pill.red { background: var(--red-soft); color: var(--red); }
.pill.gray { background: var(--gray-soft); color: var(--muted); }

/* ===== Cards ===== */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin-bottom: 18px; box-shadow: var(--shadow-sm); }
.card.no-pad { padding: 0; overflow: hidden; }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.two-col > div { min-width: 0; }

/* ===== Stats ===== */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; text-decoration: none; color: var(--text); box-shadow: var(--shadow-sm); transition: all .15s var(--ease); }
.stat:hover { box-shadow: var(--shadow); transform: translateY(-2px); text-decoration: none; }
.stat-num { font-size: 30px; font-weight: 800; letter-spacing: -.03em; }
.stat-label { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.stat-hot { border-color: var(--amber); }
.stat-hot .stat-num { color: var(--amber); }

/* ===== Tables ===== */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 11px 16px; border-bottom: 1px solid var(--border); }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr { cursor: pointer; transition: background .12s var(--ease); }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr:last-child td { border-bottom: none; }
.cell-thumb { width: 52px; }
.thumb { width: 40px; height: 40px; border-radius: 9px; object-fit: cover; background: var(--surface-3); }
.thumb-ph { display: flex; align-items: center; justify-content: center; font-size: 18px; color: var(--muted-2); }

/* ===== Lists ===== */
.row-list { list-style: none; display: flex; flex-direction: column; }
.row-list li { padding: 10px 0; border-bottom: 1px solid var(--border); }
.row-list li:last-child { border-bottom: none; }
.row-list li a { color: var(--text); display: flex; flex-direction: column; }
.row-list li a:hover { text-decoration: none; color: var(--brand); }
.row-flex { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.inline-form { display: flex; gap: 8px; }
.inline-form input { flex: 1; }
.empty { background: var(--surface); border: 1px dashed var(--border-strong); border-radius: var(--radius); padding: 40px 24px; text-align: center; color: var(--muted); }

/* ===== Filter bar ===== */
.filter-bar { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.filter-bar input, .filter-bar select { width: auto; }
.filter-bar input[type=search] { min-width: 240px; flex: 1; }

/* ===== Forms ===== */
label { display: block; font-size: 13px; font-weight: 600; color: var(--text-soft); margin-bottom: 12px; }
input, select, textarea {
  width: 100%; padding: 9px 12px; margin-top: 5px; border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); background: var(--surface); color: var(--text);
  font-size: 14px; font-family: inherit;
}
input[type=color] { padding: 3px; height: 40px; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.form-card { max-width: 760px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.form-grid .span2 { grid-column: 1 / -1; }
.form-section { margin: 6px 0 12px; padding-top: 8px; }
.form-foot { display: flex; gap: 10px; margin-top: 12px; }
.inline-check { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.inline-check input { width: auto; margin: 0; }
.status-form input { margin-bottom: 10px; }
.photo-field { display: flex; gap: 16px; align-items: flex-start; margin-top: 6px; }
.photo-preview { width: 120px; height: 120px; border-radius: var(--radius-sm); background: var(--surface-3); display: flex; align-items: center; justify-content: center; overflow: hidden; flex-shrink: 0; border: 1px solid var(--border); }
.photo-preview img { width: 100%; height: 100%; object-fit: cover; }

/* ===== Detail ===== */
.detail-cols { grid-template-columns: 1fr 1fr; }
.detail-card .detail-top { display: flex; gap: 16px; align-items: flex-start; margin-bottom: 14px; }
.detail-photo { width: 110px; height: 110px; border-radius: var(--radius-sm); object-fit: cover; background: var(--surface-3); font-size: 32px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 6px 0; font-size: 13.5px; }
.kv dt { color: var(--muted); font-weight: 600; }
.kv dd { color: var(--text); }
.desc { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); color: var(--text-soft); white-space: pre-wrap; }

/* ===== Match card ===== */
.match-card { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px; margin-bottom: 12px; background: var(--surface-2); }
.match-head { display: flex; gap: 8px; margin-bottom: 10px; }
.match-body { display: grid; grid-template-columns: 1fr auto 1fr; gap: 12px; align-items: center; }
.match-side-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 4px; }
.match-item { display: flex; gap: 9px; align-items: center; color: var(--text); }
.match-item:hover { text-decoration: none; }
.match-item strong { display: block; font-size: 13.5px; }
.match-item .thumb { width: 34px; height: 34px; }
.match-arrow { color: var(--muted-2); font-size: 18px; }
.match-reasons { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 0; }
.match-reasons li { background: var(--surface-3); color: var(--text-soft); font-size: 11.5px; padding: 3px 9px; border-radius: 99px; }
.match-actions { display: flex; gap: 8px; margin-top: 12px; }
.match-actions form { display: inline; }

/* ===== Auth + centered pages ===== */
.centered-page { display: flex; align-items: center; justify-content: center; padding: 24px; background: var(--bg); min-height: 100vh; }
.auth-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 34px; width: 100%; max-width: 400px; box-shadow: var(--shadow-lg); animation: reveal .4s var(--ease) both; }
.auth-card .brand-lg { display: inline-block; font-size: 26px; font-weight: 800; color: var(--text); padding: 0; margin-bottom: 4px; letter-spacing: -.02em; }
.auth-card .brand-lg span { color: var(--brand); }
.auth-sub { margin-bottom: 18px; font-size: 13.5px; }
.auth-card label { margin-bottom: 14px; }
.auth-card h1 { margin-bottom: 6px; }

/* ===== Public portal ===== */
body.portal { background: var(--bg); }
.portal-bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 24px; background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 40; }
.portal-brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 17px; color: var(--text); letter-spacing: -.01em; }
.portal-brand:hover { text-decoration: none; }
.portal-brand img { height: 30px; width: auto; border-radius: 6px; }
.portal-nav { display: flex; gap: 18px; font-size: 13.5px; font-weight: 600; }
.portal-nav a { color: var(--text-soft); }
.portal-main { max-width: 920px; margin: 0 auto; padding: 32px 24px 60px; width: 100%; }
.portal-foot { max-width: 920px; margin: 0 auto; padding: 24px; display: flex; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 12.5px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.portal-hero { text-align: center; padding: 28px 0 36px; }
.portal-hero h1 { font-size: 34px; letter-spacing: -.03em; }
.lead { font-size: 16px; color: var(--text-soft); max-width: 620px; margin: 12px auto 0; }
.hero-cta { display: flex; gap: 12px; justify-content: center; margin-top: 24px; flex-wrap: wrap; }
.portal-section { margin-top: 36px; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; }
.gallery-item { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; box-shadow: var(--shadow-sm); }
.gallery-item img { width: 100%; height: 140px; object-fit: cover; background: var(--surface-3); }
.gallery-ph { width: 100%; height: 140px; display: flex; align-items: center; justify-content: center; font-size: 38px; background: var(--surface-3); color: var(--muted-2); }
.gallery-body { padding: 11px 13px; }
.gallery-body strong { display: block; font-size: 13.5px; }
.portal-form-wrap { max-width: 640px; margin: 0 auto; }
.portal-form-wrap h1 { margin-bottom: 6px; }
.portal-form-wrap .form-card { margin-top: 16px; }
.big-check { width: 64px; height: 64px; border-radius: 50%; background: var(--green-soft); color: var(--green); font-size: 34px; display: flex; align-items: center; justify-content: center; margin: 0 auto 16px; font-weight: 800; }
.ref-box { background: var(--brand-soft); border-radius: var(--radius); padding: 18px; margin: 20px auto; max-width: 280px; }
.ref-code { font-size: 28px; font-weight: 800; letter-spacing: .04em; color: var(--brand-dark); font-family: var(--mono, monospace); }

/* ===== Shipping ===== */
.ship-offer { border: 1px solid var(--brand); background: var(--brand-soft); border-radius: var(--radius); padding: 18px; }
.ship-offer h3 { margin-bottom: 4px; }
.ship-status { border: 1px solid var(--border); background: var(--surface-2); border-radius: var(--radius-sm); padding: 16px; }
.rate-list { display: flex; flex-direction: column; gap: 10px; }
.rate-option { display: flex; align-items: center; gap: 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 12px 14px; margin: 0; cursor: pointer; font-weight: 500; transition: border-color .12s var(--ease), background .12s var(--ease); }
.rate-option:hover { border-color: var(--brand); }
.rate-option:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.rate-option input { width: auto; margin: 0; }
.rate-main { display: flex; flex-direction: column; }
.rate-main strong { font-size: 14px; }
.rate-price { margin-left: auto; font-size: 17px; font-weight: 800; letter-spacing: -.01em; }

/* ===== AI photo suggestions ===== */
.analyze-out { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chip { background: var(--brand-soft); color: var(--brand-dark); border: 1px solid var(--brand); border-radius: 99px; padding: 4px 11px; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.chip:disabled { opacity: .5; cursor: default; }

/* ===== Insights bars ===== */
.bar-row { display: grid; grid-template-columns: 130px 1fr 34px; align-items: center; gap: 10px; margin-bottom: 8px; }
.bar-label { font-size: 12.5px; color: var(--text-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { background: var(--surface-3); border-radius: 99px; height: 12px; overflow: hidden; }
.bar-fill { background: var(--brand); height: 100%; border-radius: 99px; }
.bar-val { font-size: 12.5px; font-weight: 700; text-align: right; }
.pipeline { display: flex; flex-wrap: wrap; gap: 8px; }

/* ===== Responsive ===== */
@media (max-width: 860px) {
  .two-col, .detail-cols, .form-grid { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 720px) {
  .sidebar { position: fixed; left: 0; top: 0; transform: translateX(-100%); transition: transform .25s var(--ease); z-index: 100; }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .nav-scrim { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 90; }
  .menu-toggle { display: block; }
  .content { padding: 18px 16px 50px; }
  .topbar { padding: 12px 16px; }
  .topbar-username { display: none; }
  .match-body { grid-template-columns: 1fr; }
  .match-arrow { transform: rotate(90deg); justify-self: center; }
}
