@import url('/assets/stylesheets/fonts.css');

/* ---------------------------------------------------------------------------
   Xagio Marketplace — design tokens borrowed from the panel (assets/stylesheets/main.css)
   --------------------------------------------------------------------------- */
:root {
    --blue: #3A33E8;
    --blue-dark: #2c27b8;
    --blue-soft: #eceaff;
    --purple-gradient: linear-gradient(180deg, #3a33e8, #724fff);
    --ink: #1D2327;
    --ink-2: #373737;
    --ink-3: #545454;
    --muted: #90a1ad;
    --line: #e3e9ef;
    --bg: #f4f8fb;
    --bg-2: #F8F8F8;
    --white: #fff;
    --green: #00BF63;
    --green-soft: #e3f9ee;
    --red: #ea4335;
    --red-soft: #fde8e6;
    --orange: #ff8413;
    --yellow: #FFB000;
    --yellow-soft: #fff3cd;
    --yellow-text: #664d03;
    --cyan: #38B6FF;
    --radius: 10px;
    --radius-lg: 16px;
    --shadow: 0 10px 25px -20px rgba(0,0,0,.6);
    --shadow-sm: 0 1px 2px rgba(20,30,40,.06), 0 1px 8px rgba(20,30,40,.04);
    --wrap: 1180px;
    --gap: 20px;
}

*, *::before, *::after { box-sizing: border-box; }
html { font-family: 'Outfit', system-ui, -apple-system, sans-serif; background: var(--bg); color: var(--ink); -webkit-text-size-adjust: 100%; }
body { margin: 0; font-size: 15px; line-height: 1.5; min-height: 100vh; display: flex; flex-direction: column; }
main.page { flex: 1; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 .5em; line-height: 1.2; font-weight: 600; color: var(--ink); }
h1 { font-size: 30px; } h2 { font-size: 22px; } h3 { font-size: 17px; } h4 { font-size: 15px; }
p { margin: 0 0 1em; }
img { max-width: 100%; height: auto; }
.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding-inline: clamp(16px, 3vw, 32px); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.strong { font-weight: 600; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
.inline { display: inline; }
.hidden { display: none !important; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; } .mt-4 { margin-top: 40px; }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; } .mb-3 { margin-bottom: 24px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row-between { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.grid { display: grid; gap: var(--gap); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 900px) { .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

/* ---------------------------------------------------------------- header */
.topbar { background: var(--white); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 50; }
.topbar-inner { display: flex; align-items: center; gap: 24px; min-height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand img { display: block; height: 30px; width: auto; }
.brand-sub { font-weight: 500; font-size: 15px; color: var(--ink-3); padding-left: 10px; border-left: 1px solid var(--line); line-height: 1; }
.nav { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.nav-link { color: var(--ink-2); padding: 8px 12px; border-radius: 8px; font-weight: 500; font-size: 14px; }
.nav-link:hover { background: var(--bg); text-decoration: none; }
.nav-link.active { color: var(--blue); background: var(--blue-soft); }
.nav-user { display: flex; align-items: center; gap: 4px; margin-left: 8px; padding-left: 12px; border-left: 1px solid var(--line); }
.nav-name { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-toggle { display: none; margin-left: auto; background: none; border: 0; width: 40px; height: 40px; padding: 8px; cursor: pointer; }
.nav-toggle span { display: block; height: 2px; background: var(--ink); margin: 5px 0; border-radius: 2px; }
@media (max-width: 860px) {
    .nav-toggle { display: block; }
    .nav { display: none; position: absolute; top: 64px; left: 0; right: 0; background: var(--white); border-bottom: 1px solid var(--line); flex-direction: column; align-items: stretch; padding: 12px 16px 16px; gap: 4px; box-shadow: var(--shadow); }
    .nav.open { display: flex; }
    .nav-user { margin: 8px 0 0; padding: 12px 0 0; border-left: 0; border-top: 1px solid var(--line); justify-content: space-between; }
    .brand-sub { display: none; }
}

/* ---------------------------------------------------------------- footer */
.footer { border-top: 1px solid var(--line); background: var(--white); margin-top: 60px; padding: 32px 0; font-size: 14px; }
.footer-inner { display: flex; justify-content: space-between; gap: 32px; flex-wrap: wrap; }
.footer-inner > div { max-width: 420px; }
.footer-links { display: flex; flex-direction: column; gap: 6px; }
.footer-links a { color: var(--ink-3); }

/* ---------------------------------------------------------------- flash / alerts */
.flash { margin: 18px 0 0; padding: 12px 40px 12px 16px; border-radius: var(--radius); font-size: 14px; position: relative; border: 1px solid transparent; }
.flash-ok { background: var(--green-soft); color: #0b5e37; border-color: #bfeed7; }
.flash-error, .flash-bad { background: var(--red-soft); color: #8b1a12; border-color: #f7c6c1; }
.flash-warn { background: var(--yellow-soft); color: var(--yellow-text); border-color: #ffe69c; }
.flash-info { background: #eaf2ff; color: #1c3d6e; border-color: #cfe2ff; }
.flash a { color: inherit; font-weight: 600; }
.flash-close { position: absolute; right: 8px; top: 6px; background: none; border: 0; font-size: 20px; line-height: 1; cursor: pointer; color: inherit; opacity: .6; }
.notice { padding: 12px 16px; border-radius: var(--radius); font-size: 14px; border: 1px solid var(--line); background: var(--bg-2); }
.notice-warn { background: var(--yellow-soft); border-color: #ffe69c; color: var(--yellow-text); }
.notice-info { background: #eaf2ff; border-color: #cfe2ff; color: #1c3d6e; }
.notice-ok { background: var(--green-soft); border-color: #bfeed7; color: #0b5e37; }
.notice-bad { background: var(--red-soft); border-color: #f7c6c1; color: #8b1a12; }
.notice ul { margin: 6px 0 0; padding-left: 18px; }

/* ---------------------------------------------------------------- buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 18px; border-radius: 8px; border: 1px solid transparent; font: inherit; font-weight: 600; font-size: 14px; cursor: pointer; line-height: 1.2; white-space: nowrap; transition: background .15s, box-shadow .15s, transform .05s; }
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--blue); color: var(--white); }
.btn-primary:hover { background: var(--blue-dark); }
.btn-ghost { background: transparent; color: var(--ink-2); border-color: var(--line); }
.btn-ghost:hover { background: var(--bg); }
.btn-light { background: var(--white); color: var(--ink); border-color: var(--line); }
.btn-light:hover { background: var(--bg); }
.btn-danger { background: var(--red); color: var(--white); }
.btn-danger:hover { background: #c8352a; }
.btn-success { background: var(--green); color: var(--white); }
.btn-success:hover { background: #00a355; }
.btn-sm { padding: 7px 12px; font-size: 13px; }
.btn-lg { padding: 13px 24px; font-size: 16px; }
.btn-block { width: 100%; }

/* ---------------------------------------------------------------- cards */
.card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 22px; box-shadow: var(--shadow-sm); }
.card + .card { margin-top: var(--gap); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.card-head h2, .card-head h3 { margin: 0; }
.card-sub { color: var(--muted); font-size: 13px; margin-top: -8px; margin-bottom: 14px; }
.section-title { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 600; margin: 0 0 12px; }

/* ---------------------------------------------------------------- badges */
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; line-height: 1.6; background: var(--bg); color: var(--ink-3); border: 1px solid var(--line); vertical-align: middle; }
.pill-blue { background: var(--blue-soft); color: var(--blue); border-color: transparent; }
.pill-ok { background: var(--green-soft); color: #0b5e37; border-color: transparent; }
.pill-warn { background: var(--yellow-soft); color: var(--yellow-text); border-color: transparent; }
.pill-bad { background: var(--red-soft); color: #8b1a12; border-color: transparent; }
.pill-muted { background: var(--bg); color: var(--muted); }
.pill-verified { background: var(--green); color: #fff; border-color: transparent; }
.pill-verified::before { content: "✓"; font-weight: 700; }

/* ---------------------------------------------------------------- forms */
label, .label { display: block; font-size: 13px; font-weight: 500; color: var(--ink-2); margin-bottom: 6px; }
.field { margin-bottom: 16px; }
.field .hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.field .err { font-size: 12px; color: var(--red); margin-top: 4px; }
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: var(--red); }
input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="date"], input[type="url"], input[type="search"], select, textarea {
    width: 100%; font: inherit; font-size: 14px; color: var(--ink); background: var(--white); border: 1px solid #d6dee6; border-radius: 8px; padding: 10px 12px; outline: none; transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(58,51,232,.12); }
textarea { min-height: 96px; resize: vertical; }
select { appearance: none; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path fill='%2390a1ad' d='M1 1l5 5 5-5'/></svg>"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 400; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--blue); }
.input-prefix { position: relative; }
.input-prefix > span { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 14px; }
.input-prefix input { padding-left: 26px; }
fieldset { border: 0; padding: 0; margin: 0 0 8px; min-width: 0; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 20px; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 700px) { .form-grid { grid-template-columns: 1fr; } }

/* ---------------------------------------------------------------- tables */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; background: var(--bg-2); }
.table tr:last-child td { border-bottom: 0; }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table .actions { white-space: nowrap; }

/* ---------------------------------------------------------------- stats & kv */
.stat { background: var(--bg-2); border-radius: var(--radius); padding: 14px 16px; }
.stat .k { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.stat .v { font-size: 22px; font-weight: 600; margin-top: 2px; font-variant-numeric: tabular-nums; }
.stat .s { font-size: 12px; color: var(--muted); }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.kv-wide { grid-template-columns: 1fr; gap: 2px; }
.kv-wide dt { margin-top: 10px; }
@media (max-width: 600px) { .kv { grid-template-columns: 1fr; gap: 2px; } .kv dt { margin-top: 8px; } }

/* ---------------------------------------------------------------- page header */
.page-head { padding: 34px 0 22px; }
.page-head h1 { margin-bottom: 4px; }
.page-head .lead { color: var(--ink-3); font-size: 16px; margin: 0; max-width: 720px; }
.breadcrumb { font-size: 13px; color: var(--muted); margin-bottom: 8px; }

/* ---------------------------------------------------------------- toast */
.toast-host { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 100; }
.toast { background: var(--ink); color: #fff; padding: 12px 16px; border-radius: 10px; font-size: 14px; box-shadow: var(--shadow); max-width: 360px; animation: toast-in .2s ease-out; }
.toast-ok { background: #0b5e37; } .toast-error { background: #8b1a12; }
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------------------------------------------------------------- pagination */
.pager { display: flex; gap: 6px; justify-content: center; margin: 28px 0; flex-wrap: wrap; }
.pager a, .pager span { padding: 7px 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--white); font-size: 13px; color: var(--ink-2); }
.pager .current { background: var(--blue); color: #fff; border-color: var(--blue); }
.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty h3 { color: var(--ink-2); }

/* ---------------------------------------------------------------- lead chart (inline SVG, drawn by JS) */
.chart { width: 100%; height: 200px; }
.chart-legend { display: flex; gap: 16px; font-size: 12px; color: var(--ink-3); margin-top: 6px; flex-wrap: wrap; }
.chart-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: middle; }
.chart svg text { font-family: inherit; }

/* ---------------------------------------------------------------- misc */
.divider { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }
.code { background: var(--ink); color: #e8ecf1; border-radius: var(--radius); padding: 14px 16px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; overflow-x: auto; white-space: pre; }
.steps { counter-reset: step; list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; }
.steps li { position: relative; padding-left: 44px; }
.steps li::before { counter-increment: step; content: counter(step); position: absolute; left: 0; top: 0; width: 30px; height: 30px; border-radius: 50%; background: var(--blue); color: #fff; font-weight: 600; display: flex; align-items: center; justify-content: center; font-size: 14px; }
.steps li h4 { margin-bottom: 2px; }
.prose { max-width: 760px; }
.prose h2 { margin-top: 28px; }
.prose li { margin-bottom: 6px; }

/* ---------------------------------------------------------------- lightbox (images with data-lightbox) */
.lb { position: fixed; inset: 0; z-index: 200; background: rgba(15, 18, 24, .88); display: flex; align-items: center; justify-content: center; padding: 24px; animation: lb-in .15s ease-out; }
.lb img { max-width: min(96vw, 1400px); max-height: 84vh; border-radius: 8px; background: #fff; box-shadow: 0 30px 80px -30px rgba(0,0,0,.8); }
.lb-cap { position: absolute; left: 0; right: 0; bottom: 18px; text-align: center; color: rgba(255,255,255,.85); font-size: 13px; padding: 0 60px; }
.lb-close, .lb-prev, .lb-next { position: absolute; background: rgba(255,255,255,.12); color: #fff; border: 0; border-radius: 50%; width: 44px; height: 44px; font-size: 22px; line-height: 1; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.lb-close:hover, .lb-prev:hover, .lb-next:hover { background: rgba(255,255,255,.24); }
.lb-close { top: 16px; right: 16px; }
.lb-prev { left: 16px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 16px; top: 50%; transform: translateY(-50%); }
.lb[data-single="1"] .lb-prev, .lb[data-single="1"] .lb-next { display: none; }
@keyframes lb-in { from { opacity: 0; } to { opacity: 1; } }
body.lb-open { overflow: hidden; }

/* ---------------------------------------------------------------- valuation card */
.val-bar { position: relative; height: 14px; background: var(--bg-2); border-radius: 999px; margin: 6px 0 4px; }
.val-range { position: absolute; top: 0; bottom: 0; background: var(--green-soft); border: 1px solid #bfeed7; border-radius: 999px; }
.val-ask { position: absolute; top: -4px; width: 2px; height: 22px; background: var(--blue); transform: translateX(-1px); }
.val-ask span { position: absolute; top: -18px; left: 50%; transform: translateX(-50%); font-size: 11px; font-weight: 600; color: var(--blue); white-space: nowrap; }
.val .table td { padding: 6px 4px; }
