/* Signed-in application shell (dashboard, projects, images, settings, admin) */
.app { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 6px; padding: 18px 14px;
  border-right: 1px solid var(--border); background: var(--bg-elev); overflow-y: auto; }
.sidebar .logo { padding: 4px 8px 18px; }
.nav-section { font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); padding: 14px 10px 6px; }
.nav-link { display: flex; align-items: center; gap: 10px; height: 38px; padding: 0 10px; border-radius: var(--r-md); color: var(--text-2); font-weight: 500; font-size: .93rem; }
.nav-link:hover { background: var(--surface-2); color: var(--text); }
.nav-link[aria-current="page"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); border: 1px solid var(--border); }
.nav-link[aria-current="page"] .icon { color: var(--accent); }
.plan-card { margin-top: auto; padding: 14px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--border); }
.plan-card .row-between { margin-bottom: 10px; }
.plan-card .meter { margin: 6px 0 4px; }
.plan-card .subtle { font-size: .78rem; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 50; display: flex; align-items: center; gap: 12px; height: 64px; padding: 0 28px;
  background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
.topbar .btn-icon { flex: none; } /* never squeeze the menu/notification buttons on narrow phones */
.topbar .search { position: relative; width: min(420px, 100%); }
.topbar .search .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-3); }
.topbar .search .input { padding-left: 38px; height: 38px; background: var(--surface); }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: .8rem;
  background: var(--brand-gradient); color: #fff; overflow: hidden; flex-shrink: 0; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-lg { width: 72px; height: 72px; font-size: 1.4rem; }
.avatar-btn { border: 0; background: transparent; padding: 2px; border-radius: 50%; cursor: pointer; }
.dot-badge { position: absolute; top: 6px; right: 6px; min-width: 8px; height: 8px; border-radius: 99px; background: var(--accent); box-shadow: 0 0 0 2px var(--bg); }

.menu { position: absolute; right: 0; top: calc(100% + 8px); min-width: 220px; padding: 6px; border-radius: var(--r-lg); background: var(--surface);
  border: 1px solid var(--border); box-shadow: var(--shadow-lg); z-index: 200; animation: pop-in var(--t-fast) var(--ease); }
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; height: 36px; padding: 0 10px; border: 0; background: transparent;
  border-radius: var(--r-sm); font-size: .9rem; color: var(--text); cursor: pointer; text-align: left; }
