/* Explore Island TAMS — palette taken from the Explore Island logo */
:root {
  --navy: #1f3846;
  --navy-700: #182d39;
  --navy-600: #2a4a5c;
  --navy-100: #e3eaee;
  --navy-50: #f1f5f7;
  --coral: #d97e81;
  --coral-600: #c4666a;
  --coral-100: #f8e4e5;
  --coral-50: #fcf3f3;
  --ink: #272425;
  --muted: #6b7479;
  --line: #e4e1dc;
  --sand: #f7f4ef;
  --card: #ffffff;
  --lagoon: #3f8f93;
  --lagoon-100: #dcefef;
  --sun: #d9a441;
  --sun-100: #f8eed8;
  --danger: #b4474b;
  --danger-100: #f6dfe0;
  --ok: #2f7d5b;
  --ok-100: #dcefe5;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(31, 56, 70, .06), 0 4px 16px rgba(31, 56, 70, .06);
  --font: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font); color: var(--ink); background: var(--sand); font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: var(--navy); }
h1, h2, h3, h4 { color: var(--navy); margin: 0 0 .4em; line-height: 1.25; }
h1 { font-size: 22px; } h2 { font-size: 18px; } h3 { font-size: 15px; } h4 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
p { margin: 0 0 .75em; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }

/* ---------- Buttons & inputs ---------- */
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: #fff; color: var(--navy); border-radius: 8px; padding: 7px 12px; font: 600 13px var(--font); cursor: pointer; text-decoration: none; white-space: nowrap; transition: background .15s, border-color .15s; }
.btn:hover { background: var(--navy-50); border-color: var(--navy-100); }
.btn.primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn.primary:hover { background: var(--navy-600); }
.btn.accent { background: var(--coral); border-color: var(--coral); color: #fff; }
.btn.accent:hover { background: var(--coral-600); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { background: var(--danger-100); border-color: var(--danger-100); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.sm { padding: 4px 9px; font-size: 12px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn svg { width: 15px; height: 15px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

label.field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 600; color: var(--muted); min-width: 0; }
input, select, textarea { font: 14px var(--font); color: var(--ink); border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 7px 10px; width: 100%; min-width: 0; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--coral-100); border-color: var(--coral); }
input[type=checkbox] { width: auto; accent-color: var(--navy); }
textarea { min-height: 70px; resize: vertical; }
.grid { display: grid; gap: 12px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.span2 { grid-column: span 2; }
.check { display: inline-flex; gap: 6px; align-items: center; font-size: 13px; color: var(--ink); font-weight: 500; }

/* ---------- Login ---------- */
.login { display: grid; grid-template-columns: 1.1fr 1fr; min-height: 100vh; }
.login-hero { background: var(--navy); color: #fff; padding: 56px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.login-hero img { width: 210px; }
.login-hero h1 { color: #fff; font-size: 34px; max-width: 460px; margin-top: 48px; }
.login-hero p { color: #c9d5dc; max-width: 440px; font-size: 15px; }
.login-hero .sun { position: absolute; right: -90px; top: -90px; width: 320px; height: 320px; border-radius: 50%; background: var(--coral); opacity: .9; }
.login-hero .waves { position: absolute; left: 0; right: 0; bottom: 0; opacity: .5; }
.login-hero .pill-row { display: flex; gap: 8px; flex-wrap: wrap; position: relative; }
.login-hero .pill-row span { border: 1px solid rgba(255,255,255,.25); border-radius: 999px; padding: 4px 12px; font-size: 12px; color: #e3eaee; }
.login-panel { padding: 56px; display: flex; flex-direction: column; justify-content: center; max-width: 560px; }
.profile-list { display: grid; gap: 8px; margin-bottom: 22px; }
.profile { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: #fff; cursor: pointer; text-align: left; font: inherit; width: 100%; }
.profile:hover { border-color: var(--coral); box-shadow: var(--shadow); }
.profile b { display: block; color: var(--navy); }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 13px; color: #fff; background: var(--navy); flex: none; }
.avatar.partner { background: var(--coral); }

/* ---------- Shell ---------- */
.app { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.sidebar { background: var(--navy); color: #c9d5dc; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.sidebar .brand { padding: 22px 20px 18px; border-bottom: 1px solid rgba(255,255,255,.08); }
.sidebar .brand img { width: 150px; display: block; }
.sidebar .brand small { display: block; margin-top: 8px; font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--coral); font-weight: 700; }
.nav { padding: 12px 10px; flex: 1; overflow-y: auto; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px; color: #c9d5dc; text-decoration: none; font-weight: 500; margin-bottom: 2px; }
.nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav a.active { background: rgba(217,126,129,.16); color: #fff; box-shadow: inset 3px 0 0 var(--coral); }
.nav a svg { width: 17px; height: 17px; flex: none; }
.nav .badge { margin-left: auto; background: var(--coral); color: #fff; border-radius: 999px; font-size: 11px; padding: 0 7px; font-weight: 700; }
.nav h5 { margin: 14px 12px 6px; font-size: 10.5px; text-transform: uppercase; letter-spacing: .12em; color: #7f98a6; }
.sidebar .me { padding: 14px 16px; border-top: 1px solid rgba(255,255,255,.08); display: flex; gap: 10px; align-items: center; }
.sidebar .me b { color: #fff; display: block; font-size: 13px; }
.sidebar .me span { font-size: 11.5px; }
.sidebar .me-link { display: flex; gap: 10px; align-items: center; min-width: 0; flex: 1; color: inherit; text-decoration: none; border-radius: 8px; padding: 4px; margin: -4px; }
.sidebar .me-link:hover, .sidebar .me-link.active { background: rgba(255,255,255,.06); }
.sidebar .me-link > div:last-child { min-width: 0; }
.sidebar .me-link b, .sidebar .me-link span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar .me .me-hint { display: block; font-size: 11px; color: var(--coral); }
.sidebar .me button { margin-left: auto; background: none; border: 0; color: #c9d5dc; cursor: pointer; padding: 6px; border-radius: 6px; }
.sidebar .me button:hover { background: rgba(255,255,255,.08); color: #fff; }

main { min-width: 0; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 16px 28px; border-bottom: 1px solid var(--line); background: rgba(247,244,239,.92); backdrop-filter: blur(6px); position: sticky; top: 0; z-index: 5; }
.topbar h1 { margin: 0; font-size: 20px; }
.topbar .sub { color: var(--muted); font-size: 12.5px; }
.topbar .right { margin-left: auto; display: flex; gap: 10px; align-items: center; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #fff; }
.seg button { border: 0; background: none; padding: 6px 12px; font: 600 12px var(--font); color: var(--muted); cursor: pointer; }
.seg button.on { background: var(--navy); color: #fff; }
.role-chip { font-size: 12px; font-weight: 600; padding: 5px 10px; border-radius: 999px; background: var(--navy-100); color: var(--navy); }
.role-chip.partner { background: var(--coral-100); color: var(--coral-600); }
.menu-btn { display: none; }
.view { padding: 24px 28px 60px; max-width: 1400px; }

/* ---------- Cards & tables ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; margin-bottom: 18px; }
/* Never widen the page: grid columns may shrink, wide tables scroll inside their card. */
.card { min-width: 0; overflow-x: auto; }
.grid > *, .builder > *, main { min-width: 0; }
.card > .head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.card > .head h2, .card > .head h3 { margin: 0; }
.card > .head .btn-row { margin-left: auto; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.kpi .label { font-size: 12px; color: var(--muted); font-weight: 600; }
.kpi .value { font-size: 24px; font-weight: 700; color: var(--navy); margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi .foot { font-size: 12px; color: var(--muted); }
.kpi::after { content: ''; position: absolute; right: -24px; top: -24px; width: 70px; height: 70px; border-radius: 50%; background: var(--coral-50); }

.table-wrap { overflow-x: auto; margin: 0 -2px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 9px 10px; border-bottom: 1px solid #efece7; vertical-align: top; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #fbfaf8; }
tfoot td { font-weight: 700; border-top: 2px solid var(--line); border-bottom: 0; color: var(--navy); }
td .sub { display: block; font-size: 12px; color: var(--muted); }
th.num, td.num { text-align: right; }
.empty { text-align: center; color: var(--muted); padding: 28px; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--navy-100); color: var(--navy); white-space: nowrap; }
.badge.coral { background: var(--coral-100); color: var(--coral-600); }
.badge.lagoon { background: var(--lagoon-100); color: var(--lagoon); }
.badge.sun { background: var(--sun-100); color: #946b1b; }
.badge.ok { background: var(--ok-100); color: var(--ok); }
.badge.danger { background: var(--danger-100); color: var(--danger); }
.badge.grey { background: #eceae6; color: #5f5a55; }
.tier-luxury { background: #272425; color: #f2d7d8; }
.tier-upscale { background: var(--navy); color: #fff; }
.tier-midscale { background: var(--lagoon-100); color: var(--lagoon); }
.tier-economy { background: var(--sun-100); color: #946b1b; }

/* ---------- Filters ---------- */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar .grow { flex: 1; min-width: 200px; max-width: 340px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 5px 12px; font: 600 12.5px var(--font); color: var(--muted); cursor: pointer; }
.chip:hover { border-color: var(--navy-100); color: var(--navy); }
.chip.on { background: var(--navy); border-color: var(--navy); color: #fff; }
.chip .n { opacity: .7; margin-left: 4px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.tabs button { background: none; border: 0; padding: 9px 14px; font: 600 13px var(--font); color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button.on { color: var(--navy); border-bottom-color: var(--coral); }

/* ---------- Inventory cards ---------- */
.inv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 16px; }
.inv-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); cursor: pointer; display: flex; flex-direction: column; transition: transform .15s, box-shadow .15s; text-align: left; font: inherit; padding: 0; color: inherit; }
.inv-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(31,56,70,.12); }
.inv-card .art { height: 92px; position: relative; display: flex; align-items: flex-end; padding: 10px 14px; gap: 6px; }
.inv-card .art svg.icon { position: absolute; right: 14px; top: 14px; width: 34px; height: 34px; color: rgba(255,255,255,.85); }
.art.resort { background: linear-gradient(135deg, #1f3846, #3f8f93); }
.art.hotel { background: linear-gradient(135deg, #272425, #1f3846); }
.art.guesthouse { background: linear-gradient(135deg, #d97e81, #d9a441); }
.art.safari { background: linear-gradient(135deg, #2a4a5c, #d97e81); }
.inv-card .body { padding: 14px; flex: 1; display: flex; flex-direction: column; gap: 4px; }
.inv-card h3 { margin: 0; font-size: 15px; }
.inv-card .loc { font-size: 12.5px; color: var(--muted); }
.inv-card .price { margin-top: auto; padding-top: 10px; display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.inv-card .price b { font-size: 18px; color: var(--navy); }
.inv-card .price span { font-size: 12px; color: var(--muted); }
.inv-card.inactive { opacity: .55; }

/* ---------- Availability grid ---------- */
.avail { border-collapse: separate; border-spacing: 3px; }
.avail th { text-align: center; padding: 4px; font-size: 11px; }
.avail th.room { text-align: left; min-width: 190px; }
.avail td { padding: 0; border: 0; }
.cell { width: 100%; min-width: 46px; height: 42px; border-radius: 7px; display: grid; place-items: center; font: 700 13px var(--font); border: 0; cursor: default; }
.cell small { display: block; font-size: 10px; font-weight: 500; opacity: .75; }
.cell.ok { background: var(--ok-100); color: var(--ok); }
.cell.low { background: var(--sun-100); color: #946b1b; }
.cell.none { background: var(--danger-100); color: var(--danger); }
.cell.stop { background: repeating-linear-gradient(45deg, #272425, #272425 5px, #3a3637 5px, #3a3637 10px); color: #f2d7d8; }
.cell.editable { cursor: pointer; }
.cell.editable:hover { outline: 2px solid var(--coral); }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -2px; margin-right: 4px; }
.wkend { color: var(--coral-600); }

/* ---------- Builder ---------- */
.builder { display: grid; grid-template-columns: minmax(0, 1fr) 430px; gap: 18px; align-items: start; }
.summary { position: sticky; top: 84px; }
.segment { border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin-bottom: 10px; background: #fcfbf9; position: relative; }
.segment .seg-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.segment .seg-head .btn { margin-left: auto; }
.seg-icon { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: var(--navy-100); color: var(--navy); flex: none; }
.seg-icon svg { width: 16px; height: 16px; }
.seg-icon.coral { background: var(--coral-100); color: var(--coral-600); }
.seg-icon.lagoon { background: var(--lagoon-100); color: var(--lagoon); }
.seg-icon.sun { background: var(--sun-100); color: #946b1b; }
.alerts { display: grid; gap: 6px; margin-bottom: 12px; }
.alert { display: flex; gap: 8px; padding: 8px 10px; border-radius: 8px; font-size: 12.5px; align-items: flex-start; }
.alert svg { width: 15px; height: 15px; flex: none; margin-top: 2px; }
.alert.warn { background: var(--sun-100); color: #7a5713; }
.alert.err { background: var(--danger-100); color: var(--danger); }
.alert.info { background: var(--navy-50); color: var(--navy); }
.alert.ok { background: var(--ok-100); color: var(--ok); }
.qtable td, .qtable th { padding: 6px 6px; font-size: 12.5px; }
.qtable td.item { max-width: 170px; }
.totals { margin-top: 10px; border-top: 2px solid var(--navy); padding-top: 10px; }
.totals .row { display: flex; justify-content: space-between; padding: 3px 0; font-size: 13px; }
.totals .row.grand { font-size: 17px; font-weight: 800; color: var(--navy); border-top: 1px dashed var(--line); margin-top: 6px; padding-top: 8px; }
.margin-box { margin-top: 10px; background: var(--ok-100); color: var(--ok); border-radius: 8px; padding: 8px 10px; font-size: 12.5px; display: flex; justify-content: space-between; }

/* ---------- Modal & toast ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(24,45,57,.45); display: flex; align-items: flex-start; justify-content: center; padding: 48px 16px; z-index: 50; overflow-y: auto; }
.modal { background: #fff; border-radius: 14px; width: 100%; max-width: 640px; box-shadow: 0 24px 60px rgba(0,0,0,.25); }
.modal.wide { max-width: 980px; }
.modal .m-head { display: flex; align-items: center; gap: 10px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.modal .m-head h2 { margin: 0; }
.modal .m-head .x { margin-left: auto; }
.modal .m-body { padding: 20px; }
.modal .m-foot { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--navy); color: #fff; padding: 10px 18px; border-radius: 10px; box-shadow: var(--shadow); z-index: 60; font-weight: 600; animation: pop .2s ease-out; }
.toast.err { background: var(--danger); }
@keyframes pop { from { opacity: 0; transform: translate(-50%, 8px); } }

.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { padding: 4px 0 4px 16px; border-left: 2px solid var(--navy-100); position: relative; font-size: 12.5px; }
.timeline li::before { content: ''; position: absolute; left: -5px; top: 10px; width: 8px; height: 8px; border-radius: 50%; background: var(--coral); }

.matrix td, .matrix th { text-align: center; }
.matrix td:first-child, .matrix th:first-child { text-align: left; }
.tick { color: var(--ok); font-weight: 800; }

.notice { background: var(--navy-50); border: 1px solid var(--navy-100); border-radius: 10px; padding: 12px 14px; font-size: 13px; color: var(--navy); margin-bottom: 16px; display: flex; gap: 10px; }
.notice svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }

/* ---------- Icons (default size; contexts below override) ---------- */
:where(svg.i) { width: 16px; height: 16px; flex: none; vertical-align: -3px; } /* zero specificity: any context rule wins */
h2 svg.i { width: 18px; height: 18px; color: var(--coral); }
.matrix td svg.i { width: 15px; height: 15px; color: var(--navy-600); margin-right: 6px; }
.warn-text { color: #946b1b !important; }

/* ---------- Tabs as links ---------- */
.tabs a.tab-link { padding: 9px 14px; font: 600 13px var(--font); color: var(--muted); text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a.tab-link.on { color: var(--navy); border-bottom-color: var(--coral); }
.tabs { overflow-x: auto; }

/* ---------- Photos: editor strip ---------- */
.photo-strip { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-start; margin: 8px 0 12px; }
.photo-strip .ph { position: relative; margin: 0; width: 112px; }
.photo-strip .ph img { width: 112px; height: 80px; object-fit: cover; border-radius: 8px; display: block; background: var(--navy-50); border: 1px solid var(--line); }
.photo-strip .ph-x { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: rgba(39,36,37,.75); color: #fff; display: grid; place-items: center; cursor: pointer; padding: 0; }
.photo-strip .ph-x svg.i { width: 12px; height: 12px; }
.photo-strip .ph-x:hover { background: var(--danger); }
.photo-strip .ph-cap { margin-top: 4px; padding: 4px 6px; font-size: 11.5px; }
.photo-strip .ph-add { width: 112px; height: 80px; border: 1.5px dashed var(--navy-100); border-radius: 8px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: var(--navy); font-size: 11.5px; font-weight: 600; cursor: pointer; background: var(--navy-50); position: relative; text-align: center; }
.photo-strip .ph-add:hover { border-color: var(--coral); background: var(--coral-50); }
.photo-strip .ph-add input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.photo-strip .ph-add.busy { opacity: .5; pointer-events: none; }
.photo-strip .ph-count { flex-basis: 100%; font-size: 11.5px; color: var(--muted); }
.photo-strip .ph-count.warn { color: #946b1b; font-weight: 600; }
.room-row { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px 2px; margin-bottom: 10px; background: #fcfbf9; }

/* ---------- Photos: display ---------- */
.thumbs { display: flex; gap: 4px; margin-top: 6px; flex-wrap: wrap; }
.thumb { position: relative; width: 52px; height: 38px; padding: 0; border: 0; border-radius: 6px; overflow: hidden; cursor: zoom-in; background: var(--navy-50); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .more { position: absolute; inset: 0; background: rgba(31,56,70,.6); color: #fff; font-size: 12px; font-weight: 700; display: grid; place-items: center; }
.photo-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 14px; }
.photo-grid .pg { position: relative; padding: 0; border: 0; border-radius: 10px; overflow: hidden; aspect-ratio: 4 / 3; cursor: zoom-in; background: var(--navy-50); }
.photo-grid .pg:first-child { grid-column: span 2; grid-row: span 2; }
.photo-grid .pg img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .25s; }
.photo-grid .pg:hover img { transform: scale(1.04); }
.photo-grid .pg span { position: absolute; left: 0; right: 0; bottom: 0; padding: 14px 10px 6px; background: linear-gradient(transparent, rgba(24,45,57,.8)); color: #fff; font-size: 12px; font-weight: 600; text-align: left; }
.seg-photo { width: 34px; height: 34px; padding: 0; border: 0; border-radius: 8px; overflow: hidden; cursor: zoom-in; flex: none; background: var(--navy-50); }
.seg-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.inv-card .art.has-photo { background-size: cover; background-position: center; }
.inv-card .art.has-photo::before { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(24,45,57,.05), rgba(24,45,57,.55)); }
.inv-card .art > * { position: relative; z-index: 1; }
.inv-card .art.has-photo svg.icon { display: none; }
.inv-card .art { height: 120px; }
img.media-missing { visibility: hidden; }

/* ---------- Photo viewer ---------- */
.lightbox { position: fixed; inset: 0; z-index: 80; background: rgba(15,24,30,.92); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 48px 64px 20px; }
.lightbox figure { margin: 0; display: flex; flex-direction: column; align-items: center; max-width: 100%; }
.lightbox figure img { max-width: min(1200px, 100%); max-height: 72vh; border-radius: 8px; box-shadow: 0 20px 60px rgba(0,0,0,.5); background: #1a2a33; min-width: 120px; min-height: 80px; }
.lightbox figcaption { color: #e3eaee; margin-top: 10px; font-size: 14px; display: flex; gap: 14px; align-items: center; }
.lightbox figcaption span { color: #9fb2bd; font-size: 12px; }
.lb-btn { position: absolute; width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(255,255,255,.12); color: #fff; display: grid; place-items: center; cursor: pointer; }
.lb-btn:hover { background: var(--coral); }
.lb-btn svg.i { width: 20px; height: 20px; }
.lb-x { top: 14px; right: 14px; }
.lb-prev { left: 14px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 14px; top: 50%; transform: translateY(-50%); }
.lb-strip { display: flex; gap: 6px; margin-top: 14px; overflow-x: auto; max-width: 100%; padding: 2px; }
.lb-strip button { width: 64px; height: 46px; padding: 0; border: 2px solid transparent; border-radius: 6px; overflow: hidden; cursor: pointer; background: #1a2a33; opacity: .6; flex: none; }
.lb-strip button.on { border-color: var(--coral); opacity: 1; }
.lb-strip img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ---------- Demo marker ---------- */
.demo-chip { font-size: 12px; font-weight: 700; padding: 5px 10px; border-radius: 999px; background: var(--coral); color: #fff; letter-spacing: .04em; text-transform: uppercase; cursor: help; }

/* ---------- Cloud save status ---------- */
.sync-chip { font-size: 12px; font-weight: 600; padding: 5px 10px; border-radius: 999px; background: var(--ok-100); color: var(--ok); white-space: nowrap; }
.sync-chip.pending, .sync-chip.saving { background: var(--navy-50); color: var(--navy); }
.sync-chip.offline { background: var(--sun-100); color: #946b1b; }
.sync-chip.error { background: var(--danger-100); color: var(--danger); }
@media (max-width: 520px) { .sync-chip { display: none; } }

/* ---------- Printable documents ---------- */
.doc-toolbar { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.paper { overflow-x: auto; min-width: 0; background: #fff; max-width: 900px; margin: 0 auto; padding: 44px 48px; border-radius: 6px; box-shadow: var(--shadow); border: 1px solid var(--line); }
.paper .doc-head { display: flex; justify-content: space-between; gap: 20px; border-bottom: 3px solid var(--navy); padding-bottom: 18px; margin-bottom: 20px; }
.paper .doc-head img { width: 190px; }
.paper .doc-title { text-align: right; }
.paper .doc-title h1 { font-size: 26px; margin: 0; letter-spacing: .04em; }
.paper .doc-title .ref { color: var(--coral-600); font-weight: 700; }
.paper .guest-band { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 14px; background: var(--coral-50); border-left: 4px solid var(--coral); border-radius: 6px; padding: 12px 16px; margin-bottom: 20px; font-size: 13px; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.paper .guest-band h4 { margin-bottom: 2px; }
.paper .guest-band b { font-size: 17px; color: var(--navy); }
.paper .meta { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 22px; font-size: 12.5px; }
.paper .meta h4 { margin-bottom: 4px; }
.paper table th { background: var(--navy); color: #fff; border: 0; }
.paper table th:first-child { border-radius: 6px 0 0 6px; } .paper table th:last-child { border-radius: 0 6px 6px 0; }
.paper .grand td { background: var(--coral-50); font-size: 15px; }
.paper .doc-foot { margin-top: 26px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 11.5px; color: var(--muted); display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.paper .section-title { margin: 22px 0 8px; font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--navy); border-left: 3px solid var(--coral); padding-left: 8px; }
.stamp { display: inline-block; border: 2px solid var(--coral); color: var(--coral-600); border-radius: 6px; padding: 2px 10px; font-weight: 800; letter-spacing: .1em; transform: rotate(-4deg); margin-top: 6px; }

@media print {
  body { background: #fff; }
  .sidebar, .topbar, .doc-toolbar, .toast { display: none !important; }
  .app { display: block; }
  .view { padding: 0; max-width: none; }
  .paper { box-shadow: none; border: 0; padding: 0; max-width: none; overflow: visible; }
  .paper table th { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .paper .grand td, .badge { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  @page { size: A4; margin: 14mm; }
}

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .builder { grid-template-columns: 1fr; }
  .summary { position: static; }
}
@media (max-width: 860px) {
  .photo-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lightbox { padding: 56px 12px 16px; }
  .lb-prev, .lb-next { top: auto; bottom: 90px; transform: none; }
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 250px; z-index: 40; transform: translateX(-100%); transition: transform .2s; }
  body.nav-open .sidebar { transform: none; box-shadow: 0 0 0 100vmax rgba(24,45,57,.4); }
  .menu-btn { display: inline-flex; }
  .topbar { padding: 12px 16px; flex-wrap: wrap; }
  .view { padding: 16px 16px 48px; }
  .g3, .g4, .g6 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .login { grid-template-columns: 1fr; }
  .login-hero, .login-panel { padding: 32px 20px; }
  .login-hero h1 { font-size: 26px; margin-top: 24px; }
  .paper { padding: 22px 16px; }
  .paper .meta, .paper .guest-band { grid-template-columns: 1fr; }
  .paper .doc-head { flex-direction: column; }
  .paper .doc-title { text-align: left; }
}
@media (max-width: 520px) {
  .g2, .g3, .g4, .g6 { grid-template-columns: 1fr; }
  .span2 { grid-column: auto; }
  .topbar .right .role-chip { display: none; }
}
