/* Typokreta Tools — UI */
:root {
  --brand: #202C68;
  --brand-600: color-mix(in srgb, var(--brand) 88%, #000);
  --brand-50: color-mix(in srgb, var(--brand) 7%, #fff);
  --brand-100: color-mix(in srgb, var(--brand) 14%, #fff);
  --brand-200: color-mix(in srgb, var(--brand) 26%, #fff);
  --bg: #F3F4F8;
  --surface: #FFFFFF;
  --surface-2: #F8F9FC;
  --line: #E2E5EE;
  --line-2: #D3D8E4;
  --text: #182033;
  --muted: #5F6B82;
  --faint: #8C96AB;
  --ok: #0E8A5F;
  --ok-bg: #E7F6EF;
  --warn: #A15C07;
  --warn-bg: #FFF5E5;
  --err: #C0392B;
  --err-bg: #FDECEA;
  --info-bg: #EAF1FB;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(16,24,40,.05), 0 1px 3px rgba(16,24,40,.06);
  --shadow-lg: 0 12px 32px -8px rgba(16,24,40,.18), 0 4px 10px -4px rgba(16,24,40,.08);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.5 var(--font); color: var(--text); background: var(--bg); }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: 1.5rem; } h2 { font-size: 1.15rem; } h3 { font-size: 1rem; }
p { margin: 0 0 1em; }
small, .muted { color: var(--muted); }
.ico { width: 18px; height: 18px; flex: none; }
.ico.sm { width: 14px; height: 14px; }
.ico.lg { width: 26px; height: 26px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 1.25rem 0; }
code, .mono { font-family: var(--mono); font-size: .88em; }
.sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- top bar ---------- */
.topbar { position: sticky; top: 0; z-index: 50; background: var(--surface); border-bottom: 1px solid var(--line); box-shadow: 0 1px 0 rgba(0,0,0,.02); }
.topbar::before { content: ""; display: block; height: 3px; background: var(--brand); }
.topbar-in { display: flex; align-items: center; gap: 14px; height: 60px; padding: 0 20px; max-width: 1600px; margin: 0 auto; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 700; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand-logo { height: 34px; width: auto; display: block; }
.brand-name { font-size: .95rem; color: var(--brand); padding-left: 10px; border-left: 1px solid var(--line); }
.mainnav { display: flex; gap: 2px; align-items: center; margin-left: 8px; flex: 1; min-width: 0; }
.mainnav a { display: flex; align-items: center; gap: 7px; padding: 8px 11px; border-radius: var(--radius-sm); color: var(--muted); font-weight: 550; font-size: .92rem; white-space: nowrap; }
.mainnav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.mainnav a.on { background: var(--brand-50); color: var(--brand); }
.mainnav .nav-admin { margin-left: auto; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.langsw { display: flex; border: 1px solid var(--line); border-radius: 999px; padding: 2px; }
.langsw a { font-size: .75rem; font-weight: 700; padding: 3px 9px; border-radius: 999px; color: var(--muted); }
.langsw a.on { background: var(--brand); color: #fff; }
.langsw a:hover { text-decoration: none; }
.usermenu { position: relative; }
.user-btn { display: flex; align-items: center; gap: 8px; border: 0; background: none; padding: 4px 6px; border-radius: 999px; cursor: pointer; color: var(--text); font: inherit; }
.user-btn:hover { background: var(--surface-2); }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: .85rem; }
.user-name { font-weight: 600; font-size: .9rem; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dropdown { display: none; position: absolute; right: 0; top: calc(100% + 6px); min-width: 220px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 6px; z-index: 60; }
[data-dropdown].open > .dropdown { display: block; }
.dropdown a, .dropdown button { display: flex; gap: 10px; align-items: center; width: 100%; padding: 8px 10px; border-radius: 6px; color: var(--text); background: none; border: 0; font: inherit; cursor: pointer; text-align: left; }
.dropdown a:hover, .dropdown button:hover { background: var(--surface-2); text-decoration: none; }
.dropdown form { margin: 0; }
.dd-head { padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; display: flex; flex-direction: column; }
.icon-btn { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: var(--radius-sm); border: 1px solid transparent; background: none; color: var(--text); cursor: pointer; }
.icon-btn:hover { background: var(--surface-2); }
.nav-toggle { display: none; }

/* ---------- layout ---------- */
.shell { max-width: 1600px; margin: 0 auto; }
.shell.with-side { display: grid; grid-template-columns: 240px 1fr; }
.main { padding: 28px 28px 60px; min-width: 0; max-width: 1280px; width: 100%; margin: 0 auto; }
.main.wide { max-width: none; }
.sidebar { position: sticky; top: 63px; align-self: start; height: calc(100vh - 63px); overflow-y: auto; padding: 22px 14px; border-right: 1px solid var(--line); background: var(--surface); }
.side-title { display: flex; gap: 8px; align-items: center; font-weight: 700; color: var(--brand); padding: 0 10px 12px; }
.sidebar nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-sm); color: var(--text); font-size: .92rem; }
.sidebar nav a:hover { background: var(--surface-2); text-decoration: none; }
.sidebar nav a.on { background: var(--brand-50); color: var(--brand); font-weight: 600; }
.side-section { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); font-weight: 700; padding: 18px 10px 6px; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head h1 { margin: 0; display: flex; align-items: center; gap: 10px; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.crumb { display: inline-flex; gap: 6px; align-items: center; font-size: .85rem; color: var(--muted); margin-bottom: 6px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 20px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.card-head h2, .card-head h3 { margin: 0; font-size: 1rem; }
.card-body { padding: 20px; }
.card + .card { margin-top: 18px; }
.stack > * + * { margin-top: 16px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.grid { display: grid; gap: 16px; }
.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)); }
.spacer { flex: 1; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 38px; padding: 0 14px; border-radius: var(--radius-sm); border: 1px solid var(--line-2); background: var(--surface); color: var(--text); font: 600 .9rem var(--font); cursor: pointer; white-space: nowrap; text-decoration: none !important; transition: background .12s, border-color .12s, box-shadow .12s; }
.btn:hover { background: var(--surface-2); border-color: var(--faint); }
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, .seg label:focus-within { outline: 3px solid var(--brand-200); outline-offset: 1px; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-600); border-color: var(--brand-600); }
.btn-danger { color: var(--err); border-color: #EDC4BF; }
.btn-danger:hover { background: var(--err-bg); border-color: var(--err); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--surface-2); border-color: transparent; }
.btn-sm { height: 32px; padding: 0 10px; font-size: .84rem; }
.btn-lg { height: 46px; padding: 0 20px; font-size: 1rem; }
.btn[disabled], .btn.is-busy { opacity: .6; pointer-events: none; }
.btn-block { width: 100%; }
.btn-icon { width: 34px; padding: 0; height: 34px; }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .label { font-size: .84rem; font-weight: 600; color: var(--text); }
.field .hint { font-size: .8rem; color: var(--muted); }
.fields { display: grid; gap: 14px; }
.fields-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.fields-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }
.span-all { grid-column: 1 / -1; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=url], input[type=tel], input[type=search], input[type=date], input[type=datetime-local], input[type=time], select, textarea {
  width: 100%; height: 40px; padding: 0 12px; border: 1px solid var(--line-2); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); font: inherit; font-size: .93rem; transition: border-color .12s;
}
textarea { height: auto; min-height: 90px; padding: 10px 12px; resize: vertical; }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235F6B82' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; background-size: 16px; padding-right: 34px; }
input:hover, select:hover, textarea:hover { border-color: var(--faint); }
input:focus, select:focus, textarea:focus { border-color: var(--brand); outline: none; box-shadow: 0 0 0 3px var(--brand-100); }
input[type=color] { width: 44px; height: 40px; padding: 3px; border: 1px solid var(--line-2); border-radius: var(--radius-sm); background: var(--surface); cursor: pointer; }
input[type=range] { width: 100%; accent-color: var(--brand); }
input[type=checkbox], input[type=radio] { accent-color: var(--brand); width: 16px; height: 16px; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: .92rem; user-select: none; }
.input-group { display: flex; }
.input-group > input { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.input-group > .btn { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; border-left: 0; height: 40px; }
.input-icon { position: relative; }
.input-icon .ico { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--faint); pointer-events: none; }
.input-icon input { padding-left: 36px; }
.color-field { display: flex; gap: 8px; align-items: center; }
.color-field input[type=text] { font-family: var(--mono); text-transform: uppercase; }

/* segmented control */
.seg { display: inline-flex; flex-wrap: wrap; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 3px; }
.seg label { position: relative; display: flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 7px; cursor: pointer; font-size: .88rem; font-weight: 600; color: var(--muted); user-select: none; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label:has(input:checked) { background: var(--surface); color: var(--brand); box-shadow: var(--shadow); }
.seg label:has(input:disabled) { opacity: .4; cursor: not-allowed; }
.seg.block { display: flex; } .seg.block label { flex: 1; justify-content: center; }

/* switch */
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: .92rem; user-select: none; }
.switch input { position: absolute; opacity: 0; }
.switch .track { width: 38px; height: 22px; border-radius: 999px; background: var(--line-2); position: relative; transition: background .15s; flex: none; }
.switch .track::after { content: ""; position: absolute; left: 3px; top: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: transform .15s; }
.switch input:checked + .track { background: var(--brand); }
.switch input:checked + .track::after { transform: translateX(16px); }
.switch input:focus-visible + .track { outline: 3px solid var(--brand-200); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--surface-2); white-space: nowrap; }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: #FAFBFD; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .actions { text-align: right; white-space: nowrap; }

