/* Nuvello Brochure Studio – layout and components. Colours come from tokens.css. */

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--canvas); color: var(--text); font: 15px/1.55 var(--body); -webkit-font-smoothing: antialiased; }
a { color: var(--sage-dark); }
button { font: inherit; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.hidden { display: none !important; }
h1, h2, h3 { color: var(--ink); margin: 0; }
.serif { font-family: var(--head); letter-spacing: .02em; }

/* ---------- Sign-in screen ---------- */
.signin { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background:
  linear-gradient(160deg, var(--forest) 0%, var(--forest-2) 55%, var(--forest-3) 100%); }
.signin-card { width: min(440px, 100%); background: var(--surface); border-radius: 18px; padding: 36px 32px; box-shadow: var(--shadow-lg); text-align: center; border-top: 4px solid var(--gold); }
.signin-card img { width: 84px; height: 84px; }
.signin-card h1 { font: 600 24px/1.2 var(--head); margin: 14px 0 4px; }
.signin-card p { color: var(--muted); margin: 0 0 22px; }
.signin-card .btn { width: 100%; justify-content: center; }
.signin-card .fine { font-size: 12.5px; margin-top: 16px; }

/* ---------- App frame: dark app bar across the top, collapsible sidebar below ---------- */
.app { min-height: 100vh; display: grid; grid-template-columns: var(--sidebar) 1fr; grid-template-rows: auto 1fr;
  grid-template-areas: "bar bar" "side main"; background: linear-gradient(to right, var(--forest) var(--sidebar), transparent 0); }
.app.collapsed { --sidebar: 76px; }
.appbar { grid-area: bar; position: sticky; top: 0; z-index: 20; background: var(--forest-deep); color: var(--on-forest);
  border-bottom: 1px solid rgba(179, 155, 107, .28); display: flex; align-items: center; gap: 16px; padding: 10px 20px; box-shadow: 0 2px 10px rgba(0,0,0,.18); }
.icon-btn { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; border: 0; background: transparent; color: var(--on-forest-muted); cursor: pointer; flex: none; }
.icon-btn:hover { background: rgba(255,255,255,.08); color: var(--on-forest); }
.icon-btn svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; }
.brandmark { display: flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; margin-right: auto; min-width: 0; }
.brandmark img { width: 40px; height: 40px; filter: brightness(0) invert(1); flex: none; }
.brandmark b { display: flex; align-items: center; gap: 10px; font: 600 17px/1.1 var(--head); letter-spacing: .08em; color: var(--gold-light); white-space: nowrap; }
.brandmark em { font: 600 10.5px/1 var(--body); font-style: normal; letter-spacing: .12em; text-transform: uppercase; color: var(--gold-light);
  background: rgba(179,155,107,.16); border: 1px solid rgba(179,155,107,.45); border-radius: 5px; padding: 4px 7px; }
.brandmark small { display: block; margin-top: 3px; font-size: 10.5px; letter-spacing: .16em; text-transform: uppercase; color: var(--on-forest-muted); }
.appbar .pills { gap: 8px; }
.appbar .pill { background: rgba(255,255,255,.06); border-color: rgba(255,255,255,.14); color: var(--on-forest-muted); }
.appbar .pill b { color: var(--on-forest); }
.user { display: flex; align-items: center; gap: 10px; padding-left: 16px; border-left: 1px solid rgba(255,255,255,.12); }
.user-text { line-height: 1.25; text-align: right; }
.user-text b { display: block; color: var(--on-forest); font-size: 13.5px; font-weight: 600; }
.user-text span { font-size: 12px; color: var(--on-forest-muted); }
.role-tag { display: inline-block; margin-left: 6px; font: 600 10px/1 var(--body); letter-spacing: .08em; text-transform: uppercase; color: var(--gold-light);
  background: rgba(179,155,107,.18); border: 1px solid rgba(179,155,107,.5); border-radius: 4px; padding: 3px 6px; vertical-align: 1px; }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: rgba(179,155,107,.22); border: 1px solid rgba(179,155,107,.55); color: var(--gold-light);
  display: grid; place-items: center; font: 600 14px var(--head); flex: none; }

.sidebar { grid-area: side; background: var(--forest); color: var(--on-forest); display: flex; flex-direction: column; position: sticky;
  top: var(--appbar); height: calc(100vh - var(--appbar)); overflow: hidden; transition: width .2s; }