.menu-item:hover, .menu-item:focus-visible { background: var(--surface-2); color: var(--text); }
.menu-item.danger { color: var(--danger); }
.menu-sep { height: 1px; background: var(--border); margin: 6px 0; }
.menu-head { padding: 8px 10px 10px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.menu-head strong { display: block; font-size: .92rem; } .menu-head span { font-size: .8rem; color: var(--text-3); }
.popover-anchor { position: relative; }

.notif-menu { width: min(360px, calc(100vw - 32px)); max-height: 440px; overflow-y: auto; padding: 0; }
.notif-menu .menu-head { position: sticky; top: 0; background: var(--surface); display: flex; justify-content: space-between; align-items: center; margin: 0; padding: 12px 14px; }
.notif { display: block; padding: 12px 14px; border-bottom: 1px solid var(--border); font-size: .88rem; }
.notif:last-child { border-bottom: 0; }
.notif.unread { background: color-mix(in srgb, var(--accent-soft) 60%, transparent); }
.notif strong { display: block; } .notif p { margin: 2px 0 4px; font-size: .85rem; } .notif time { font-size: .75rem; color: var(--text-3); }

.content { padding: 28px; max-width: 1320px; width: 100%; }
.page-title { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.page-title h1 { font-size: 1.8rem; margin: 0; }
.page-title p { margin: 4px 0 0; }
.section-title { display: flex; align-items: center; justify-content: space-between; margin: 34px 0 14px; }
.section-title h2 { font-size: 1.15rem; margin: 0; }
.section-title a { display: inline-flex; align-items: center; min-height: 32px; font-size: .88rem; font-weight: 600; color: var(--text-2); }

.welcome { position: relative; overflow: hidden; border-radius: var(--r-xl); padding: 28px; background: #141418; color: #fff; }
.welcome::before { content: ""; position: absolute; inset: 0; background:
  radial-gradient(60% 120% at 100% 0%, rgba(255,90,31,.55), transparent 60%), radial-gradient(40% 90% at 80% 100%, rgba(255,46,126,.45), transparent 70%); }
.welcome > * { position: relative; }
.welcome h1 { color: #fff; font-size: 1.7rem; margin-bottom: 6px; } .welcome p { color: rgba(255,255,255,.75); margin: 0; }

.preset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.preset { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 18px 10px; border-radius: var(--r-lg);
  background: var(--surface); border: 1px solid var(--border); cursor: pointer; text-align: center; transition: all var(--t-fast) var(--ease); }
.preset:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.preset-shape { border: 2px solid var(--text-3); border-radius: 4px; background: var(--surface-2); }
.preset:hover .preset-shape { border-color: var(--accent); background: var(--accent-soft); }
.preset strong { font-size: .86rem; } .preset span { font-size: .75rem; color: var(--text-3); }
.preset.custom .preset-shape { border-style: dashed; display: grid; place-items: center; color: var(--text-3); }

.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 18px; align-items: start; }
.project-thumb img:not([src]) { visibility: hidden; }
.project-card { position: relative; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--border); overflow: hidden; transition: box-shadow var(--t-med), transform var(--t-med) var(--ease); }
.project-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.project-thumb { display: flex; align-items: center; justify-content: center; overflow: hidden; aspect-ratio: 4/3; background:
  conic-gradient(var(--surface-2) 25%, var(--surface) 0 50%, var(--surface-2) 0 75%, var(--surface) 0) 0 0 / 16px 16px; padding: 14px; }
.project-thumb img { max-height: 100%; width: auto; max-width: 100%; border-radius: 4px; box-shadow: var(--shadow-md); object-fit: contain; }
.project-thumb .ph { width: 58%; aspect-ratio: var(--ar, 1); max-height: 100%; border-radius: 4px; box-shadow: var(--shadow-sm); }
.project-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 14px; }
.project-meta strong { display: block; font-size: .92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 160px; }
.project-meta span { font-size: .78rem; color: var(--text-3); }
.card-link { position: absolute; inset: 0; z-index: 1; }
.project-card .popover-anchor { z-index: 2; }

.asset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; }
.asset { display: grid; place-items: center; position: relative; border-radius: var(--r-md); overflow: hidden; background: var(--surface-2); aspect-ratio: 1; border: 1px solid var(--border); }
.asset img { width: 100%; height: 100%; object-fit: cover; }
.asset-overlay { position: absolute; inset: auto 0 0 0; display: flex; justify-content: space-between; align-items: center; gap: 6px; padding: 8px;
  background: linear-gradient(transparent, rgba(0,0,0,.65)); color: #fff; font-size: .75rem; opacity: 0; transition: opacity var(--t-fast); }
.asset:hover .asset-overlay, .asset:focus-within .asset-overlay { opacity: 1; }
.asset-overlay .btn { --btn-bg: rgba(255,255,255,.16); --btn-fg: #fff; --btn-bd: transparent; }
.asset-overlay span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.asset .tag { position: absolute; top: 8px; left: 8px; }

.dropzone { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 34px; border-radius: var(--r-lg);
  border: 2px dashed var(--border-strong); background: var(--surface); text-align: center; color: var(--text-2); cursor: pointer; transition: all var(--t-fast); }
.dropzone:hover, .dropzone.drag { border-color: var(--accent); background: var(--accent-soft); color: var(--text); }
.dropzone .icon { color: var(--accent); }
.upload-list { display: grid; gap: 8px; margin-top: 12px; }
.upload-item { display: grid; grid-template-columns: 1fr 120px; gap: 12px; align-items: center; font-size: .85rem; padding: 10px 12px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--border); }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.stat { padding: 18px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--border); }
.stat .label { color: var(--text-3); font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; display: flex; align-items: center; gap: 8px; }
.stat .value { font-family: var(--font-display); font-size: 1.8rem; font-weight: 700; margin-top: 6px; letter-spacing: -.02em; }
.stat .delta { font-size: .8rem; color: var(--text-3); }

.usage-list { display: grid; gap: 16px; }
.usage-row .row-between { font-size: .88rem; margin-bottom: 6px; }

