:root{
  --bg:#f5f7fb;
  --card:#ffffff;
  --text:#1f2937;
  --muted:#6b7280;
  --line:#d6dbe3;
  --primary:#2563eb;
  --danger:#b91c1c;
  --success-bg:#ecfdf5;
  --success-line:#a7f3d0;
}
*{box-sizing:border-box}
body{
  margin:0;
  font-family:Arial, Helvetica, sans-serif;
  background:var(--bg);
  color:var(--text);
}
a{color:var(--primary);text-decoration:none}
a:hover{text-decoration:underline}
.container{max-width:1400px;margin:0 auto;padding:20px}
.topbar{
  background:#111827;
  color:#fff;
}
.topbar a{color:#fff}
.toplink{opacity:.95}
.muted-light{color:#cbd5e1}
.brand{font-size:22px;font-weight:700}
.row{display:flex}
.wrap{flex-wrap:wrap}
.space-between{justify-content:space-between}
.center{align-items:center}
.gap{gap:12px}
.stack{display:flex;flex-direction:column;gap:12px}
.compact-stack{gap:8px}
.grid-2{display:grid;grid-template-columns:1fr 1fr;gap:20px;margin-top:20px}
.grid-3{display:grid;grid-template-columns:1fr 1fr 1fr;gap:12px}
.no-margin{margin-top:0}
.card{
  background:var(--card);
  border:1px solid var(--line);
  border-radius:16px;
  padding:20px;
  margin-top:20px;
  box-shadow:0 8px 24px rgba(0,0,0,.04);
}
.success-card{
  background:var(--success-bg);
  border-color:var(--success-line);
}
.narrow{max-width:420px;margin:40px auto}
.side{width:360px}
.wide{width:440px}
.flex-1{flex:1}
label{display:flex;flex-direction:column;gap:6px;font-size:14px}
input,select,textarea,button{
  font:inherit;
}
input,select,textarea{
  width:100%;
  padding:10px 12px;
  border:1px solid var(--line);
  border-radius:10px;
  background:#fff;
}
textarea{resize:vertical}
.btn{
  display:inline-block;
  background:var(--primary);
  color:#fff;
  border:none;
  border-radius:10px;
  padding:10px 14px;
  cursor:pointer;
}
.btn-light{
  background:#eef2ff;
  color:#1e3a8a;
}
.alert{
  background:#fee2e2;
  color:var(--danger);
  border:1px solid #fecaca;
  border-radius:10px;
  padding:10px 12px;
  margin-bottom:12px;
}
table{
  width:100%;
  border-collapse:collapse;
  font-size:14px;
}
th,td{
  border-bottom:1px solid var(--line);
  padding:10px 8px;
  text-align:left;
  vertical-align:top;
}
th{
  background:#f8fafc;
}
.compact th,.compact td{padding:8px 6px}
.inline{flex-direction:row;align-items:center;gap:8px}
.inline-form{display:flex;gap:8px;align-items:center}
.muted{color:var(--muted)}
.small{font-size:12px}
hr{border:none;border-top:1px solid var(--line);margin:18px 0}
pre{
  background:#0f172a;
  color:#e2e8f0;
  padding:12px;
  border-radius:12px;
  overflow:auto;
  max-height:400px;
  white-space:pre-wrap;
}
.log-block{
  border-top:1px solid var(--line);
  padding-top:16px;
  margin-top:16px;
}
.field-box{
  border:1px solid var(--line);
  border-radius:12px;
  padding:12px 14px;
  background:#fafcff;
}
.placeholder-block{
  border-top:1px solid var(--line);
  padding-top:16px;
  margin-top:16px;
}
.placeholder-block:first-child{
  border-top:none;
  padding-top:0;
  margin-top:0;
}
.verification-code{
  font-weight:700;
  letter-spacing:.08em;
  font-size:20px;
}
.radio-row{
  display:flex;
  flex-direction:row;
  align-items:center;
  gap:8px;
}
.radio-row input{
  width:auto;
}
@media (max-width: 980px){
  .grid-2,.grid-3{grid-template-columns:1fr}
  .side,.wide{width:100%}
}
.auth-grid{
  display:grid;
  grid-template-columns:repeat(2,minmax(280px,420px));
  gap:16px;
  justify-content:center;
  margin-top:24px;
}
.btn-telegram{
  background:#229ED9;
  color:white;
}
.top-space{margin-top:16px;}
@media (max-width: 980px){
  .auth-grid{grid-template-columns:1fr;justify-content:stretch}
}

.top-space{margin-top:1rem}
.small{font-size:12px}
.success-card{border-left:4px solid #16a34a;margin-bottom:1rem}
.verification-code{font-family:monospace;font-size:18px;padding:8px 10px;border:1px dashed #94a3b8;border-radius:10px;background:#f8fafc;display:inline-block}
.placeholder-block{padding:12px 14px;border:1px dashed var(--line);border-radius:12px;background:#fafafa;margin-top:12px}


.btn-icon{min-width:42px;padding:10px 12px;font-size:18px;line-height:1}
.owner-group-header{margin-top:18px;margin-bottom:8px;padding:10px 12px;background:#f8fafc;border:1px solid var(--line);border-radius:12px}
.grouped-table{margin-bottom:18px}
.dashboard-head{display:flex;justify-content:space-between;align-items:center;gap:12px;flex-wrap:wrap}
.dashboard-note{margin:0;color:var(--muted)}
.amount-delta{white-space:nowrap}
.amount-delta .delta{margin-left:6px;font-size:12px;font-weight:600}
.delta-positive{color:#16a34a}
.delta-negative{color:#b91c1c}
.delta-zero{color:var(--muted)}
.status-lamp{display:inline-block;width:12px;height:12px;border-radius:999px;vertical-align:middle;box-shadow:0 0 0 2px rgba(0,0,0,.06) inset}
.status-active{background:#16a34a}
.status-returned{background:#dc2626}
.status-paused{background:#d97706}
.status-wrap{display:flex;align-items:center;gap:8px}
.owner-ordinal{display:inline-flex;min-width:26px;justify-content:center;align-items:center;padding:2px 8px;border:1px solid var(--line);border-radius:999px;background:#fff;color:var(--muted);font-size:12px}
.durability-arrow{color:var(--muted);margin:0 4px}
.summary-total-row td{font-weight:700;background:#fcfcff}
.hidden{display:none !important}
.form-help{margin-top:-4px;color:var(--muted);font-size:12px}
.refresh-status{margin-left:8px;font-size:13px}
.topbar{position:sticky;top:0;z-index:20}
.quick-links .btn{padding:8px 10px}

/* Top navigation v2 */
.topbar{position:sticky;top:0;z-index:50;box-shadow:0 4px 18px rgba(15,23,42,.12)}
.topbar-inner{display:flex;justify-content:space-between;align-items:center;gap:16px;flex-wrap:wrap;padding-top:12px;padding-bottom:12px}
.topbar-left{display:flex;align-items:center;gap:18px;flex-wrap:wrap;min-width:0}
.topbar-right{display:flex;align-items:center;gap:10px;flex-wrap:wrap;margin-left:auto}
.main-nav{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.toplink,.nav-dropbtn{display:inline-flex;align-items:center;min-height:36px;padding:8px 10px;border-radius:10px;color:#fff;background:transparent;border:0;cursor:pointer;font:inherit;line-height:1}
.toplink:hover,.nav-dropdown:hover .nav-dropbtn,.nav-dropbtn:focus{background:rgba(255,255,255,.10);text-decoration:none}
.nav-dropdown{position:relative;display:inline-flex;align-items:center}
.nav-menu{display:none;position:absolute;top:100%;left:0;min-width:220px;background:#fff;color:var(--text);border:1px solid var(--line);border-radius:12px;box-shadow:0 18px 45px rgba(15,23,42,.18);padding:8px;z-index:100}
.nav-menu-right{left:auto;right:0}
.nav-dropdown:hover .nav-menu,.nav-dropdown:focus-within .nav-menu{display:block}
.nav-menu a{display:block;color:var(--text);padding:10px 12px;border-radius:10px;white-space:nowrap}
.nav-menu a:hover{background:#f1f5f9;text-decoration:none}
.user-chip{padding:6px 10px;border:1px solid rgba(255,255,255,.22);border-radius:999px;background:rgba(255,255,255,.08)}
.topbar-logout{padding:8px 12px}
@media (max-width: 720px){
  .topbar-inner{align-items:flex-start}
  .topbar-left,.main-nav{width:100%}
  .main-nav{gap:6px}
  .topbar-right{width:100%;justify-content:space-between}
  .nav-menu{position:absolute;min-width:240px}
}

/* Personal pages polishing */
.settings-list{display:flex;flex-direction:column;gap:0;border:1px solid var(--line);border-radius:14px;overflow:hidden;background:#fff}
.settings-row{display:flex;justify-content:space-between;align-items:center;gap:16px;padding:14px 16px;border-bottom:1px solid var(--line)}
.settings-row:last-child{border-bottom:none}
.script-card{border:1px solid var(--line);border-radius:14px;padding:16px;background:#fbfdff}
.script-card h3{margin-top:0;margin-bottom:8px}
.script-card p{margin-top:0;line-height:1.45}
@media (max-width: 720px){
  .settings-row{align-items:flex-start;flex-direction:column}
}


/* Clan hub polish */
.clan-actions .btn{white-space:nowrap}
.table-filter-label{min-width:260px}
.table-filter{padding:8px 10px}
.sortable-table th[data-sort]{cursor:pointer;user-select:none;position:relative}
.sortable-table th[data-sort]::after{content:"↕";font-size:11px;color:var(--muted);margin-left:6px}
.sortable-table th.sort-asc::after{content:"↑";color:var(--primary)}
.sortable-table th.sort-desc::after{content:"↓";color:var(--primary)}

/* Brand mark */
.brand-ph{
  display:inline-flex;
  align-items:center;
  gap:4px;
  font-weight:900;
  font-size:22px;
  letter-spacing:-.5px;
  text-decoration:none;
}
.brand-ph:hover{text-decoration:none}
.brand-ph .brand-main{color:#f8fafc}
.brand-ph .brand-accent{
  background:#f6a21a;
  color:#111827;
  padding:2px 7px 3px;
  border-radius:5px;
  margin-left:1px;
}


/* Clan members and rights */
.input-compact {
    max-width: 320px;
}

.table-scroll {
    overflow-x: auto;
}

.compact-table td,
.compact-table th {
    vertical-align: top;
}

.badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.badge {
    display: inline-block;
    padding: 2px 7px;
    border-radius: 999px;
    background: #eef2ff;
    color: #3730a3;
    font-size: 12px;
    font-weight: 700;
}

.hint {
    margin-top: 4px;
    color: #6b7280;
    font-size: 12px;
}

.rights-form {
    display: grid;
    gap: 8px;
    min-width: 210px;
}

.rights-form label {
    margin: 0;
}

.rights-form label span {
    display: block;
    font-size: 12px;
    color: #6b7280;
    margin-bottom: 2px;
}

.small-check {
    font-size: 13px;
}

.btn-sm {
    padding: 5px 9px;
    font-size: 13px;
}

/* Inventory economy */
.quick-tags{display:flex;flex-wrap:wrap;gap:8px}
.tag{display:inline-flex;align-items:center;gap:4px;padding:6px 10px;border:1px solid var(--line);border-radius:999px;background:#f8fafc;color:var(--text);font-size:13px;text-decoration:none}
.tag:hover{background:#eef2ff;text-decoration:none}
.tag.active{background:#111827;color:#fff;border-color:#111827}
.badge-ok{background:#dcfce7;color:#166534}

/* Market watch */
.confidence-high{background:#dcfce7;color:#14532d}
.confidence-medium{background:#fef9c3;color:#713f12}
.confidence-low{background:#ffedd5;color:#7c2d12}
.confidence-none{background:#f1f5f9;color:#475569}
.market-lot-line{margin-bottom:4px;white-space:nowrap}

.artifact-thumb{width:42px;height:42px;object-fit:contain;border-radius:10px;background:#f4f7fb;border:1px solid #d9e2ef;padding:3px;}
.artifact-detail-layout{display:grid;grid-template-columns:minmax(240px,320px) 1fr;gap:16px;align-items:start;}
.artifact-visual-card{text-align:center;}
.artifact-big-frame{display:flex;align-items:center;justify-content:center;min-height:260px;background:linear-gradient(180deg,#f8fafc,#eef3f8);border:1px solid #d6e0ee;border-radius:18px;padding:18px;}
.artifact-big-frame img{max-width:220px;max-height:220px;object-fit:contain;image-rendering:auto;}
.artifact-facts{display:grid;grid-template-columns:repeat(auto-fit,minmax(120px,1fr));gap:10px;}
.artifact-facts>div{border:1px solid #d9e2ef;background:#f8fafc;border-radius:14px;padding:10px;display:flex;flex-direction:column;gap:4px;}
.stat-pills{display:flex;flex-wrap:wrap;gap:8px;}
.stat-pill{font-size:13px;}
.artifact-set-list{display:flex;flex-direction:column;gap:14px;}
.artifact-set-card{border:1px solid #d9e2ef;border-radius:18px;padding:14px;background:#fbfdff;}
.artifact-set-strip{display:flex;flex-wrap:wrap;gap:10px;align-items:stretch;}
.artifact-set-tile{width:96px;min-height:116px;display:flex;flex-direction:column;align-items:center;justify-content:flex-start;gap:6px;text-align:center;text-decoration:none;border:1px solid #d9e2ef;background:#f8fafc;border-radius:14px;padding:8px;color:inherit;}
.artifact-set-tile:hover{background:#eef5ff;border-color:#9bbff5;}
.artifact-set-tile.active{outline:2px solid #2563eb;background:#eff6ff;}
.artifact-set-tile img{width:56px;height:56px;object-fit:contain;}
.artifact-set-tile small{font-size:11px;line-height:1.15;display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden;}
@media (max-width: 760px){.artifact-detail-layout{grid-template-columns:1fr}.artifact-set-tile{width:86px}.artifact-big-frame{min-height:220px}}

/* Artifact set detail cards */
.artifact-set-detail-grid{display:grid;grid-template-columns:minmax(260px,360px) 1fr;gap:16px;align-items:start}
.artifact-set-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(145px,1fr));gap:12px}
.artifact-set-detail-tile{min-height:172px;border:1px solid #d9e2ef;background:#f8fafc;border-radius:16px;padding:12px;display:flex;flex-direction:column;align-items:center;justify-content:flex-start;gap:8px;text-align:center}
.artifact-set-detail-tile.known{background:#fbfffb;border-color:#cdebd5}
.artifact-set-detail-tile.pending{background:#fffaf0;border-color:#fde3a7}
.artifact-set-detail-tile img{width:72px;height:72px;object-fit:contain}
.artifact-set-detail-tile b{font-size:13px;line-height:1.2}
.artifact-set-detail-tile .badge{margin-top:auto}
.artifact-missing-icon{width:72px;height:72px;display:flex;align-items:center;justify-content:center;border:1px dashed #cbd5e1;border-radius:14px;background:#fff;color:#94a3b8;font-weight:800;font-size:28px}
.set-bonus-list{display:flex;flex-direction:column;gap:8px}
.set-bonus-line{border:1px solid #d9e2ef;background:#f8fafc;border-radius:12px;padding:10px 12px;white-space:pre-line}
@media (max-width: 760px){.artifact-set-detail-grid{grid-template-columns:1fr}.artifact-set-grid{grid-template-columns:repeat(auto-fill,minmax(120px,1fr))}.artifact-set-detail-tile img,.artifact-missing-icon{width:62px;height:62px}}
.set-tier-stack{display:flex;flex-direction:column;gap:18px}
.set-tier-block{border:1px solid #d9e2ef;border-radius:18px;background:#fbfdff;padding:14px}
.set-tier-block h3{margin:0;font-size:16px}

/* Artifact set detail workbench v2 */
.set-description{max-width:980px;white-space:pre-line;color:#334155;line-height:1.5;margin:8px 0 0}
.set-workbench{display:grid;grid-template-columns:minmax(420px,1.35fr) minmax(300px,.85fr);gap:16px;align-items:start}
.set-artifacts-panel,.set-bonus-panel{min-width:0}
.selected-counter{border:1px solid #d9e2ef;background:#f8fafc;border-radius:14px;padding:8px 12px;display:flex;flex-direction:column;align-items:center;gap:2px;min-width:86px}
.selected-counter b{font-size:22px;line-height:1}
.set-variant-tabs{display:flex;flex-wrap:wrap;gap:8px}
.set-variant-tab{border:1px solid #d9e2ef;background:#f8fafc;border-radius:14px;padding:9px 12px;cursor:pointer;text-align:left;display:flex;flex-direction:column;gap:2px;color:inherit;max-width:260px}
.set-variant-tab:hover{background:#eef5ff;border-color:#9bbff5}
.set-variant-tab.active{background:#111827;color:#fff;border-color:#111827}
.set-variant-tab small{font-size:11px;opacity:.78;line-height:1.2}
.set-variant-panel{display:none}
.set-variant-panel.active{display:block}
.equipment-grid{display:grid;grid-template-columns:minmax(110px,1fr) minmax(110px,1fr) minmax(110px,1fr) minmax(110px,1fr);grid-template-areas:"rings head amulet bag" "rings body back back" "right-hand legs left-hand left-hand";gap:10px;align-items:stretch}
.equipment-slot{border:1px solid #d9e2ef;border-radius:16px;background:#fbfdff;min-height:150px;padding:10px;display:flex;flex-direction:column;gap:8px}
.equipment-slot.empty{background:#f8fafc;border-style:dashed;color:#94a3b8}
.equipment-slot-rings{grid-area:rings}.equipment-slot-head{grid-area:head}.equipment-slot-amulet{grid-area:amulet}.equipment-slot-bag{grid-area:bag}.equipment-slot-body{grid-area:body}.equipment-slot-back{grid-area:back}.equipment-slot-left-hand{grid-area:left-hand}.equipment-slot-legs{grid-area:legs}.equipment-slot-right-hand{grid-area:right-hand}.equipment-slot-unknown{grid-column:1/-1}
.equipment-slot-title{display:flex;align-items:center;justify-content:space-between;gap:8px;border-bottom:1px solid #e5edf7;padding-bottom:6px;min-height:24px}
.equipment-slot-title b{font-size:13px}
.equipment-slot-items{display:flex;flex-wrap:wrap;gap:8px;align-items:stretch}
.equipment-empty{display:flex;align-items:center;justify-content:center;flex:1}
.set-pick-tile{position:relative;width:116px;min-height:150px;border:1px solid #d9e2ef;background:#f8fafc;border-radius:14px;padding:8px;display:flex;flex-direction:column;align-items:center;justify-content:flex-start;gap:5px;text-align:center;color:inherit;cursor:pointer}
.set-pick-tile:hover{background:#eef5ff;border-color:#9bbff5}
.set-pick-tile.known{background:#fbfffb;border-color:#cdebd5}.set-pick-tile.pending{background:#fffaf0;border-color:#fde3a7}
.set-pick-tile.selected{outline:2px solid #2563eb;background:#eff6ff;border-color:#93c5fd}

.set-pick-tile:focus{outline:2px solid #93c5fd;outline-offset:2px}
.set-pick-open{position:absolute;left:6px;top:6px;width:22px;height:22px;border-radius:999px;background:#fff;border:1px solid #d9e2ef;color:#2563eb;font-weight:800;line-height:20px;text-decoration:none;z-index:3}
.set-pick-open:hover{background:#eff6ff}
.set-pick-tooltip{display:none;position:absolute;left:50%;bottom:calc(100% + 10px);transform:translateX(-50%);width:270px;max-width:80vw;background:#111827;color:#fff;border-radius:12px;padding:10px 12px;text-align:left;font-size:12px;line-height:1.35;box-shadow:0 12px 32px rgba(15,23,42,.25);z-index:20}
.set-pick-tooltip::after{content:"";position:absolute;left:50%;top:100%;transform:translateX(-50%);border:7px solid transparent;border-top-color:#111827}
.set-pick-tooltip span{display:block;margin-top:3px}.set-pick-tooltip .tooltip-section{margin-top:8px;color:#bfdbfe;font-weight:700}
.set-pick-tile:hover .set-pick-tooltip,.set-pick-tile:focus .set-pick-tooltip{display:block}
.set-pick-count{position:absolute;right:6px;top:6px;min-width:22px;height:22px;padding:0 5px;border-radius:999px;background:#2563eb;color:white;font-size:13px;font-weight:800;line-height:22px;display:none}
.set-pick-tile.selected .set-pick-count{display:block}
.set-pick-image{width:62px;height:62px;display:flex;align-items:center;justify-content:center}
.set-pick-image img{width:62px;height:62px;object-fit:contain}
.artifact-missing-icon.small-icon{width:62px;height:62px;font-size:22px}
.set-pick-name{font-weight:700;font-size:12px;line-height:1.15;display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden}
.set-pick-meta{font-size:10.5px;line-height:1.15;overflow-wrap:anywhere}
.set-debug-summary{border-top:1px solid #e5edf7;padding-top:12px}
.set-debug-summary summary{cursor:pointer;color:#64748b;font-size:13px}
@media (max-width: 1100px){.set-workbench{grid-template-columns:1fr}.set-bonus-panel{order:2}}
@media (max-width: 760px){.equipment-grid{grid-template-columns:1fr 1fr;grid-template-areas:"head amulet" "rings rings" "body back" "right-hand left-hand" "legs bag"}.equipment-slot{min-height:132px}.set-pick-tile{width:104px;min-height:140px}.set-pick-image,.set-pick-image img,.artifact-missing-icon.small-icon{width:54px;height:54px}}

/* Artifact effect rule catalog */
.effect-rule-grid{display:grid;grid-template-columns:minmax(0,1fr) minmax(320px,.8fr);gap:16px;align-items:start}
.effect-rule-row{border:1px solid #e5edf7;border-radius:14px;padding:10px;background:#fbfdff;margin-bottom:10px}
.effect-rule-row.mapped{background:#f8fff9;border-color:#cdebd5}
.effect-rule-row.unmapped{background:#fffaf0;border-color:#fde3a7}
.effect-rule-form{display:grid;grid-template-columns:minmax(180px,1fr) minmax(220px,1fr) minmax(150px,.55fr) auto;gap:8px;align-items:end;margin-top:8px}
.effect-rule-form input,.effect-rule-form select{min-width:0}
.effect-examples{margin-top:5px;color:#64748b;font-size:12px}
@media (max-width: 1000px){.effect-rule-grid{grid-template-columns:1fr}.effect-rule-form{grid-template-columns:1fr 1fr}.effect-rule-form button{grid-column:1/-1}}

.effect-base-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(170px,1fr));gap:10px}
.effect-base-chip{border:1px solid #e5edf7;border-radius:14px;padding:10px;background:#fbfdff;display:flex;flex-direction:column;gap:4px}
.top-space-small{margin-top:6px}

.effect-rule-table th,.effect-rule-table td{vertical-align:top}
.effect-rule-table td{min-width:110px}
.effect-rule-table td:first-child{min-width:140px}
.effect-param-icon{width:28px;height:28px;object-fit:contain;display:block;margin-bottom:4px}
.compact-input{width:100%;min-width:0;font-size:12px;padding:5px 7px}
.effect-rule-table textarea.compact-input{resize:vertical;min-height:42px}
@media (max-width: 1100px){.effect-rule-table{min-width:1050px}.table-wrap{overflow-x:auto}}
.effect-icon-editor{display:grid;grid-template-columns:32px minmax(120px,1fr);gap:6px;align-items:center;min-width:190px}
.effect-icon-editor .compact-input{grid-column:1/-1}
.effect-icon-upload{grid-column:1/-1;justify-content:center;cursor:pointer}
.effect-icon-upload input{display:none}
.effect-param-icon.empty{display:flex;align-items:center;justify-content:center;border:1px dashed #c7d2e2;border-radius:8px;color:#9aa7b7;background:#f8fafc;font-weight:700}
.btn-mini{padding:4px 7px;font-size:.82rem}
.effect-rule-form{grid-template-columns:minmax(150px,.8fr) minmax(180px,1fr) minmax(220px,1fr) minmax(150px,.55fr) minmax(140px,.7fr) auto}
@media (max-width: 1000px){.effect-rule-form{grid-template-columns:1fr 1fr}.effect-rule-form button{grid-column:1/-1}}

/* Artifact parameter rows */
.artifact-param-list{display:grid;grid-template-columns:repeat(auto-fit,minmax(210px,1fr));gap:8px;margin-top:8px}
.artifact-param-row{display:grid;grid-template-columns:30px 1fr auto;gap:8px;align-items:center;border:1px solid #d9e2ef;background:#fbfdff;border-radius:14px;padding:8px 10px;min-height:44px}
.artifact-param-row.raw-effect{grid-template-columns:30px 1fr auto auto;background:#fffaf0;border-color:#fde3a7}
.artifact-param-row .artifact-param-icon{width:28px;height:28px;object-fit:contain;display:block;margin:0}
.artifact-param-row .artifact-param-icon.empty{display:flex;align-items:center;justify-content:center;border:1px dashed #c7d2e2;border-radius:8px;color:#9aa7b7;background:#f8fafc;font-size:12px;font-weight:800}
.artifact-param-label{font-weight:650;line-height:1.18}
.artifact-param-value{font-size:16px;white-space:nowrap;color:#111827}
@media (max-width: 640px){.artifact-param-list{grid-template-columns:1fr}.artifact-param-row{grid-template-columns:28px 1fr auto}.artifact-param-row.raw-effect{grid-template-columns:28px 1fr auto}}

/* Structured set bonuses */
.structured-bonus-list{display:flex;flex-direction:column;gap:8px}
.set-bonus-threshold{font-weight:750;color:#334155;background:#eef6ff;border:1px solid #d8e9ff;border-radius:12px;padding:7px 10px;margin-top:4px}
.set-bonus-line.structured{display:flex;align-items:center;gap:8px;flex-wrap:wrap;background:#fbfdff;border:1px solid #e5edf7;border-radius:14px;padding:8px 10px}
.set-bonus-line.raw{background:#fffaf0;border:1px solid #fde3a7;border-radius:12px;padding:7px 10px}
.set-bonus-threshold-chip{font-size:12px;color:#475569;background:#eef2f7;border-radius:999px;padding:3px 8px}
.set-bonus-effect{display:inline-flex;align-items:center;gap:6px;min-height:30px}
.set-bonus-effect .artifact-param-icon{width:24px;height:24px}

/* Set calculator v10 */
.set-calc-card{border:1px solid #d9e2ef;background:#f8fafc;border-radius:16px;padding:12px}
.set-calc-card h3,.set-calc-card h4{margin:0}
.set-calc-card h4{font-size:13px;color:#334155}
.set-calc-meta{display:flex;flex-wrap:wrap;gap:8px}
.set-calc-meta span{border:1px solid #e5edf7;background:#fff;border-radius:999px;padding:4px 9px;font-size:12px;color:#475569}
.set-calc-section{display:flex;flex-direction:column;gap:6px}
.set-calc-list{display:flex;flex-direction:column;gap:6px}
.set-calc-list.empty{border:1px dashed #cbd5e1;background:#fff;border-radius:12px;padding:8px 10px}
.set-calc-row{display:grid;grid-template-columns:28px 1fr auto;gap:7px;align-items:center;border:1px solid #e5edf7;background:#fff;border-radius:12px;padding:6px 8px;min-height:38px}
.set-calc-row.uncomputed{background:#fffaf0;border-color:#fde3a7;grid-template-columns:28px minmax(120px,1fr) minmax(120px,1.2fr)}
.set-calc-row .artifact-param-icon{width:24px;height:24px;object-fit:contain}
.set-calc-row .artifact-param-icon.empty{display:flex;align-items:center;justify-content:center;border:1px dashed #c7d2e2;border-radius:8px;color:#9aa7b7;background:#f8fafc;font-size:11px;font-weight:800}
.set-calc-label{font-weight:650;line-height:1.15}
.set-calc-value{white-space:nowrap;color:#111827}
@media (max-width:640px){.set-calc-row.uncomputed{grid-template-columns:28px 1fr}.set-calc-row.uncomputed small{grid-column:2}}

/* Catalog navigation and overview */
.nav-sep{border:0;border-top:1px solid #e5e7eb;margin:6px 4px}
.section-nav{margin-top:14px;border:1px solid #d9e2ef;border-radius:16px;background:#fff;box-shadow:0 6px 18px rgba(15,23,42,.04);padding:12px}
.section-nav-head{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:10px}
.section-nav-head b{display:block;font-size:14px}
.section-nav-links{display:flex;flex-wrap:wrap;gap:8px}
.section-nav-link{display:inline-flex;align-items:center;gap:6px;border:1px solid #d9e2ef;border-radius:999px;background:#f8fafc;color:#1f2937;padding:8px 11px;font-size:13px;font-weight:700;text-decoration:none}
.section-nav-link:hover{background:#eef5ff;text-decoration:none}
.section-nav-link.active{background:#111827;border-color:#111827;color:#fff}
.catalog-overview-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:14px}
.catalog-overview-card{display:flex;flex-direction:column;gap:8px;min-height:170px;border:1px solid #d9e2ef;border-radius:18px;background:#fff;padding:16px;color:inherit;text-decoration:none;box-shadow:0 8px 24px rgba(0,0,0,.035)}
.catalog-overview-card:hover{background:#f8fbff;border-color:#a9c7f5;text-decoration:none;transform:translateY(-1px)}
.catalog-overview-icon{font-size:28px;line-height:1}
.catalog-overview-card .badge{align-self:flex-start;margin-top:auto}
.workflow-steps{display:grid;grid-template-columns:repeat(auto-fit,minmax(210px,1fr));gap:12px}
.workflow-steps div{border:1px solid #e5edf7;border-radius:14px;background:#fbfdff;padding:12px;display:flex;flex-direction:column;gap:4px}
@media (max-width: 760px){.section-nav-head{align-items:flex-start;flex-direction:column}.section-nav-link{font-size:12px;padding:7px 9px}.catalog-overview-card{min-height:auto}}

/* Catalog media manager v15 */
.catalog-media-filter{display:grid;grid-template-columns:minmax(220px,1fr) minmax(180px,.45fr) minmax(150px,.35fr) auto auto;gap:10px;align-items:end}
.catalog-media-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(210px,1fr));gap:14px;align-items:stretch}
.catalog-media-card{border:1px solid #d9e2ef;background:#fff;border-radius:18px;padding:12px;display:flex;flex-direction:column;gap:10px;min-width:0;box-shadow:0 8px 24px rgba(15,23,42,.035)}
.catalog-media-preview{height:132px;border:1px solid #e5edf7;background:linear-gradient(180deg,#f8fafc,#eef3f8);border-radius:16px;display:flex;align-items:center;justify-content:center;padding:12px;text-decoration:none;color:inherit}
.catalog-media-preview img{width:96px;height:96px;object-fit:contain;display:block}
.catalog-media-preview.small-preview{height:104px}.catalog-media-preview.small-preview img{width:64px;height:64px}
.catalog-media-title{display:flex;flex-direction:column;gap:2px;min-width:0}.catalog-media-title b{line-height:1.18;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}.catalog-media-title span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.catalog-media-quick{margin-top:auto}.catalog-media-upload{display:grid;grid-template-columns:1fr auto;gap:8px;align-items:center}.catalog-media-upload input{min-width:0;font-size:12px}
.effect-icon-library.compact-icons{grid-template-columns:repeat(auto-fill,minmax(190px,1fr))}.effect-icon-library-item{text-align:left}.effect-icon-library-item .tag{font-size:11px;padding:4px 7px;margin:2px 2px 0 0;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
@media (max-width:900px){.catalog-media-filter{grid-template-columns:1fr 1fr}.catalog-media-filter button,.catalog-media-filter a{align-self:stretch;justify-content:center}.catalog-media-grid{grid-template-columns:repeat(auto-fill,minmax(160px,1fr))}.catalog-media-upload{grid-template-columns:1fr}.catalog-media-preview{height:112px}.catalog-media-preview img{width:82px;height:82px}}
@media (max-width:560px){.catalog-media-filter{grid-template-columns:1fr}.catalog-media-grid{grid-template-columns:1fr 1fr}.catalog-media-card{padding:9px;border-radius:14px}.catalog-media-preview{height:96px;border-radius:12px}.catalog-media-preview img{width:72px;height:72px}.catalog-media-title b{font-size:13px}.catalog-media-title span{font-size:11px}.catalog-media-card .btn-mini{font-size:11px;padding:4px 6px}}

/* Effect rules redesign */
.effect-rules-toolbar{display:flex;gap:10px;align-items:end;flex-wrap:wrap}.effect-rules-toolbar .grow{flex:1 1 320px}.effect-rules-toolbar .btn{white-space:nowrap}
.effect-rules-summary{display:grid;grid-template-columns:repeat(auto-fit,minmax(160px,1fr));gap:12px}.metric-card{border:1px solid #d9e2ef;background:#fff;border-radius:16px;padding:14px;display:flex;flex-direction:column;gap:4px;box-shadow:0 8px 24px rgba(15,23,42,.035)}.metric-card.warn{border-color:#f6c96d;background:#fffaf0}.metric-value{font-size:26px;font-weight:800;line-height:1}.metric-label{font-size:12px;color:#64748b}
.effect-attribute-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(300px,1fr));gap:14px}.effect-attribute-card{border:1px solid #d9e2ef;background:#fff;border-radius:18px;padding:14px;min-width:0;box-shadow:0 8px 24px rgba(15,23,42,.035)}.effect-attribute-card.muted-card{opacity:.74;background:#f8fafc}.effect-attribute-head{display:grid;grid-template-columns:52px minmax(0,1fr);gap:12px;align-items:center}.effect-attribute-icon-wrap{width:52px;height:52px;border-radius:14px;background:linear-gradient(180deg,#f8fafc,#eef3f8);border:1px solid #e5edf7;display:flex;align-items:center;justify-content:center}.effect-param-icon.large{width:40px;height:40px;margin:0}.effect-attribute-title{min-width:0}.effect-attribute-title b{display:block;line-height:1.2;overflow:hidden;text-overflow:ellipsis;overflow-wrap:anywhere}.effect-attribute-title code{display:inline-block;margin-top:3px;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:#64748b}.effect-attribute-meta{display:flex;gap:8px;flex-wrap:wrap;margin-top:10px;color:#64748b;font-size:12px}.effect-attribute-meta span{border:1px solid #e5edf7;border-radius:999px;padding:3px 7px;background:#f8fafc}.effect-chip-row{display:flex;gap:6px;flex-wrap:wrap;margin-top:10px;max-height:54px;overflow:hidden}.effect-chip-row span{font-size:12px;line-height:1.25;border-radius:999px;background:#eef2ff;color:#334155;padding:4px 8px;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.effect-group-form{display:grid;grid-template-columns:repeat(3,minmax(150px,1fr));gap:10px;align-items:end}.effect-group-form label,.effect-unmapped-card .effect-rule-form label{min-width:0}.effect-group-form input,.effect-group-form select,.effect-unmapped-card .effect-rule-form input,.effect-unmapped-card .effect-rule-form select{min-width:0;max-width:100%}.effect-group-form .wide{grid-column:1/-1}.inline-check{display:inline-flex;gap:6px;align-items:center;font-size:13px}.danger-text{color:#b42318!important}.badge.danger{background:#fee2e2;color:#991b1b}.effect-source-list{display:flex;flex-direction:column;gap:8px;margin-top:8px}.effect-source-item{border:1px dashed #d9e2ef;border-radius:12px;background:#fbfdff;padding:8px;min-width:0}.effect-source-text{margin-top:5px;font-size:13px;line-height:1.35;word-break:break-word;color:#334155}
.effect-unmapped-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(320px,1fr));gap:12px}.effect-unmapped-card{border:1px solid #fde3a7;background:#fffaf0;border-radius:16px;padding:12px;min-width:0}.effect-unmapped-main{min-width:0}.effect-unmapped-main b{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;line-height:1.25;overflow-wrap:anywhere}.effect-unmapped-card .effect-rule-form{grid-template-columns:1fr 1fr;align-items:end}.effect-unmapped-card .effect-rule-form button[type=submit]{grid-column:1/-1}.effect-examples{font-size:12px;color:#64748b;margin-top:4px;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}.effect-param-icon.empty.large{width:40px;height:40px}
@media (max-width:760px){.effect-attribute-grid,.effect-unmapped-grid{grid-template-columns:1fr}.effect-group-form,.effect-unmapped-card .effect-rule-form{grid-template-columns:1fr}.effect-rules-toolbar{display:grid;grid-template-columns:1fr}.effect-rules-toolbar .btn{justify-content:center}.effect-attribute-card{padding:12px}}


/* v19: effect-rules card form containment */
.effect-attribute-grid{
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
}
.effect-attribute-card,
.effect-unmapped-card,
.effect-source-item{
  overflow: hidden;
}
.effect-group-form,
.effect-unmapped-card .effect-rule-form{
  grid-template-columns: 1fr;
}
.effect-group-form label,
.effect-unmapped-card .effect-rule-form label{
  min-width: 0;
  max-width: 100%;
}
.effect-group-form input,
.effect-group-form select,
.effect-group-form textarea,
.effect-unmapped-card .effect-rule-form input,
.effect-unmapped-card .effect-rule-form select{
  box-sizing: border-box;
  min-width: 0;
  max-width: 100%;
  width: 100%;
}
.effect-attribute-title b,
.effect-unmapped-main b,
.effect-source-text,
.effect-source-item code{
  overflow-wrap: anywhere;
  word-break: break-word;
}
@media (max-width: 760px){
  .effect-attribute-grid,
  .effect-unmapped-grid{
    grid-template-columns: 1fr;
  }
}

/* v20: effect rules read-only cards and debug pages */
.effect-attribute-actions{display:flex;gap:8px;align-items:center;flex-wrap:wrap}
.effect-attribute-actions form{margin:0}
.effect-edit-form{display:grid;grid-template-columns:minmax(220px,1fr) minmax(180px,.5fr) minmax(140px,.35fr);gap:12px;align-items:end;max-width:980px}
.effect-edit-form label{min-width:0}.effect-edit-form input,.effect-edit-form select{box-sizing:border-box;width:100%;min-width:0;max-width:100%}
.effect-edit-icon-row{display:flex;gap:10px;align-items:center;flex-wrap:wrap}
.debug-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(360px,1fr));gap:14px;align-items:start}.debug-pre{white-space:pre-wrap;overflow:auto;max-height:360px;border:1px solid #e5edf7;border-radius:12px;background:#f8fafc;padding:10px;font-size:12px;line-height:1.4}
@media (max-width:760px){.effect-edit-form,.debug-grid{grid-template-columns:1fr}}

/* v21: catalog refresh/review workflow */
.bulk-refresh-panel{border:1px dashed #cbd5e1;background:#f8fafc;border-radius:16px;padding:12px}
.review-badge{display:inline-flex;align-items:center;gap:6px;border-radius:999px;padding:4px 9px;font-size:12px;font-weight:700;white-space:nowrap;border:1px solid #cbd5e1;background:#f8fafc;color:#334155}
.review-ok{border-color:#bbf7d0;background:#f0fdf4;color:#166534}.review-problem{border-color:#fed7aa;background:#fff7ed;color:#9a3412}.review-skip{border-color:#ddd6fe;background:#f5f3ff;color:#5b21b6}.review-unreviewed{border-color:#cbd5e1;background:#f8fafc;color:#475569}
.review-form{display:grid;grid-template-columns:minmax(160px,.4fr) minmax(260px,1fr) auto;gap:10px;align-items:end}.review-form label{min-width:0}.review-form input,.review-form select{box-sizing:border-box;min-width:0;width:100%}.review-form .wide{min-width:0}
@media (max-width:760px){.review-form{grid-template-columns:1fr}.bulk-refresh-panel .row{align-items:stretch}.bulk-refresh-panel .btn{justify-content:center}}


/* v24: compact modal icon picker for effect attribute editor */
.icon-picker-modal{display:none;position:fixed;inset:0;z-index:10000;align-items:center;justify-content:center;padding:24px}
.icon-picker-modal.open{display:flex}
.icon-picker-backdrop{position:absolute;inset:0;background:rgba(15,23,42,.45)}
.icon-picker-dialog{position:relative;z-index:1;width:min(920px,calc(100vw - 32px));max-height:min(82vh,760px);overflow:auto;border-radius:18px;background:#fff;padding:16px;box-shadow:0 22px 70px rgba(15,23,42,.28)}
.icon-picker-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(86px,1fr));gap:10px}
.icon-picker-option{border:1px solid #d9e2ef;background:#f8fafc;border-radius:14px;padding:8px;min-height:84px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:6px;cursor:pointer;text-align:center;color:#334155}
.icon-picker-option:hover{border-color:#8fb5e8;background:#eef6ff}
.icon-picker-option img{width:42px!important;height:42px!important;max-width:42px!important;max-height:42px!important;object-fit:contain;display:block}
.icon-picker-option span{display:block;max-width:100%;font-size:11px;line-height:1.15;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
@media (max-width:560px){.icon-picker-modal{padding:10px}.icon-picker-dialog{width:calc(100vw - 20px);max-height:92vh;padding:12px}.icon-picker-grid{grid-template-columns:repeat(auto-fill,minmax(72px,1fr));gap:8px}.icon-picker-option{min-height:72px;padding:6px}.icon-picker-option img{width:34px!important;height:34px!important;max-width:34px!important;max-height:34px!important}}

/* v25: artifact parsed/manual tags */
.artifact-tags-row{gap:6px;align-items:center}.tag.parsed-tag{background:#eef6ff;border-color:#bfdbfe;color:#1e3a8a}.tag.manual-tag{background:#fff7ed;border-color:#fed7aa;color:#9a3412}.checkbox-tag{display:inline-flex;gap:6px;align-items:center;cursor:pointer}.checkbox-tag input{width:auto;margin:0}


/* v26: effect rules workbench tabs */
.effect-rules-tabs{display:flex;gap:8px;flex-wrap:wrap;align-items:center}
.effect-rules-tab{display:inline-flex;align-items:center;gap:6px;border:1px solid #d9e2ef;background:#f8fafc;border-radius:999px;padding:8px 12px;text-decoration:none;color:#334155;font-weight:700;font-size:13px}
.effect-rules-tab.active{background:#e0f2fe;border-color:#7dd3fc;color:#075985}
.effect-phrase-table{width:100%;border-collapse:collapse;min-width:920px}
.effect-phrase-table th,.effect-phrase-table td{border-bottom:1px solid #e5edf7;padding:9px 8px;vertical-align:top;text-align:left}
.effect-phrase-table th{font-size:12px;color:#64748b;text-transform:uppercase;letter-spacing:.03em;background:#f8fafc}
.effect-guidance{border:1px solid #bae6fd;background:#f0f9ff;color:#075985;border-radius:12px;padding:10px 12px;font-size:13px;line-height:1.4}
.effect-diagnostic-list{display:grid;grid-template-columns:repeat(auto-fill,minmax(280px,1fr));gap:10px}
.effect-diagnostic-item{border:1px solid #d9e2ef;background:#fff;border-radius:14px;padding:10px;line-height:1.35;overflow-wrap:anywhere}
.effect-diagnostic-item.warn{border-color:#fde68a;background:#fffbeb;color:#92400e}.effect-diagnostic-item.danger{border-color:#fecaca;background:#fef2f2;color:#991b1b}

/* v28: manage phrase assignments directly from phrases/conditional tabs */
.effect-phrase-actions{min-width:220px;display:flex;gap:6px;align-items:flex-start;flex-wrap:wrap}
.effect-phrase-actions form{margin:0}
.effect-phrase-actions details{min-width:180px}
.effect-phrase-actions summary.btn{display:inline-flex;cursor:pointer;list-style:none}
.effect-phrase-actions summary::-webkit-details-marker{display:none}
.effect-phrase-edit-form{display:grid;grid-template-columns:1fr;gap:8px;border:1px solid #e5edf7;background:#f8fafc;border-radius:12px;padding:10px;min-width:260px;max-width:340px}
.effect-phrase-edit-form label{min-width:0;font-size:12px;color:#64748b;font-weight:700}
.effect-phrase-edit-form input,.effect-phrase-edit-form select{box-sizing:border-box;width:100%;min-width:0;margin-top:3px}
@media (max-width:760px){.effect-phrase-actions{min-width:0}.effect-phrase-edit-form{min-width:220px;max-width:100%}}

/* v32: conditional formula controls */
.effect-rule-form .wide,
.effect-phrase-edit-form .wide{grid-column:1/-1}
.effect-phrase-table td:nth-child(3){min-width:180px}

/* v33: phrase setup assistant */
.effect-field-hidden{display:none!important}
.effect-guidance{border:1px solid #bfdbfe;background:#eff6ff;color:#1e3a8a;border-radius:14px;padding:10px 12px;font-size:13px;line-height:1.45}
.js-effect-rule-form.effect-form-noise-mode,.js-effect-rule-form.effect-form-tag-mode{background:#f8fafc}
.js-effect-rule-form.effect-form-condition-mode{background:#fff7ed;border-color:#fed7aa}
.js-effect-rule-form.effect-form-multi-mode{background:#f5f3ff;border-color:#ddd6fe}
.effect-rule-form.improved .effect-field-hidden + .effect-field-hidden{display:none!important}
.copy-row{display:inline-flex;align-items:center;gap:6px}
.copy-mini-btn{border:0;background:transparent;cursor:pointer;padding:2px 4px;border-radius:6px;line-height:1;font-size:14px;opacity:.72}
.copy-mini-btn:hover,.copy-mini-btn.copied{background:#eef2ff;opacity:1}
.copy-amount-btn{border:0;background:transparent;color:inherit;cursor:pointer;padding:0;border-radius:6px;font:inherit}
.copy-amount-btn:hover,.copy-amount-btn.copied{background:#eef2ff;text-decoration:underline}

.payment-description{white-space:pre-wrap;min-width:220px}

/* subrent payout calculation details */
.payment-description{white-space:normal;min-width:220px}
.payment-description-main{white-space:pre-wrap}
.payment-details{margin-top:6px}
.payment-details summary{cursor:pointer;color:#2563eb;font-weight:700;font-size:13px;list-style:none}
.payment-details summary::-webkit-details-marker{display:none}
.payment-details summary::before{content:"▸";display:inline-block;margin-right:6px;transition:transform .12s ease}
.payment-details[open] summary::before{transform:rotate(90deg)}
.payment-details pre{white-space:pre-wrap;margin:8px 0 0;padding:10px;border-radius:10px;background:#f8fafc;border:1px solid #e5edf7;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono",monospace;font-size:12px;line-height:1.45;max-width:620px;overflow:auto}


/* Subrent daily activity */
.subrent-activity-totals{display:grid;grid-template-columns:repeat(4,minmax(140px,1fr));gap:10px;margin:14px 0 16px}
.subrent-activity-totals>div{border:1px solid var(--line);border-radius:12px;background:#f8fafc;padding:10px 12px;display:flex;flex-direction:column;gap:4px}
.subrent-activity-table td,.subrent-activity-table th{vertical-align:middle}
.subrent-activity-bar-wrap{position:relative;min-width:130px;min-height:26px;border:1px solid var(--line);border-radius:999px;background:#f8fafc;overflow:hidden}
.subrent-activity-bar{position:absolute;left:0;top:0;bottom:0;background:#dbeafe;border-radius:999px}
.subrent-activity-bar-text{position:relative;z-index:1;display:inline-flex;align-items:center;min-height:24px;padding:0 10px;font-weight:700}
@media (max-width: 760px){.subrent-activity-totals{grid-template-columns:1fr 1fr}.subrent-activity-table{font-size:12px}.subrent-activity-bar-wrap{min-width:86px}}