.nav { list-style: none; margin: 14px 0; padding: 0 12px; display: grid; gap: 4px; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 12px; color: var(--on-forest-muted); text-decoration: none;
  font-weight: 500; font-size: 14.5px; border: 1px solid transparent; white-space: nowrap; }
.nav a svg { width: 20px; height: 20px; flex: none; stroke: var(--gold); fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.nav a:hover { background: rgba(255,255,255,.05); color: var(--on-forest); }
.nav a[aria-current="page"] { background: linear-gradient(135deg, var(--gold-dark), var(--gold-deeper)); color: #fff; border-color: rgba(233,223,200,.35); box-shadow: 0 2px 8px rgba(0,0,0,.2); }
.nav a[aria-current="page"] svg { stroke: #fff; }
.nav .tag { margin-left: auto; font: 600 10px/1 var(--body); letter-spacing: .08em; color: var(--gold-light); background: rgba(0,0,0,.22);
  border: 1px solid rgba(179,155,107,.5); border-radius: 4px; padding: 3px 5px; }
.health { margin: 4px 12px; padding: 14px; border-radius: 12px; background: rgba(0,0,0,.22); border: 1px solid rgba(255,255,255,.07); font-size: 12.5px; display: grid; gap: 8px; }
.health-row { display: flex; justify-content: space-between; gap: 8px; color: var(--on-forest-muted); }
.health-row b { font-weight: 600; }
.health-row.small { font-size: 11.5px; }
.meter.dark { background: rgba(255,255,255,.1); height: 6px; }
.meter.dark i { background: var(--gold); }
.side-foot { margin-top: auto; padding: 16px 20px; font-size: 12px; color: var(--on-forest-muted); border-top: 1px solid rgba(255,255,255,.08); white-space: nowrap; }
.side-foot .dev { display: inline-block; margin-bottom: 6px; color: var(--forest); background: var(--gold); border-radius: 20px; padding: 2px 10px; font-weight: 600; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; }
.app.collapsed .nav-label, .app.collapsed .nav .tag, .app.collapsed .health, .app.collapsed .side-foot { display: none; }
.app.collapsed .nav a { justify-content: center; padding: 12px 0; }

.content { grid-area: main; padding: 24px 28px 48px; min-width: 0; max-width: 1360px; width: 100%; }
.page-head { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head h1 { font: 600 22px/1.2 var(--head); letter-spacing: .03em; }

/* Metric cards across the top */
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 22px; }
.metric { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 16px 18px; box-shadow: var(--shadow); display: flex; gap: 14px; align-items: center; min-width: 0; }
.metric-icon { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; flex: none; border: 1px solid transparent; }
.metric-icon svg { width: 23px; height: 23px; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.m-gold { color: var(--gold-deeper); background: var(--gold-wash); border-color: var(--gold-soft); }
.m-ok { color: var(--ok); background: var(--ok-bg); }
.m-warn { color: var(--warn); background: var(--warn-bg); }
.m-bad { color: var(--bad); background: var(--bad-bg); }
.m-info, .m-neutral { color: var(--info); background: var(--info-bg); }
.metric-label { font-size: 11px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.metric-value { font: 600 21px/1.25 var(--body); color: var(--ink); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.metric-value small { font-size: 12.5px; font-weight: 500; color: var(--muted); }
.metric-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.t-ok { color: var(--ok); } .t-warn { color: var(--warn); } .t-bad { color: var(--bad); } .t-info { color: var(--info); } .t-neutral { color: var(--neutral); }
.appbar .t-ok, .health .t-ok { color: #8FD19E; } .appbar .t-warn, .health .t-warn { color: #F0C674; } .appbar .t-bad, .health .t-bad { color: #F2A096; } .health .t-neutral { color: var(--on-forest-muted); }

/* ---------- Building blocks ---------- */
.grid { display: grid; gap: 18px; align-content: start; }
.cols-2 { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); min-width: 0; }
.card h2 { font: 600 16px var(--body); margin-bottom: 4px; }
.card .sub { color: var(--muted); font-size: 13.5px; margin: 0 0 16px; }
.card-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.card-head h2 { margin: 0 auto 0 0; }
.eyebrow { font-size: 11.5px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--sage-dark); }

.btn { display: inline-flex; align-items: center; gap: 8px; padding: 11px 18px; border-radius: var(--radius-sm); border: 1px solid transparent; font-weight: 600; font-size: 14.5px; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.btn-primary { background: var(--forest); color: var(--on-forest); }
.btn-primary:hover { background: var(--forest-3); }
.btn-primary:disabled { background: #8D928A; cursor: not-allowed; }
.btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--sage); }
.btn-quiet { background: transparent; color: var(--muted); padding: 8px 10px; }
.btn-quiet:hover { color: var(--ink); }
.btn-ms { background: var(--forest); color: var(--on-forest); }
.btn-ms .ms { width: 18px; height: 18px; display: grid; grid-template-columns: 1fr 1fr; gap: 2px; }
.btn-ms .ms i { display: block; }
.btn-ms .ms i:nth-child(1) { background: #F25022; } .btn-ms .ms i:nth-child(2) { background: #7FBA00; }
.btn-ms .ms i:nth-child(3) { background: #00A4EF; } .btn-ms .ms i:nth-child(4) { background: #FFB900; }

.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; line-height: 1.6; }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.plain::before { display: none; }
.b-ok { color: var(--ok); background: var(--ok-bg); }
.b-warn { color: var(--warn); background: var(--warn-bg); }
.b-bad { color: var(--bad); background: var(--bad-bg); }
.b-info { color: var(--info); background: var(--info-bg); }
.b-neutral { color: var(--neutral); background: var(--neutral-bg); }
.b-role { color: var(--forest); background: var(--gold-soft); }
.pill { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font-size: 12.5px; }
.pill b { color: var(--ink); font-weight: 600; }
.dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.dot.ok { background: var(--ok); } .dot.warn { background: #C98A0B; } .dot.bad { background: var(--bad); } .dot.neutral { background: #9A9C95; }

.field { display: grid; gap: 6px; }
.field label, .label { font-size: 12.5px; font-weight: 600; color: var(--ink); }
input[type=text], input[type=search], select { font: inherit; padding: 12px 14px; border: 1px solid #C9C3B5; border-radius: var(--radius-sm); background: var(--surface); color: var(--ink); width: 100%; min-width: 0; }
input:focus, select:focus { outline: 3px solid var(--gold-soft); border-color: var(--sage-dark); }
.ref-row { display: flex; gap: 10px; }
.ref-row input { flex: 1; font-size: 16px; }
.opts { display: flex; gap: 18px; align-items: end; flex-wrap: wrap; margin-top: 14px; }
.opts .field { min-width: 190px; }
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 14px; color: var(--ink); user-select: none; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .track { width: 40px; height: 22px; border-radius: 22px; background: #CFCAC0; position: relative; transition: background .15s; flex: none; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + .track { background: var(--forest); }
.switch input:checked + .track::after { transform: translateX(18px); }
.switch input:focus-visible + .track { outline: 3px solid var(--gold); outline-offset: 2px; }
.hint { font-size: 12.5px; color: var(--muted); }

.msg { border-radius: var(--radius-sm); padding: 12px 14px; font-size: 14px; margin-top: 14px; border-left: 4px solid currentColor; }
.msg.error { color: var(--bad); background: var(--bad-bg); }
.msg.info { color: var(--info); background: var(--info-bg); }
.msg.warn { color: var(--warn); background: var(--warn-bg); }

.btn-gold { background: linear-gradient(135deg, var(--gold-dark), var(--gold-deeper)); color: #fff; box-shadow: 0 2px 8px rgba(118, 89, 44, .25); }
.btn-gold:hover { background: linear-gradient(135deg, #7E6233, #654B24); }
.btn-gold:disabled { background: #A79F8F; box-shadow: none; cursor: not-allowed; }
.btn-block { width: 100%; justify-content: center; padding: 14px 18px; }
.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spin { animation: none; } }

/* ---------- Studio ---------- */
.preview { display: grid; grid-template-columns: 220px 1fr; gap: 18px; align-items: start; }
.photo { position: relative; border-radius: 10px; overflow: hidden; background: var(--sand); aspect-ratio: 4 / 3; }
.photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo .count { position: absolute; right: 8px; bottom: 8px; background: rgba(37,47,40,.82); color: #fff; font-size: 12px; padding: 2px 8px; border-radius: 20px; }
.preview h3 { font: 600 18px/1.3 var(--head); letter-spacing: .02em; margin: 6px 0 4px; }
.place { color: var(--muted); font-size: 14px; }
.price { font: 600 20px var(--head); color: var(--sage-dark); margin: 10px 0; }
.stats { display: flex; gap: 16px; flex-wrap: wrap; font-size: 14px; color: var(--ink); }
.stats span { display: inline-flex; align-items: center; gap: 6px; }
.stats svg { width: 18px; height: 18px; stroke: var(--sage-dark); fill: none; stroke-width: 1.6; }
.meta-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.skeleton { background: linear-gradient(90deg, var(--sand-2), #F3EEE4, var(--sand-2)); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: 6px; }
@keyframes shimmer { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .skeleton { animation: none; } }

.stepper { list-style: none; margin: 18px 0 0; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; counter-reset: s; }
.stepper li { counter-increment: s; padding: 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--canvas); font-size: 13.5px; color: var(--muted); position: relative; }
.stepper li::before { content: counter(s); display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--sand-2); color: var(--ink); font-weight: 600; font-size: 12px; margin-right: 8px; }
.stepper li.now { border-color: var(--gold); background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: 0 0 0 3px var(--gold-soft); }
.stepper li.now::before { background: var(--gold); color: var(--forest); }
.stepper li.done { color: var(--ok); }
.stepper li.done::before { content: "✓"; background: var(--ok-bg); color: var(--ok); }
.bar { height: 6px; border-radius: 6px; background: var(--sand-2); overflow: hidden; margin-top: 10px; }
.bar i { display: block; height: 100%; background: var(--forest); width: 0; transition: width .3s; }

.result { display: grid; grid-template-columns: minmax(0, 340px) 1fr; gap: 20px; align-items: start; }
.thumb { width: 100%; aspect-ratio: 297 / 210; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); background: var(--sand); cursor: zoom-in; display: block; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 0 0 14px; font-size: 14px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; color: var(--ink); overflow-wrap: anywhere; }
.warnings { list-style: none; margin: 0 0 16px; padding: 0; display: grid; gap: 8px; }
.warnings li { color: var(--warn); background: var(--warn-bg); border-left: 4px solid #C98A0B; border-radius: 8px; padding: 9px 12px; font-size: 13.5px; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; }

.today { display: grid; gap: 12px; }
.today .num { font: 600 30px/1 var(--head); color: var(--ink); }
.meter { height: 8px; border-radius: 8px; background: var(--sand-2); overflow: hidden; }
.meter i { display: block; height: 100%; width: 0; background: var(--sage-dark); }
.meter.warn i { background: #C98A0B; } .meter.bad i { background: var(--bad); }
.list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; font-size: 14px; }
.list li { display: flex; gap: 10px; align-items: flex-start; }
.list svg { width: 18px; height: 18px; flex: none; stroke: var(--sage-dark); fill: none; stroke-width: 1.8; margin-top: 2px; }

/* ---------- Gallery ---------- */
.toolbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 18px; }
.toolbar input[type=search] { max-width: 340px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--surface); }
.seg button { border: 0; background: transparent; padding: 9px 14px; cursor: pointer; color: var(--muted); font-weight: 600; font-size: 13.5px; }
.seg button[aria-pressed="true"] { background: var(--forest); color: var(--on-forest); }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.tile button.open { border: 0; padding: 0; background: var(--sand); cursor: zoom-in; display: block; position: relative; }
.tile button.open img { width: 100%; aspect-ratio: 297 / 210; object-fit: cover; display: block; }
.tile .corner { position: absolute; left: 10px; top: 10px; display: flex; gap: 6px; }
.tile .body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.tile h3 { font: 600 15px/1.3 var(--head); letter-spacing: .02em; }
.tile .ref { font-size: 12.5px; color: var(--muted); }
.tile .line { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; color: var(--muted); }
.tile .price { font-size: 16px; margin: 2px 0; }
.tile .actions { margin-top: auto; padding-top: 10px; }
.tile .actions .btn { padding: 8px 12px; font-size: 13.5px; }
.empty { text-align: center; padding: 48px 16px; color: var(--muted); }
.empty svg { width: 46px; height: 46px; stroke: var(--sage); fill: none; stroke-width: 1.4; }

/* ---------- Modal ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(20, 26, 22, .62); display: grid; place-items: center; padding: 20px; z-index: 50; }
.modal { background: var(--surface); border-radius: 16px; width: min(980px, 100%); max-height: calc(100vh - 40px); overflow: auto; box-shadow: var(--shadow-lg); }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); }
.modal-head h2 { font: 600 17px var(--head); margin-right: auto; }
.modal-body { padding: 20px; display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 20px; }
.modal-body img { width: 100%; border-radius: 10px; border: 1px solid var(--line); display: block; }

/* ---------- Governance ---------- */
.gauges { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.gauge { text-align: center; }
.gauge svg { width: 100%; max-width: 240px; height: auto; display: block; margin: 0 auto; }
.gauge .g-val { font: 600 24px var(--head); fill: var(--ink); }
.gauge .g-sub { font: 500 11px var(--body); fill: var(--muted); }
.gauge h3 { font-size: 14px; margin-top: 4px; }
.gauge p { margin: 2px 0 0; font-size: 12.5px; color: var(--muted); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; }
.kpi { background: var(--canvas); border: 1px solid var(--line); border-radius: 10px; padding: 14px; }
.kpi .v { font: 600 24px/1.1 var(--head); color: var(--ink); }
.kpi .k { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.kpi .badge { margin-top: 8px; }
.chart svg { width: 100%; height: auto; display: block; }
.chart .axis { font: 11px var(--body); fill: var(--muted); }
.chart .val { font: 600 11px var(--body); fill: var(--ink); }
.legend { display: flex; gap: 14px; font-size: 12.5px; color: var(--muted); margin-top: 8px; flex-wrap: wrap; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.lg-sage { background: #6F7159; } .lg-red { background: #8E2B22; } .lg-forest { background: #252F28; } .lg-gold { background: #B39B6B; }
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; padding: 8px 10px; border-bottom: 1px solid var(--line); }
table.data td { padding: 10px; border-bottom: 1px solid var(--line); color: var(--ink); vertical-align: top; }
table.data tr:last-child td { border-bottom: 0; }
.num { font-variant-numeric: tabular-nums; }
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.timeline li { display: grid; grid-template-columns: 130px 1fr; gap: 12px; font-size: 13.5px; }
.timeline time { color: var(--muted); font-size: 12.5px; }

/* ---------- SOP ---------- */
.steps-row { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; counter-reset: q; }
.qs { background: var(--canvas); border: 1px solid var(--line); border-radius: 10px; padding: 14px; counter-increment: q; font-size: 13.5px; }
.qs::before { content: counter(q); display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--forest); color: var(--gold); font: 600 14px var(--head); margin-bottom: 10px; }
.qs b { display: block; color: var(--ink); margin-bottom: 4px; }
.rules { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.rule { display: flex; gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); font-size: 13.5px; }
.rule .n { font: 600 18px var(--head); color: var(--gold); min-width: 22px; }
.rule b { display: block; color: var(--ink); }
details.faq { border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
details.faq + details.faq { margin-top: 10px; }
details.faq summary { cursor: pointer; padding: 14px 16px; font-weight: 600; color: var(--ink); list-style: none; display: flex; justify-content: space-between; gap: 12px; }
details.faq summary::after { content: "+"; color: var(--sage-dark); font-size: 18px; line-height: 1; }
details.faq[open] summary::after { content: "–"; }
details.faq p { margin: 0; padding: 0 16px 14px; font-size: 14px; }
.deck { width: 100%; aspect-ratio: 16 / 9; border: 1px solid var(--line); border-radius: 10px; background: #2b2b28; display: block; }

/* ---------- Toast ---------- */
.toast { position: fixed; right: 20px; bottom: 20px; z-index: 60; background: var(--forest); color: var(--on-forest); padding: 12px 16px; border-radius: 10px; box-shadow: var(--shadow-lg); font-size: 14px; max-width: 360px; }

/* ---------- Responsive: 375 px phones (UI-06) ---------- */
@media (max-width: 1180px) {
  .cols-2, .cols-3, .studio-grid { grid-template-columns: 1fr; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .steps-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .appbar .pill span.lbl { display: none; }
}
@media (max-width: 760px) {
  .app, .app.collapsed { grid-template-columns: 1fr; grid-template-areas: "bar" "main"; background: none; --sidebar: 0px; }
  .appbar { padding: 8px 12px; gap: 8px; flex-wrap: wrap; }
  .menu, .brandmark small, .brandmark em, .user-text { display: none; }
  .brandmark img { width: 32px; height: 32px; }
  .brandmark b { font-size: 15px; }
  .appbar .pills { order: 3; width: 100%; }
  .user { border-left: 0; padding-left: 0; }
  .sidebar { position: fixed; bottom: 0; top: auto; left: 0; right: 0; height: auto; z-index: 30; flex-direction: row; }
  .health, .side-foot { display: none; }
  .nav { grid-template-columns: repeat(var(--tabs, 4), 1fr); margin: 0; padding: 6px; width: 100%; gap: 2px; }
  .nav a { flex-direction: column; gap: 3px; padding: 7px 4px; font-size: 11px; border-radius: 10px; text-align: center; white-space: normal; }
  .app.collapsed .nav-label { display: inline; }
  .nav .tag { display: none; }
  .content { padding: 16px 16px 96px; }
  .page-head h1 { font-size: 18px; }
  .metrics { grid-template-columns: 1fr 1fr; gap: 10px; }
  .metric { padding: 12px; gap: 10px; flex-direction: column; align-items: flex-start; }
  .metric-icon { width: 36px; height: 36px; }
  .metric-value { font-size: 17px; white-space: normal; }
  .preview, .result, .modal-body, .gauges, .rules, .hero-stats { grid-template-columns: 1fr; }
  .stepper { grid-template-columns: 1fr 1fr; }
  .ref-row { flex-direction: column; }
  .ref-row .btn { justify-content: center; }
  .timeline li { grid-template-columns: 1fr; gap: 2px; }
  .steps-row { grid-template-columns: 1fr; }
  .hero { min-height: 240px; }
  .hero h3 { font-size: 19px; }
}

/* ---------- Studio v2: search card, hero property card, settings panel ---------- */
.search { position: relative; flex: 1; }
.search svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 20px; height: 20px; stroke: var(--muted); fill: none; stroke-width: 1.8; pointer-events: none; }
.search input { padding-left: 44px; font-weight: 600; letter-spacing: .02em; background: var(--canvas); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 14px; font-size: 12.5px; color: var(--muted); }
.chip { border: 1px solid var(--line); background: var(--canvas); color: var(--ink); border-radius: 8px; padding: 5px 10px; font: 600 12px var(--body); cursor: pointer; letter-spacing: .02em; }
.chip:hover { border-color: var(--gold); background: var(--gold-wash); }
.studio-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.hero-card { padding: 0; overflow: hidden; }
.hero { position: relative; min-height: 300px; background: var(--forest); display: flex; align-items: flex-end; }
.hero img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(20,26,22,.15) 0%, rgba(20,26,22,.1) 40%, rgba(20,26,22,.82) 100%); }
.hero .tags { position: absolute; top: 14px; left: 14px; z-index: 1; display: flex; gap: 8px; flex-wrap: wrap; }
.hero .tag-ref { font: 600 12px var(--body); letter-spacing: .04em; color: var(--gold-light); background: rgba(20,26,22,.72); border: 1px solid rgba(179,155,107,.5); border-radius: 999px; padding: 4px 11px; }
.hero .count { z-index: 1; }
.hero .caption { position: relative; z-index: 1; padding: 18px 20px; color: #fff; }
.hero .caption .eyebrow { color: var(--gold-light); }
.hero h3 { font: 600 23px/1.25 var(--head); letter-spacing: .02em; color: #fff; margin: 4px 0; }
.hero .place { color: #E7E4DC; }
.hero-body { padding: 18px 20px 20px; }
.hero-stats { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding-bottom: 14px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.hero-stats .price { margin: 0; font-size: 24px; color: var(--gold-deeper); }
.note { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; background: var(--gold-wash); border: 1px solid var(--gold-soft); font-size: 13px; color: var(--text); }
.note svg { width: 20px; height: 20px; flex: none; stroke: var(--gold-deeper); fill: none; stroke-width: 1.7; margin-top: 1px; }
.note b { color: var(--ink); display: block; }
.hero-empty { padding: 40px 24px; text-align: center; color: var(--muted); }
.hero-empty svg { width: 46px; height: 46px; stroke: var(--gold); fill: none; stroke-width: 1.4; }
.settings h2 { font: 600 16px var(--head); letter-spacing: .03em; padding-bottom: 12px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.settings .group { margin-bottom: 16px; }
.lang { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.lang button { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--canvas); color: var(--ink); font: 600 13px var(--body); cursor: pointer; }
.lang button svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.7; }
.lang button[aria-pressed="true"] { background: var(--forest); color: var(--on-forest); border-color: var(--forest); }
.lang button:disabled { color: #8D908A; cursor: not-allowed; background: var(--surface); }
.toggle-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--canvas); }
.toggle-row b { display: block; color: var(--ink); font-size: 13.5px; }
.settings .foot { padding-top: 16px; border-top: 1px solid var(--line); margin-top: 6px; }
.settings .foot .hint { text-align: center; margin: 8px 0 0; }

/* ---------- Gallery table view ---------- */
.table-card { padding: 0; overflow: hidden; }
.table-card table.data th { background: var(--canvas); padding: 12px 14px; }
.table-card table.data td { padding: 12px 14px; }
.table-card .ref-cell { font-weight: 600; color: var(--gold-deeper); white-space: nowrap; }
.row-actions { display: flex; gap: 4px; justify-content: flex-end; }
.row-actions .icon-btn { color: var(--muted); width: 34px; height: 34px; }
.row-actions .icon-btn:hover { color: var(--ink); background: var(--canvas); }
.row-actions .icon-btn svg { width: 18px; height: 18px; }

/* ---------- Governance: dark rate-limit panel ---------- */
.panel-dark { background: var(--forest-deep); color: var(--on-forest); border: 1px solid rgba(179,155,107,.25); border-radius: 16px; padding: 22px; box-shadow: var(--shadow); }
.panel-dark .card-head { border-bottom: 1px solid rgba(255,255,255,.1); padding-bottom: 14px; margin-bottom: 18px; }
.panel-dark h2 { color: #fff; font: 600 19px var(--head); letter-spacing: .03em; }
.panel-dark .eyebrow-tag { font: 600 10.5px var(--body); letter-spacing: .12em; text-transform: uppercase; color: var(--gold-light); background: rgba(179,155,107,.16); border: 1px solid rgba(179,155,107,.45); border-radius: 5px; padding: 3px 8px; }
.panel-dark .hint, .panel-dark .gauge p { color: var(--on-forest-muted); }
.panel-dark .gauge h3 { color: var(--on-forest); }
.panel-dark .gauge .g-val { fill: #fff; }
.panel-dark .gauge .g-sub { fill: var(--on-forest-muted); }
.limit-bars { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-top: 18px; }
.limit { background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.1); border-radius: 12px; padding: 14px; font-size: 12.5px; }
.limit .top { display: flex; justify-content: space-between; gap: 8px; color: var(--on-forest-muted); margin-bottom: 8px; }
.limit .top b { color: var(--gold-light); font-variant-numeric: tabular-nums; }
.limit .meter { background: rgba(255,255,255,.12); }
.limit .meter i { background: var(--gold); }
.limit p { margin: 8px 0 0; font-size: 11.5px; color: var(--on-forest-muted); }
.armed { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--on-forest-muted); }
@media (max-width: 760px) { .limit-bars { grid-template-columns: 1fr; } .studio-grid { grid-template-columns: 1fr; } }
.seg button svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.7; vertical-align: -4px; }
/* Fixes: long metric values truncate instead of widening the page; photo count on the hero; no focus ring on the view container */
.metric > div:last-child { min-width: 0; flex: 1; }
.metric-sub { overflow-wrap: anywhere; }
.hero .count { position: absolute; right: 14px; top: 14px; bottom: auto; z-index: 1; background: rgba(20, 26, 22, .72); color: #fff; font-size: 12px; padding: 3px 10px; border-radius: 20px; }
#view:focus { outline: none; }
.metric-value { white-space: normal; font-size: 19px; line-height: 1.2; overflow-wrap: anywhere; }

/* ---------- /embed: frameless view inside an iframe on nuvellorealestate.ae ---------- */
.app.embed { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; grid-template-areas: "side" "main"; background: none; min-height: 0; }
.app.embed .appbar, .app.embed .health, .app.embed .side-foot, .app.embed .page-head { display: none; }
.app.embed .sidebar { position: static; height: auto; flex-direction: row; border-radius: 12px; margin: 12px 12px 0; }
.app.embed .nav { display: flex; flex-wrap: wrap; margin: 0; padding: 6px; gap: 4px; width: 100%; }
.app.embed .nav a { padding: 8px 14px; font-size: 14px; }
.app.embed .nav .tag { display: none; }
.app.embed .content { padding: 14px 12px 24px; max-width: none; }
.signin.in-frame { min-height: 420px; background: var(--canvas); }
.signin.in-frame .signin-card { box-shadow: none; border: 1px solid var(--line); border-top: 4px solid var(--gold); }