.settings-layout { display: grid; grid-template-columns: 220px 1fr; gap: 28px; align-items: start; }
.settings-layout > * { min-width: 0; } /* let the panel shrink to the screen instead of widening the page */
.settings-nav { position: sticky; top: 88px; display: grid; gap: 2px; }
.settings-nav a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: var(--r-md); color: var(--text-2); font-weight: 500; font-size: .92rem; }
.settings-nav a:hover { background: var(--surface-2); color: var(--text); }
.settings-nav a[aria-current="true"] { background: var(--surface); border: 1px solid var(--border); color: var(--text); }
.settings-panel { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid .field + .field { margin-top: 0; }
.danger-zone { border-color: color-mix(in srgb, var(--danger) 40%, var(--border)); }
.pagination { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 24px; }

.mobile-only { display: none; }
@media (max-width: 1000px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 272px; z-index: 300; transform: translateX(-100%); transition: transform var(--t-med) var(--ease); box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: none; }
  .scrim { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 250; }
  .mobile-only { display: inline-flex; }
  .topbar { padding: 0 16px; }
  .content { padding: 20px 16px; }
  .settings-layout { grid-template-columns: 1fr; }
  .settings-nav { position: static; display: flex; overflow-x: auto; }
  .settings-nav a { white-space: nowrap; flex: none; }
  .form-grid { grid-template-columns: 1fr; }
}
@media (max-width: 560px) { .topbar .search { display: none; } }

/* checkout (mock provider page) */
.checkout { max-width: 460px; margin: 60px auto; }
.checkout .card-body { display: grid; gap: 16px; }
.test-banner { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: var(--r-md); background: var(--warning-soft); color: var(--warning); font-size: .85rem; font-weight: 600; }

/* simple bar chart */
.chart { display: flex; align-items: flex-end; gap: 6px; height: 160px; padding-top: 10px; }
.chart .bar { flex: 1; height: 100%; background: color-mix(in srgb, var(--accent-soft) 60%, transparent); border-radius: 6px 6px 0 0; position: relative; }
.chart .bar::after { content: ""; position: absolute; inset: auto 0 0; height: var(--h); background: var(--accent); border-radius: 6px 6px 0 0; }
.chart .bar:hover::after { background: var(--accent-hover); }
.chart-labels { display: flex; gap: 6px; font-size: .68rem; color: var(--text-3); margin-top: 6px; }
.chart-labels span { flex: 1; text-align: center; }
.donut-legend { display: grid; gap: 8px; font-size: .88rem; }
.donut-legend .sw { width: 10px; height: 10px; border-radius: 3px; display: inline-block; margin-right: 8px; }

/* ---------- Print layout (Download → Advanced) */
.modal-xl { width: min(1080px, 100%); }
.pl { display: grid; grid-template-columns: minmax(260px, 330px) minmax(0, 1fr); gap: 22px; align-items: start; }
.pl-form { display: flex; flex-direction: column; gap: 14px; }
.pl-form .field + .field { margin-top: 0; }
.pl-form fieldset { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.pl-row { display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; }
.pl-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pl-option { display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--r-md); transition: border-color var(--t-fast) var(--ease); }
.pl-option.on { border-color: var(--accent); background: var(--accent-soft); }
.pl-option.locked .pl-inline, .pl-option.locked .pl-hint { opacity: .5; }
.pl-option > .checkbox { font-weight: 600; }
.pl-inline { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.pl-inline .input { width: 72px; }
.pl-hint { margin: 0; font-size: .78rem; }
.pl-preview { position: sticky; top: 0; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.pl-summary { display: flex; flex-direction: column; gap: 3px; font-size: .85rem; }
.pl-warn { display: inline-flex; gap: 6px; align-items: flex-start; color: var(--warning); }
.pl-warn .icon { flex: none; margin-top: 2px; }
.pl-pages { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; align-items: start; max-height: 62vh; overflow: auto; padding: 14px; border-radius: var(--r-md); background: var(--surface-2); }
.pl-page { display: flex; flex-direction: column; align-items: center; gap: 6px; margin: 0; }
.pl-page canvas { max-width: 100%; height: auto; background: #fff; box-shadow: var(--shadow-md); }
.pl-page figcaption { font-size: .75rem; color: var(--text-3); text-align: center; overflow-wrap: anywhere; }
.pl-progress { margin-right: auto; font-size: .82rem; align-self: center; }
@media (max-width: 760px) {
  .pl { grid-template-columns: 1fr; }
  .pl-preview { position: static; }
  .pl-pages { max-height: none; }
}
