/* UI style experiments — driven by data-ui-* attributes that js/components/ui-style-toolbar.js sets on
   <html>. The app's real look lives in styles.css; every rule here targets a non-default value, so
   without those attributes nothing here applies. "standard"/"medium"/"plain"/"grid"/"inter"/"normal"
   restore the look styles.css had before the 2026-11-10 restyle. !important is used only where the
   markup (or styles.css, for the same reason) sets the property inline. */

/* ── Floating toolbar ─────────────────────────────────────────────────────── */
.ui-style-toolbar {
  position:fixed; z-index:9500; right:16px; bottom:16px;
  width:360px; max-width:calc(100vw - 32px); max-height:calc(100vh - 32px);
  display:flex; flex-direction:column;
  background:var(--bg); color:var(--gray-800); border:1px solid var(--gray-300); border-radius:8px;
  box-shadow:0 12px 32px rgba(15,23,42,.18),0 2px 6px rgba(15,23,42,.08);
  font-family:system-ui,-apple-system,'Segoe UI',sans-serif; font-size:12px; line-height:1.4;
}
.ui-style-toolbar.collapsed { width:auto; }
.ui-style-toolbar-head {
  display:flex; align-items:center; gap:.4rem; padding:6px 8px; cursor:grab; user-select:none; touch-action:none;
  border-bottom:1px solid var(--gray-200); background:var(--gray-50); border-radius:8px 8px 0 0;
}
.ui-style-toolbar.collapsed .ui-style-toolbar-head { border-bottom:none; border-radius:8px; }
.ui-style-toolbar.dragging, .ui-style-toolbar.dragging .ui-style-toolbar-head { cursor:grabbing; }
.ui-style-grip { color:var(--gray-400); letter-spacing:-2px; font-size:14px; line-height:1; }
.ui-style-toolbar-title { font-weight:700; color:var(--gray-600); text-transform:uppercase; letter-spacing:.06em; font-size:10.5px; white-space:nowrap; }
.ui-style-toolbar-body { padding:8px 10px 10px; overflow-y:auto; }
.ui-style-presets { display:flex; gap:4px; flex-wrap:wrap; }
.ui-style-chip { border:1px solid var(--gray-300); background:var(--bg); color:var(--gray-600); border-radius:999px; padding:2px 9px; font:inherit; font-size:11.5px; cursor:pointer; }
.ui-style-chip:hover { border-color:var(--primary); color:var(--primary); }
.ui-style-chip.active { background:var(--primary); border-color:var(--primary); color:#fff; }
.ui-style-chip.custom { cursor:default; background:var(--gray-600); border-color:var(--gray-600); }
.ui-style-link { background:none; border:none; color:var(--primary); font:inherit; font-size:11.5px; font-weight:600; cursor:pointer; padding:2px 4px; white-space:nowrap; }
.ui-style-icon-btn { background:none; border:none; color:var(--gray-500); font:inherit; font-size:14px; line-height:1; cursor:pointer; padding:2px 4px; border-radius:4px; }
.ui-style-icon-btn:hover { background:var(--gray-200); color:var(--gray-800); }
.ui-style-axes { display:grid; grid-template-columns:1fr 1fr; gap:6px 10px; margin-top:8px; padding-top:8px; border-top:1px solid var(--gray-100); }
.ui-style-axis { display:flex; flex-direction:column; gap:2px; color:var(--gray-500); font-weight:600; font-size:11px; }
.ui-style-axis.changed span { color:var(--primary); }
.ui-style-axis select { font:inherit; font-size:12px; font-weight:400; padding:3px 4px; border:1px solid var(--gray-300); border-radius:4px; background:var(--bg); color:var(--gray-800); }
.ui-style-actions { display:flex; justify-content:flex-end; gap:4px; margin-top:8px; }

/* ── Theme ────────────────────────────────────────────────────────────────── */
html[data-ui-theme="slate"] {
  --primary:#334155; --primary-dark:#1e293b; --primary-light:#f1f5f9; --bg-page:#f8fafc;
}
html[data-ui-theme="indigo"] {
  --primary:#4f46e5; --primary-dark:#4338ca; --primary-light:#eef2ff; --bg-page:#f5f7ff;
  --shadow-md:0 4px 20px rgba(79,70,229,.1),0 2px 6px rgba(0,0,0,.06);
}
html[data-ui-theme="emerald"] {
  --primary:#059669; --primary-dark:#047857; --primary-light:#d1fae5; --bg-page:#f3faf7;
}
html[data-ui-theme="warm"] {
  --primary:#c2410c; --primary-dark:#9a3412; --primary-light:#ffedd5; --bg-page:#fafaf9;
  --gray-50:#fafaf9; --gray-100:#f5f5f4; --gray-200:#e7e5e4; --gray-300:#d6d3d1; --gray-400:#a8a29e;
  --gray-500:#78716c; --gray-600:#57534e; --gray-700:#44403c; --gray-800:#292524; --gray-900:#1c1917;
}
html[data-ui-theme="dark"] {
  color-scheme:dark;
  --primary:#38bdf8; --primary-dark:#0ea5e9; --primary-light:#0c2a3a;
  --gray-50:#1a212c; --gray-100:#212936; --gray-200:#2b3442; --gray-300:#3a4555; --gray-400:#64748b;
  --gray-500:#8b98aa; --gray-600:#a8b3c2; --gray-700:#c5cdd8; --gray-800:#e2e8f0; --gray-900:#f8fafc;
  --bg:#141a23; --bg-page:#0d1117;
  --shadow:0 1px 4px rgba(0,0,0,.4); --shadow-md:0 4px 20px rgba(0,0,0,.5);
}
html[data-ui-theme="dark"] .typeahead-dropdown { background:var(--bg); }
html[data-ui-theme="dark"] .btn-primary { color:#0d1117; }
html[data-ui-theme="dark"] .alert-success { background:rgba(16,185,129,.12); border-color:rgba(16,185,129,.35); color:#6ee7b7; }
html[data-ui-theme="dark"] .alert-error   { background:rgba(239,68,68,.12); border-color:rgba(239,68,68,.35); color:#fca5a5; }
html[data-ui-theme="dark"] .alert-warning { background:rgba(245,158,11,.12); border-color:rgba(245,158,11,.35); color:#fcd34d; }
html[data-ui-theme="dark"] .alert-info    { border-color:rgba(56,189,248,.35); }
html[data-ui-theme="dark"] .badge { filter:saturate(.8) brightness(.9); }
html[data-ui-theme="dark"] .page-heading { color:var(--gray-900); }

/* ── Page background ──────────────────────────────────────────────────────── */
html[data-ui-bg="white"] { --bg-page:var(--bg); }
html[data-ui-bg="grey"]  { --bg-page:var(--gray-100); }

/* ── Font & text size ─────────────────────────────────────────────────────── */
html[data-ui-font="inter"] body  { font-family:'Inter',system-ui,sans-serif; }
html[data-ui-font="system"] body { font-family:system-ui,-apple-system,'Segoe UI',Roboto,sans-serif; }
html[data-ui-font="manrope"] body{ font-family:'Manrope',system-ui,sans-serif; }
html[data-ui-text="normal"] { font-size:100%; }
html[data-ui-text="lg"] { font-size:106.25%; }

/* ── Corners ──────────────────────────────────────────────────────────────── */
html[data-ui-corners="medium"] { --radius:10px; --radius-sm:6px; }
html[data-ui-corners="round"],
html[data-ui-corners="pill"]  { --radius:16px; --radius-sm:10px; }
html[data-ui-corners="pill"] .page-content .btn { border-radius:999px; }

/* ── Density (default = compact, in styles.css) ───────────────────────────── */
html[data-ui-density="standard"] .page-content { padding:1.5rem; }
html[data-ui-density="standard"] .invoice-layout .card { margin-bottom:1rem !important; }
html[data-ui-density="standard"] .page-content .card-header { padding:.875rem 1.25rem; }
html[data-ui-density="standard"] .page-content .card-body { padding:1.25rem; }
html[data-ui-density="standard"] .page-content .detail-footer { padding:.75rem 1.25rem; }
html[data-ui-density="standard"] .page-content .lines-table th,
html[data-ui-density="standard"] .page-content .lines-table td { padding:.5rem .625rem; }
html[data-ui-density="standard"] .page-content .page-header { margin-bottom:1.25rem; }
html[data-ui-density="standard"] .page-content .back-btn { margin-bottom:1rem; }

html[data-ui-density="comfortable"] .page-content { padding:2rem; }
html[data-ui-density="comfortable"] .invoice-layout .card { margin-bottom:1.5rem !important; }
html[data-ui-density="comfortable"] .page-content .card-header { padding:1.125rem 1.5rem; }
html[data-ui-density="comfortable"] .page-content .card-body { padding:1.75rem 1.5rem; }
html[data-ui-density="comfortable"] .page-content .detail-footer { padding:1rem 1.5rem; }
html[data-ui-density="comfortable"] .page-content .lines-table th,
html[data-ui-density="comfortable"] .page-content .lines-table td { padding:.8rem .875rem; }
html[data-ui-density="comfortable"] .page-content .page-header { margin-bottom:1.75rem; }
html[data-ui-density="comfortable"] .page-content .back-btn { margin-bottom:1rem; }

/* ── Cards ────────────────────────────────────────────────────────────────── */
html[data-ui-cards="flat"] .page-content .card { box-shadow:none; }
html[data-ui-cards="elevated"] .page-content .card { border-color:transparent; box-shadow:0 6px 20px rgba(15,23,42,.07),0 1px 3px rgba(15,23,42,.06); }
html[data-ui-cards="outline"] .page-content .card { border:1.5px solid var(--gray-300); box-shadow:none; }
html[data-ui-cards="accent"] .page-content .card { border-top:3px solid var(--primary); box-shadow:none; }
html[data-ui-cards="borderless"] .page-content .card { background:transparent; border:none; box-shadow:none; border-radius:0; }
html[data-ui-cards="borderless"] .page-content .card-header { padding-left:0; padding-right:0; border-bottom:2px solid var(--gray-200); }
html[data-ui-cards="borderless"] .page-content .card-body { padding-left:0; padding-right:0; }
html[data-ui-cards="borderless"] .page-content .detail-footer { padding-left:0; padding-right:0; }
html[data-ui-cards="borderless"] .page-content .card-title { font-size:1rem; }

/* ── Page header (default = tinted, in styles.css) ────────────────────────── */
html[data-ui-header="plain"] .page-content .page-header,
html[data-ui-header="band"] .page-content .page-header { border-left:none; }
html[data-ui-header="plain"] .page-content .page-header { background:none; border-radius:0; padding:0; }
html[data-ui-header="plain"] .page-content .page-heading,
html[data-ui-header="band"] .page-content .page-heading { color:var(--gray-900); }
html[data-ui-header="band"] .page-content .page-header {
  background:var(--bg); border:1px solid var(--gray-200); border-radius:var(--radius); box-shadow:var(--shadow);
}

/* ── Fields (default = "label : value" rows, in styles.css) ───────────────── */
html[data-ui-fields="grid"] .detail-grid,
html[data-ui-fields="tiles"] .detail-grid { grid-template-columns:repeat(auto-fill,minmax(180px,1fr)); column-gap:.875rem; row-gap:.5rem; }
html[data-ui-fields="grid"][data-ui-density="standard"] .detail-grid { gap:1rem; }
html[data-ui-fields="grid"][data-ui-density="comfortable"] .detail-grid { gap:1.5rem 1.75rem; }
html[data-ui-fields="tiles"] .detail-grid { gap:.625rem; }
html[data-ui-fields="grid"] .detail-field,
html[data-ui-fields="tiles"] .detail-field { display:block; padding:0; border-bottom:none; }
html[data-ui-fields="grid"] .detail-field label,
html[data-ui-fields="tiles"] .detail-field label { min-width:0; margin-bottom:.25rem; }
html[data-ui-fields="grid"] .detail-field > span,
html[data-ui-fields="grid"] .detail-field > div,
html[data-ui-fields="tiles"] .detail-field > span,
html[data-ui-fields="tiles"] .detail-field > div { text-align:left; }
html[data-ui-fields="grid"] .detail-field > .form-input,
html[data-ui-fields="grid"] .detail-field > .form-select,
html[data-ui-fields="tiles"] .detail-field > .form-input,
html[data-ui-fields="tiles"] .detail-field > .form-select { margin-top:.25rem !important; }
html[data-ui-fields="tiles"] .detail-field { background:var(--gray-50); border:1px solid var(--gray-100); border-radius:var(--radius-sm); padding:.625rem .75rem; }
html[data-ui-fields="tiles"] .detail-field > span { font-size:.9rem; font-weight:500; }

/* ── Labels ───────────────────────────────────────────────────────────────── */
html[data-ui-labels="sentence"] .page-content .detail-field label,
html[data-ui-labels="sentence"] .page-content th,
html[data-ui-labels="sentence"] .page-content .form-label,
html[data-ui-labels="sentence"] .page-content .doc-panel-analysis-header {
  text-transform:none; letter-spacing:0; font-weight:500; font-size:.78rem;
}

/* ── Tables ───────────────────────────────────────────────────────────────── */
html[data-ui-table="striped"] .page-content tbody tr:nth-child(even) { background:var(--gray-50); }
html[data-ui-table="grid"] .page-content th,
html[data-ui-table="grid"] .page-content td { border:1px solid var(--gray-200); }
html[data-ui-table="minimal"] .page-content thead tr { background:transparent; border-bottom:2px solid var(--gray-300); }
html[data-ui-table="minimal"] .page-content td { border-bottom-color:transparent; }
html[data-ui-table="minimal"] .page-content tbody tr:hover { background:var(--primary-light); }

/* ── Numbers ──────────────────────────────────────────────────────────────── */
html[data-ui-numbers="tabular"] .page-content table,
html[data-ui-numbers="tabular"] .page-content .detail-footer { font-variant-numeric:tabular-nums; }
