/* Atria component styles. Built on tokens.css (exact Figma values).
   Ant Design 5 structure, Atria theme: orange primary, Inter, dark gradient sidebar. */
@import url('./tokens.css');
@import url('./icons.css');   /* .i-<Name> mask icons, file://-safe (see build-icons.py) */

*, *::before, *::after { box-sizing: border-box; }
body.atria, .atria {
  margin: 0;
  font-family: var(--font);
  font-size: 14px; line-height: 22px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "cv11", "ss01"; /* Inter: single-storey a off, open digits */
}

/* ---------- Icons: <i class="ic" style="--i:url(../assets/icons/SearchOutlined.svg)"></i> ---------- */
.ic { display: inline-block; width: 16px; height: 16px; flex: none; background: currentColor;
  -webkit-mask: var(--i) center / contain no-repeat; mask: var(--i) center / contain no-repeat; vertical-align: -3px; }
.ic.sm { width: 14px; height: 14px; } .ic.lg { width: 20px; height: 20px; } .ic.xl { width: 24px; height: 24px; }

/* ---------- Typography ---------- */
.h1 { font-size: 38px; line-height: 46px; font-weight: 700; color: var(--color-neutral-text-heading); margin: 0; }
.h2 { font-size: 30px; line-height: 38px; font-weight: 700; color: var(--color-neutral-text-heading); margin: 0; }
.h3, .page-title { font-size: 24px; line-height: 32px; font-weight: 700; color: var(--color-neutral-text-heading); margin: 0; }
.h4 { font-size: 20px; line-height: 28px; font-weight: 600; color: var(--color-neutral-text-heading); margin: 0; }
.h5 { font-size: 16px; line-height: 24px; font-weight: 600; color: var(--color-neutral-text-heading); margin: 0; }
.text-lg { font-size: 16px; line-height: 24px; }
.text-sm { font-size: 12px; line-height: 20px; }
.strong { font-weight: 600; }
.secondary { color: var(--text-2); } .tertiary { color: var(--text-3); } .muted { color: var(--text-4); }
.link { color: var(--primary); text-decoration: none; cursor: pointer; }
.link:hover { color: var(--color-brand-primary-hover); }

/* Section heading with orange accent bar (detail drawers, AI recommendation panels) */
.section-title { display: flex; align-items: center; gap: 8px; font-size: 16px; line-height: 24px; font-weight: 600; margin: 0 0 8px; }
.section-title::before { content: ""; width: 4px; height: 16px; border-radius: 2px; background: var(--primary); flex: none; }
/* Drawer sections: 24px apart, separated by 1px dividers (Figma: gap 24, Line rgba(0,0,0,.06)) */
.sections { display: flex; flex-direction: column; gap: 24px; padding-top: 16px; }
.sections > hr { border: 0; border-top: 1px solid var(--border-2); margin: 0; }
.sections .section-title { margin-bottom: 8px; }
/* Feedback block at the end of AI output */
.feedback { background: var(--color-neutral-fill-alter); border-radius: 8px; padding: 40px 24px; text-align: center; }
.feedback .q { font-size: 20px; line-height: 28px; font-weight: 600; margin-bottom: 24px; }
.feedback .btn { width: 144px; }
.section-title small { font-size: 12px; font-weight: 400; color: var(--text-3); }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 32px; padding: 0 15px; border-radius: 6px; border: 1px solid var(--border);
  background: #fff; color: var(--text); font: inherit; font-size: 14px; line-height: 22px;
  cursor: pointer; white-space: nowrap; box-shadow: 0 2px 0 rgba(0,0,0,0.02); transition: all .2s; }