/* ---------- badges / tags ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: .74rem; font-weight: 700; padding: 3px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); white-space: nowrap; }
.badge-brand { background: var(--brand-50); color: var(--brand); border-color: var(--brand-100); }
.badge-ok { background: var(--ok-bg); color: var(--ok); border-color: #BFE6D4; }
.badge-warn { background: var(--warn-bg); color: var(--warn); border-color: #F5DDB5; }
.badge-err { background: var(--err-bg); color: var(--err); border-color: #F2C6C0; }
.tag { display: inline-flex; align-items: center; gap: 4px; font-size: .74rem; font-weight: 650; padding: 2px 8px; border-radius: 6px; color: #fff; background: var(--c, var(--brand)); white-space: nowrap; }
.tags { display: flex; flex-wrap: wrap; gap: 4px; }

/* tag input */
.taginput { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-height: 40px; padding: 5px 8px; border: 1px solid var(--line-2); border-radius: var(--radius-sm); background: var(--surface); cursor: text; }
.taginput:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-100); }
.taginput input { border: 0 !important; box-shadow: none !important; height: 28px; padding: 0 4px; flex: 1; min-width: 120px; }
.taginput .tag button { border: 0; background: none; color: inherit; cursor: pointer; padding: 0 0 0 2px; font-size: 1rem; line-height: 1; opacity: .8; }

/* ---------- alerts / toasts ---------- */
.alert { position: relative; padding: 12px 40px 12px 14px; border-radius: var(--radius-sm); margin-bottom: 16px; font-size: .92rem; border: 1px solid; }
.alert-success { background: var(--ok-bg); color: #075E40; border-color: #BFE6D4; }
.alert-error { background: var(--err-bg); color: #8E2318; border-color: #F2C6C0; }
.alert-info { background: var(--info-bg); color: #1D4E89; border-color: #C8DBF3; }
.alert-warn { background: var(--warn-bg); color: #7A4505; border-color: #F5DDB5; }
.alert-x { position: absolute; right: 8px; top: 8px; border: 0; background: none; font-size: 1.2rem; cursor: pointer; color: inherit; opacity: .6; }
.alert ul { margin: 0; padding-left: 18px; }
.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 100; display: flex; flex-direction: column; gap: 8px; }
.toast { background: #182033; color: #fff; padding: 11px 16px; border-radius: 10px; box-shadow: var(--shadow-lg); font-size: .9rem; max-width: 360px; animation: tin .2s ease-out; }
.toast.err { background: var(--err); }
.toast.ok { background: #13603F; }
@keyframes tin { from { transform: translateY(8px); opacity: 0; } }

/* ---------- modal ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(16,24,40,.45); z-index: 90; display: grid; place-items: center; padding: 20px; animation: fade .15s; }
.modal { background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-lg); width: 100%; max-width: 460px; max-height: 90vh; overflow: auto; }
.modal-head { padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }
.modal-head h3 { margin: 0; }
.modal-body { padding: 20px; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; }
@keyframes fade { from { opacity: 0; } }

/* ---------- misc ---------- */
.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty .ico { width: 40px; height: 40px; color: var(--faint); margin-bottom: 8px; }
.pager { display: flex; gap: 4px; justify-content: center; margin-top: 18px; }
.pager a, .pager span { min-width: 34px; height: 34px; display: grid; place-items: center; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); font-size: .88rem; padding: 0 8px; }
.pager .cur { background: var(--brand); color: #fff; border-color: var(--brand); }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; font-size: .9rem; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; font-weight: 550; }
.copyline { display: flex; align-items: center; gap: 6px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 4px 4px 4px 10px; font-family: var(--mono); font-size: .84rem; min-width: 0; }
.copyline span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.filters > * { flex: 0 1 auto; }
.filters .grow { flex: 1 1 220px; }
.filters select, .filters input { height: 38px; width: auto; }
.filters .grow input { width: 100%; }

/* ---------- login ---------- */
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; background:
  radial-gradient(1200px 600px at 10% -10%, var(--brand-100), transparent 60%),
  radial-gradient(900px 500px at 110% 110%, var(--brand-100), transparent 60%), var(--bg); }
.login-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-lg); overflow: hidden; }
.login-card .lc-top { padding: 30px 30px 6px; text-align: center; }
.login-card .lc-top img { height: 54px; width: auto; margin-bottom: 14px; }
.login-card .lc-top h1 { font-size: 1.25rem; margin: 0 0 4px; }
.login-card form { padding: 18px 30px 30px; }
.login-card .lc-foot { display: flex; justify-content: space-between; align-items: center; border-top: 1px solid var(--line); padding: 12px 30px; background: var(--surface-2); font-size: .82rem; color: var(--muted); }

/* ---------- dashboard ---------- */
.hello { margin-bottom: 26px; }
.hello h1 { font-size: 1.6rem; margin-bottom: 4px; }
.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.tool-card { display: flex; flex-direction: column; gap: 12px; padding: 22px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; color: var(--text); box-shadow: var(--shadow); transition: transform .15s, box-shadow .15s, border-color .15s; position: relative; overflow: hidden; }
.tool-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: var(--brand-200); text-decoration: none; }
.tool-card .ti { width: 48px; height: 48px; border-radius: 12px; background: var(--brand-50); color: var(--brand); display: grid; place-items: center; }
.tool-card .ti .ico { width: 26px; height: 26px; }
.tool-card h2 { margin: 0; font-size: 1.08rem; }
.tool-card p { margin: 0; color: var(--muted); font-size: .9rem; }
.tool-card .go { margin-top: auto; display: inline-flex; align-items: center; gap: 4px; color: var(--brand); font-weight: 650; font-size: .88rem; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat { padding: 16px 18px; }
.stat .s-label { display: flex; gap: 8px; align-items: center; font-size: .8rem; color: var(--muted); font-weight: 600; }
.stat .s-value { font-size: 1.7rem; font-weight: 750; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat .s-tool { font-size: .75rem; color: var(--faint); }

/* ---------- QR tool ---------- */
.qr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.qr-card { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; box-shadow: var(--shadow); transition: box-shadow .15s, border-color .15s; }
.qr-card:hover { box-shadow: var(--shadow-lg); border-color: var(--brand-200); }
.qr-card .thumb { display: grid; place-items: center; aspect-ratio: 1 / 1; background: repeating-conic-gradient(#F1F3F8 0 25%, #fff 0 50%) 0 0 / 18px 18px; padding: 18px; cursor: pointer; border-bottom: 1px solid var(--line); }
.qr-card .thumb svg, .qr-card .thumb img { width: 100%; height: 100%; object-fit: contain; }
.qr-card .meta { padding: 12px 14px 4px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.qr-card .title { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.qr-card .sub { font-size: .8rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qr-card .foot { display: flex; align-items: center; gap: 4px; padding: 8px 10px 10px 14px; margin-top: auto; }
.qr-card .foot .spacer { flex: 1; }
.qr-card.inactive .thumb { opacity: .45; }

.editor { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 22px; align-items: start; }
.editor-side { position: sticky; top: 84px; }
.preview-box { display: grid; place-items: center; padding: 26px; background: repeating-conic-gradient(#EEF1F6 0 25%, #fff 0 50%) 0 0 / 20px 20px; border-bottom: 1px solid var(--line); min-height: 300px; }
.preview-box svg { width: 100%; max-width: 330px; height: auto; display: block; filter: drop-shadow(0 2px 8px rgba(16,24,40,.08)); }
.preview-info { display: flex; gap: 6px; flex-wrap: wrap; padding: 10px 16px; border-bottom: 1px solid var(--line); font-size: .8rem; }
.preview-err { color: var(--err); font-weight: 600; text-align: center; padding: 20px; }
.warns { padding: 0 16px; }
.warns .alert { margin: 12px 0 0; font-size: .82rem; padding: 8px 12px; }
.dl-panel { padding: 16px; display: grid; gap: 12px; }
.dl-buttons { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.dl-buttons .btn { flex-direction: column; height: auto; padding: 9px 4px; gap: 2px; font-size: .8rem; }
.dl-buttons .btn small { font-weight: 500; font-size: .68rem; color: var(--muted); }

.type-tabs { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; }
.type-tabs label { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 6px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; font-size: .82rem; font-weight: 600; color: var(--muted); background: var(--surface); text-align: center; transition: border-color .12s, background .12s; }
.type-tabs label:hover { border-color: var(--line-2); background: var(--surface-2); }
.type-tabs input { position: absolute; opacity: 0; pointer-events: none; }
.type-tabs label:has(input:checked) { border-color: var(--brand); background: var(--brand-50); color: var(--brand); box-shadow: 0 0 0 1px var(--brand) inset; }
.type-tabs .ico { width: 22px; height: 22px; }

.mode-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mode-cards label { position: relative; display: flex; flex-direction: column; gap: 4px; padding: 14px 14px 14px 42px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; background: var(--surface); }
.mode-cards input { position: absolute; left: 14px; top: 16px; }
.mode-cards strong { font-size: .92rem; }
.mode-cards span { font-size: .8rem; color: var(--muted); }
.mode-cards label:has(input:checked) { border-color: var(--brand); background: var(--brand-50); }
.mode-cards label:has(input:disabled) { opacity: .5; cursor: not-allowed; }

.acc { border-top: 1px solid var(--line); }
.acc > summary { list-style: none; display: flex; align-items: center; gap: 10px; padding: 14px 20px; cursor: pointer; font-weight: 650; user-select: none; }
.acc > summary::-webkit-details-marker { display: none; }
.acc > summary .chev { margin-left: auto; transition: transform .15s; color: var(--muted); }
.acc[open] > summary .chev { transform: rotate(180deg); }
.acc > summary:hover { background: var(--surface-2); }
.acc-body { padding: 4px 20px 20px; display: grid; gap: 14px; }
.style-picks { display: grid; grid-template-columns: repeat(auto-fill, minmax(62px, 1fr)); gap: 8px; }
.style-picks label { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 4px 6px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; font-size: .7rem; color: var(--muted); font-weight: 600; text-align: center; background: var(--surface); }
.style-picks input { position: absolute; opacity: 0; pointer-events: none; }
.style-picks svg { width: 34px; height: 34px; }
.style-picks label:has(input:checked) { border-color: var(--brand); background: var(--brand-50); color: var(--brand); box-shadow: 0 0 0 1px var(--brand) inset; }
.logo-drop { display: flex; align-items: center; gap: 12px; padding: 10px; border: 1px dashed var(--line-2); border-radius: 10px; background: var(--surface-2); }
.logo-drop .lp { width: 54px; height: 54px; border-radius: 8px; background: #fff repeating-conic-gradient(#EEF1F6 0 25%, #fff 0 50%) 0 0 / 10px 10px; display: grid; place-items: center; overflow: hidden; border: 1px solid var(--line); flex: none; }
.logo-drop .lp img { max-width: 90%; max-height: 90%; }

.vc-photo { display: flex; gap: 14px; align-items: center; }
.vc-photo .ph { width: 76px; height: 76px; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--line); overflow: hidden; display: grid; place-items: center; color: var(--faint); flex: none; }
.vc-photo .ph img { width: 100%; height: 100%; object-fit: cover; }
.repeat-row { display: grid; grid-template-columns: 130px 1fr 34px; gap: 8px; align-items: center; }
.repeat-list { display: grid; gap: 8px; }
.vc-list .vc-avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--brand-50); color: var(--brand); display: grid; place-items: center; font-weight: 700; overflow: hidden; flex: none; }
.vc-list .vc-avatar img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- print calculator ---------- */
.pc-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 22px; align-items: start; }
.pc-step { padding: 18px 20px; border-bottom: 1px solid var(--line); }
.pc-step:last-child { border-bottom: 0; }
.pc-step h3 { display: flex; align-items: center; gap: 10px; font-size: .95rem; margin-bottom: 12px; }
.pc-step h3 .n { width: 24px; height: 24px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-size: .78rem; }
.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.pick-grid.sizes { grid-template-columns: repeat(auto-fill, minmax(98px, 1fr)); }
.pick { position: relative; display: flex; flex-direction: column; gap: 3px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; background: var(--surface); }
.pick input { position: absolute; opacity: 0; pointer-events: none; }
.pick strong { font-size: .92rem; }
.pick span { font-size: .76rem; color: var(--muted); }
.pick:hover { border-color: var(--line-2); background: var(--surface-2); }
.pick:has(input:checked) { border-color: var(--brand); background: var(--brand-50); box-shadow: 0 0 0 1px var(--brand) inset; }
.pick:has(input:checked) strong { color: var(--brand); }
.pick .paper-ico { width: 22px; border: 1.5px solid currentColor; border-radius: 2px; color: var(--faint); margin-bottom: 4px; }
.pick:has(input:checked) .paper-ico { color: var(--brand); }
.qty-input { display: flex; align-items: stretch; max-width: 260px; }
.qty-input input { text-align: center; font-size: 1.15rem; font-weight: 700; height: 46px; border-radius: 0; }
.qty-input button { width: 46px; border: 1px solid var(--line-2); background: var(--surface-2); font-size: 1.2rem; cursor: pointer; color: var(--text); }
.qty-input button:first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); border-right: 0; }
.qty-input button:last-child { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; border-left: 0; }
.result-card { overflow: hidden; }
.result-top { background: var(--brand); color: #fff; padding: 22px; }
.result-top .lbl { font-size: .8rem; opacity: .8; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.result-top .total { font-size: 2.4rem; font-weight: 800; line-height: 1.1; margin-top: 4px; font-variant-numeric: tabular-nums; }
.result-top .per { font-size: .85rem; opacity: .85; margin-top: 4px; }
.result-body { padding: 16px 20px; }
.result-body .kv { font-size: .86rem; }
.result-empty { padding: 34px 20px; text-align: center; color: var(--muted); font-size: .9rem; }
.matrix { border-collapse: separate; border-spacing: 0; font-size: .86rem; }
.matrix th, .matrix td { padding: 4px; }
.matrix thead th { font-size: .72rem; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; text-align: center; white-space: nowrap; }
.matrix tbody th { text-align: left; white-space: nowrap; padding-right: 12px; font-weight: 650; }
.matrix input { width: 104px; height: 36px; text-align: right; font-variant-numeric: tabular-nums; }
.matrix input.missing { border-color: #F0B5AD; background: #FFF8F7; }
.edit-list { display: grid; gap: 8px; }
.edit-row { display: grid; gap: 8px; align-items: center; }
.edit-row.ranges { grid-template-columns: 1fr 110px 110px 34px; }
.edit-row.tiers { grid-template-columns: 1fr 34px; }
.edit-row .hdr { font-size: .75rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }

/* ---------- public pages ---------- */
.public { min-height: 100vh; background: var(--bg); display: flex; align-items: flex-start; justify-content: center; padding: 26px 16px; }
.pcard { width: 100%; max-width: 440px; background: var(--surface); border-radius: 18px; box-shadow: var(--shadow-lg); overflow: hidden; border: 1px solid var(--line); }
.pcard-top { background: var(--brand); color: #fff; padding: 30px 24px 70px; text-align: center; position: relative; }
.pcard-top .co-logo { height: 32px; filter: brightness(0) invert(1); opacity: .95; }
.pcard-photo { width: 120px; height: 120px; border-radius: 50%; border: 4px solid #fff; box-shadow: var(--shadow-lg); background: var(--brand-50); margin: -60px auto 0; position: relative; display: grid; place-items: center; overflow: hidden; color: var(--brand); font-size: 2.4rem; font-weight: 800; }
.pcard-photo img { width: 100%; height: 100%; object-fit: cover; }
.pcard-body { padding: 14px 24px 26px; text-align: center; }
.pcard-body h1 { font-size: 1.45rem; margin: 10px 0 2px; }
.pcard-body .role { color: var(--muted); }
.pcard-actions { display: grid; gap: 8px; margin-top: 18px; text-align: left; }
.pcard-actions a { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; color: var(--text); }
.pcard-actions a:hover { background: var(--surface-2); text-decoration: none; }
.pcard-actions a .ico { color: var(--brand); }
.pcard-actions a span { min-width: 0; overflow-wrap: anywhere; }
.pcard-save { margin-top: 18px; }
.pcard-foot { text-align: center; font-size: .78rem; color: var(--faint); padding: 0 0 18px; }

/* ---------- responsive ---------- */
@media (max-width: 1180px) {
  .editor { grid-template-columns: minmax(0, 1fr) 340px; }
  .pc-layout { grid-template-columns: 1fr; }
}
@media (max-width: 980px) {
  .nav-toggle { display: inline-grid; }
  .mainnav { display: none; position: absolute; top: 63px; left: 0; right: 0; background: var(--surface); border-bottom: 1px solid var(--line); flex-direction: column; align-items: stretch; padding: 8px; margin: 0; box-shadow: var(--shadow-lg); }
  body.nav-open .mainnav { display: flex; }
  .mainnav .nav-admin { margin-left: 0; }
  .brand-name { display: none; }
  .shell.with-side { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: 12px; }
  .sidebar nav { display: flex; flex-wrap: wrap; gap: 4px; }
  .side-section, .side-title { display: none; }
  .editor { grid-template-columns: 1fr; }
  .editor-side { position: static; }
  .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .main { padding: 18px 14px 50px; }
  .topbar-in { padding: 0 12px; gap: 8px; }
  .user-name { display: none; }
  .fields-2, .fields-3, .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .mode-cards { grid-template-columns: 1fr; }
  .dl-buttons { grid-template-columns: repeat(2, 1fr); }
  .repeat-row { grid-template-columns: 100px 1fr 34px; }
  .edit-row.ranges { grid-template-columns: 1fr 76px 76px 34px; }
  .page-head { align-items: flex-start; }
}
@media print {
  .topbar, .sidebar, .page-head .actions, .toasts { display: none !important; }
  body { background: #fff; }
}