.btn .ic { color: var(--text-3); }  /* Figma: icons inside default buttons are rgba(0,0,0,.45) */
.btn.primary .ic, .btn.danger .ic, .btn.dark-cta .ic, .btn.on-dark .ic { color: inherit; }
.btn.text .ic { color: var(--text); }
.btn:hover { color: var(--color-brand-primary-hover); border-color: var(--color-brand-primary-hover); }
.btn:active { color: var(--color-brand-primary-active); border-color: var(--color-brand-primary-active); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 2px 0 rgba(255,145,92,0.1); }
.btn.primary:hover { background: var(--color-brand-primary-hover); border-color: var(--color-brand-primary-hover); color: #fff; }
.btn.primary:active { background: var(--color-brand-primary-active); border-color: var(--color-brand-primary-active); }
.btn.dashed { border-style: dashed; }
.btn.text { border-color: transparent; background: transparent; box-shadow: none; }
.btn.text:hover { background: var(--color-neutral-bg-text-hover); color: var(--text); }
.btn.link-btn { border-color: transparent; background: transparent; box-shadow: none; color: var(--primary); }
.btn.danger { color: var(--color-error-base); border-color: var(--color-error-base); }
.btn.danger.primary { background: var(--color-error-base); color: #fff; }
.btn.lg { height: 40px; padding: 0 15px; font-size: 16px; line-height: 24px; border-radius: 8px; }
.btn.sm { height: 24px; padding: 0 7px; border-radius: 4px; font-size: 14px; }
.btn.icon-only { width: 32px; padding: 0; } .btn.lg.icon-only { width: 40px; } .btn.sm.icon-only { width: 24px; }
.btn.round { border-radius: 100px; } .btn.circle { border-radius: 50%; padding: 0; width: 32px; }
.btn[disabled], .btn.disabled { color: var(--color-neutral-text-disabled); background: var(--color-neutral-bg-container-disabled);
  border-color: var(--border); box-shadow: none; cursor: not-allowed; }
.btn.dark-cta { background: linear-gradient(135deg, var(--color-shell-dark-cta-start), var(--color-shell-dark-cta-end)); color: #fff; border: 0; }
/* Ghost button on dark sidebar ("Save from extension") */
.btn.on-dark { background: rgba(255,255,255,0.15); border: 0; color: #fff; height: 40px; border-radius: 8px; font-size: 16px; }

/* ---------- Inputs / Select ---------- */
.input, .select { display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 4px 11px;
  border: 1px solid var(--border); border-radius: 6px; background: #fff; color: var(--text); font: inherit; min-width: 0; transition: all .2s; }
.input::placeholder { color: var(--color-neutral-text-placeholder); }
.input:hover, .select:hover { border-color: var(--color-brand-primary-hover); }
.input:focus, .input.focus, .select.focus { outline: 0; border-color: var(--primary); box-shadow: 0 0 0 2px var(--color-brand-primary-bg); }
.input.error { border-color: var(--color-error-base); } .input.error.focus { box-shadow: 0 0 0 2px var(--color-error-bg); }
.input.warning { border-color: var(--color-warning-base); }
.input.lg, .select.lg { height: 40px; padding: 7px 11px; font-size: 16px; border-radius: 8px; }
.input.sm, .select.sm { height: 24px; padding: 0 7px; border-radius: 4px; }
textarea.input { height: auto; min-height: 54px; padding: 4px 11px; resize: vertical; }
.input[disabled] { background: var(--color-neutral-bg-container-disabled); color: var(--color-neutral-text-disabled); }
.select { justify-content: space-between; cursor: pointer; }
.select .placeholder { color: var(--color-neutral-text-placeholder); }
.select .ic { color: var(--text-4); width: 12px; height: 12px; }
.select-menu { background: #fff; border-radius: 8px; padding: 4px; box-shadow: var(--shadow-box-shadow-secondary); min-width: 160px; }
.select-menu .opt { padding: 5px 12px; border-radius: 4px; cursor: pointer; }
.select-menu .opt:hover { background: var(--color-neutral-control-item-bg-hover); }
.select-menu .opt.selected { background: var(--color-neutral-control-item-bg-active); font-weight: 600; }
.form-item { display: flex; flex-direction: column; gap: 8px; }
.form-item label { color: var(--text); } .form-item label .req { color: var(--color-error-base); margin-right: 4px; }
.form-item .help { font-size: 14px; color: var(--color-error-base); }

/* ---------- Checkbox / Radio / Switch ---------- */
.checkbox { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.checkbox .box { width: 16px; height: 16px; border: 1px solid var(--border); border-radius: 4px; background: #fff; position: relative; }
.checkbox.checked .box { background: var(--primary); border-color: var(--primary); }
.checkbox.checked .box::after { content: ""; position: absolute; left: 4.5px; top: 1.5px; width: 5px; height: 9px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.checkbox.indeterminate .box::after { content: ""; position: absolute; inset: 3px; background: var(--primary); border-radius: 1px; }
.switch { display: inline-flex; align-items: center; width: 44px; height: 22px; border-radius: 100px; background: var(--color-neutral-text-quaternary); padding: 2px; transition: background .2s; cursor: pointer; }
.switch::after { content: ""; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 2px 4px rgba(0,35,11,0.2); transition: transform .2s; }
.switch.on { background: var(--primary); } .switch.on::after { transform: translateX(22px); }
.switch.sm { width: 28px; height: 16px; } .switch.sm::after { width: 12px; height: 12px; } .switch.sm.on::after { transform: translateX(12px); }

/* ---------- Tags ---------- */
.tag { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 7px; border-radius: 4px; font-size: 12px; line-height: 20px;
  border: 1px solid var(--border-2); background: var(--color-neutral-fill-quaternary); color: var(--text); white-space: nowrap; }
.tag.count { padding: 0 7px; color: var(--text); }  /* number badge inside card tabs */
.tag.blue    { background: var(--color-palette-blue-1);    border-color: var(--color-palette-blue-3);    color: var(--color-palette-blue-6); }
.tag.green   { background: var(--color-palette-green-1);   border-color: var(--color-palette-green-3);   color: var(--color-palette-green-6); }
.tag.gold    { background: var(--color-palette-gold-1);    border-color: var(--color-palette-gold-3);    color: var(--color-palette-gold-6); }
.tag.red     { background: var(--color-palette-red-1);     border-color: var(--color-palette-red-3);     color: var(--color-palette-red-6); }
.tag.magenta { background: var(--color-palette-magenta-1); border-color: var(--color-palette-magenta-3); color: var(--color-palette-magenta-6); }
.tag.volcano { background: var(--color-palette-volcano-1); border-color: var(--color-palette-volcano-3); color: var(--color-palette-volcano-6); }
.tag.purple  { background: var(--color-palette-purple-1);  border-color: var(--color-palette-purple-3);  color: var(--color-palette-purple-6); }
/* Performance grade tags: A green, B blue, C gold, D red - always 12px semibold, min 24px wide */
.grade { min-width: 24px; justify-content: center; font-weight: 600; padding: 0 6px; }
/* Persona chip: white, bordered, emoji + text + info icon */
.chip { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 7px; border: 1px solid var(--border); border-radius: 4px; background: #fff; font-size: 14px; }
.chip .ic { color: var(--text-3); width: 12px; height: 12px; }
/* Iterate dropdown pill used in tables */
.action-pill { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border-radius: 6px;
  background: var(--color-neutral-fill-quaternary); border: 1px solid var(--border); font-size: 14px; cursor: pointer; }
.action-pill .caret { width: 10px; height: 10px; color: var(--text); }

/* ---------- Tabs ---------- */
.tabs-line { display: flex; align-items: center; gap: 24px; border-bottom: 1px solid var(--border-2); }
.tabs-line .tab { height: 46px; display: inline-flex; align-items: center; color: var(--text); cursor: pointer; position: relative; }
.tabs-line .extra { margin-left: auto; }
.tabs-line .tab:hover { color: var(--color-brand-primary-hover); }
.tabs-line .tab.active { color: var(--primary); font-weight: 600; }
.tabs-line .tab.active::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--primary); }
.tabs-line.sm .tab { padding: 8px 0; }
/* Card tabs (Radar categories): grey inactive cards, white active card, count badge + info icon */
.tabs-card { display: flex; gap: 2px; border-bottom: 1px solid var(--border-2); }
.tabs-card .tab { display: inline-flex; align-items: center; gap: 8px; height: 46px; padding: 0 16px; cursor: pointer;
  background: var(--bg-layout); border: 1px solid var(--border-2); border-bottom: 0; border-radius: 8px 8px 0 0; font-weight: 600; color: var(--text); }
.tabs-card .tab.active { background: #fff; margin-bottom: -1px; height: 47px; }
.tabs-card .tab .ic.info { color: var(--text-3); margin-left: 8px; }
/* Segmented */
.segmented { display: inline-flex; padding: 2px; gap: 2px; border-radius: 8px; background: var(--color-neutral-segmented-group-bg); }
.segmented .item { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 28px; padding: 0 11px; border-radius: 6px; color: var(--text-2); cursor: pointer; }
.segmented .item:hover { color: var(--text); background: var(--color-neutral-fill-secondary); }
.segmented .item.active { background: #fff; color: var(--text); box-shadow: var(--shadow-box-shadow); }
.segmented.lg .item { height: 36px; font-size: 16px; padding: 0 11px; }
.segmented.block { display: flex; } .segmented.block .item { flex: 1; }
/* Header switcher (Overview / Radar): selected item is filled orange */
.segmented.brand .item.active { background: var(--primary); color: #fff; box-shadow: none; }

/* ---------- Table ---------- */
.table { width: 100%; border-collapse: separate; border-spacing: 0; background: #fff; font-size: 14px; }
.table th { height: 48px; padding: 0 8px; text-align: left; font-weight: 600; background: var(--color-neutral-fill-alter);
  border-bottom: 1px solid var(--border-2); white-space: nowrap; position: relative; }
.table th + th::before { content: ""; position: absolute; left: 0; top: 50%; height: 22px; transform: translateY(-50%); width: 1px; background: var(--border-2); }
.table td { height: 66px; padding: 0 8px; border-bottom: 1px solid var(--border-2); vertical-align: middle; }
.table tr:hover td { background: var(--color-neutral-fill-alter); }
.table tfoot td { font-weight: 600; }
.table .num { font-variant-numeric: tabular-nums; }
.asset-cell { display: flex; align-items: center; gap: 12px; }
.asset-cell .thumb { width: 40px; height: 40px; border-radius: 4px; object-fit: cover; background: var(--color-neutral-fill-secondary); flex: none; }
.asset-cell .name { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.asset-cell .sub { font-size: 12px; line-height: 20px; color: var(--text-3); }

/* ---------- Pagination ---------- */
.pagination { display: flex; align-items: center; gap: 8px; }
.pagination .pg { min-width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center; border-radius: 6px; border: 1px solid transparent; cursor: pointer; }
.pagination .pg:hover { background: var(--color-neutral-bg-text-hover); }
.pagination .pg.active { border-color: var(--primary); color: var(--primary); font-weight: 600; background: #fff; }
.pagination .pg.disabled { color: var(--text-4); }

/* ---------- Overlays ---------- */
.popover { background: #fff; border-radius: 8px; padding: 12px; box-shadow: var(--shadow-box-shadow-secondary); }
.tooltip { display: inline-block; background: var(--color-neutral-tooltip-bg); color: #fff; border-radius: 6px; padding: 6px 8px; font-size: 14px; max-width: 250px; box-shadow: var(--shadow-box-shadow-secondary); }
.modal { background: #fff; border-radius: 8px; padding: 20px 24px; box-shadow: var(--shadow-box-shadow-secondary); width: 520px; max-width: 100%; }
.modal .modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; font-size: 16px; line-height: 24px; font-weight: 600; }
.modal .modal-footer { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
.modal-mask { background: var(--color-neutral-bg-mask); }
.drawer-head { display: flex; align-items: center; gap: 16px; height: 64px; padding: 0 24px; background: #fff; border-bottom: 1px solid var(--border-2); }
.drawer-head .title { font-size: 20px; line-height: 28px; font-weight: 600; }
.drawer-head .close { color: var(--text-3); width: 24px; height: 24px; }
.drawer-head .range { margin-left: auto; color: var(--text-2); }
/* Detail drawer: slides over the app from x=113 (rail stays visible), white, 64px head, 40px side padding */
.drawer { position: absolute; top: 4px; left: 113px; right: 0; bottom: 0; background: #fff; box-shadow: var(--shadow-box-shadow-secondary); overflow: auto; }
.drawer-body { display: grid; grid-template-columns: 320px 1fr; gap: 24px; padding: 0 40px 40px; }
/* Creative card (left column of the drawer): white, 6% border, radius 8, 4:5 creative 320x400 */
.creative-card { background: #fff; border: 1px solid var(--border-2); border-radius: 8px; padding-top: 12px; margin-top: 24px; overflow: hidden; align-self: start; }
.creative-card .hd { padding: 0 16px 12px; }
.creative-card .media { position: relative; aspect-ratio: 4 / 5; }
.creative-card .media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.creative-card .media .btn { position: absolute; top: 8px; left: 8px; }
.creative-card .media .dur { position: absolute; top: 10px; right: 10px; background: rgba(255,255,255,.8); border-radius: 4px; padding: 1px 6px; font-size: 12px; line-height: 20px; font-weight: 600; }
.creative-card .list { padding: 8px 16px 8px; }
.creative-card .li { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--border-2); }
.creative-card .li:last-child { border-bottom: 0; }
.creative-card .li img { width: 40px; height: 40px; border-radius: 4px; object-fit: cover; }
.creative-card .li .t { flex: 1; min-width: 0; font-size: 12px; line-height: 20px; }
.creative-card .li .t b { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.creative-card .li .t span { color: var(--text-3); }

/* ---------- Cards / surfaces ---------- */
.card { background: #fff; border-radius: 8px; border: 1px solid var(--border-2); }
.card.pad { padding: 16px; }
.project-card { background: #fff; border-radius: 8px; padding: 12px; border: 1px solid var(--border-2); width: 268px; }
.project-card .cover { aspect-ratio: 1 / 1; border-radius: 4px; overflow: hidden; display: grid; grid-template-columns: 1fr 1fr; gap: 1px; position: relative; background: var(--border-2); }
.project-card .cover > div { background: linear-gradient(135deg, #E9D7C3, #C98F5A); }
.project-card .badge { position: absolute; top: 8px; left: 8px; display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 6px; border-radius: 4px;
  background: rgba(0,0,0,0.75); color: #fff; font-size: 12px; font-weight: 600; }
.project-card .meta { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; }
.project-card .meta .t { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.upload-drag { border: 1px dashed var(--border); border-radius: 8px; background: var(--color-neutral-fill-alter); padding: 16px; text-align: center; }
.upload-drag .ic { color: var(--primary); width: 48px; height: 48px; }
.upload-drag:hover { border-color: var(--primary); }

/* ---------- App shell ---------- */
.app { display: grid; grid-template-columns: 64px 264px 1fr; min-height: 100vh; background: #fff; }
.app.collapsed { grid-template-columns: 64px 1fr; }
.rail, .sidenav { background: var(--sidebar-bg); background-attachment: fixed; color: var(--color-shell-sidebar-item-text); }
.app-sidebar { grid-column: 1 / 3; display: grid; grid-template-columns: 64px 264px; background: var(--sidebar-bg); }
.rail { background: none; border-right: 1px solid var(--color-shell-sidebar-divider); display: flex; flex-direction: column; align-items: center; padding-top: 16px; gap: 8px; }
.rail .ws { width: 32px; height: 32px; border-radius: 6px; background: var(--primary); color: #fff; font-weight: 600; display: grid; place-items: center; margin-bottom: 8px; position: relative; }
.rail .item { width: 64px; height: 64px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 12px; line-height: 20px; font-weight: 600; cursor: pointer; }
.rail .item .icon-box { width: 36px; height: 36px; border-radius: 6px; display: grid; place-items: center; }
.rail .item .icon-box .ic { width: 20px; height: 20px; color: inherit; }
.rail .item.active { color: #fff; } .rail .item.active .icon-box { background: var(--color-shell-sidebar-item-bg-active); }
.rail .item:hover { color: #fff; }
.sidenav { background: none; padding: 16px 8px; display: flex; flex-direction: column; gap: 4px; border-right: 1px solid rgba(0,0,0,0.15); }
.sidenav .head { display: flex; justify-content: space-between; align-items: center; padding: 0 4px 12px; color: #fff; font-size: 16px; line-height: 24px; font-weight: 600; }
.sidenav .head .ic { color: var(--color-shell-sidebar-item-text); }
.sidenav .label { display: flex; justify-content: space-between; align-items: center; padding: 8px 4px; color: var(--color-shell-sidebar-section-label); font-weight: 600; }
.sidenav .nav { display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 8px; border-radius: 6px; color: var(--color-shell-sidebar-item-text); cursor: pointer; }
.sidenav .nav.lvl2 { padding-left: 24px; }
.sidenav .nav.active { background: var(--color-shell-sidebar-item-bg-active); color: #fff; font-weight: 600; }
.sidenav .nav:hover { color: #fff; }
.sidenav .nav .caret { width: 10px; height: 10px; }
.sidenav hr { border: 0; border-top: 1px solid var(--color-shell-sidebar-divider); margin: 12px 4px; }
.main { display: flex; flex-direction: column; min-width: 0; }
.topbar { height: 64px; display: flex; align-items: center; gap: 16px; padding: 0 24px; background: #fff; border-bottom: 1px solid var(--border-2); }
.topbar .brand { display: flex; align-items: center; gap: 8px; font-size: 20px; line-height: 28px; font-weight: 600; }
.topbar .meta { margin-left: auto; display: flex; align-items: center; gap: 24px; font-size: 12px; color: var(--text-2); }
.topbar .meta span { display: inline-flex; align-items: center; gap: 6px; }
.content { padding: 24px; }
.content.layout { background: var(--bg-layout); flex: 1; }
.page-desc { color: var(--text-2); margin: 4px 0 16px; }
.toolbar { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; }
.toolbar .spacer { flex: 1; }

/* ---------- Preview-page helpers (only for the design-system cards) ---------- */
.ds-page { padding: 24px; background: #fff; }
.ds-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 16px; }
.ds-label { font-size: 12px; line-height: 20px; color: var(--text-3); margin: 16px 0 8px; text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
