:root {
    color-scheme: light;
    --bg: #edf0f5;
    --surface: #ffffff;
    --surface-subtle: #f6f7fa;
    --border: #e0e3ea;
    --text: #20232d;
    --muted: #7a8191;
    --brand: #7c3aed;
    --brand-soft: #f0eaff;
    --success: #16865a;
    --success-soft: #e7f7f0;
    --warning: #b46b09;
    --warning-soft: #fff4dc;
    --danger: #cf3c4f;
    --danger-soft: #ffedf0;
    --info: #2166c2;
    --info-soft: #eaf2ff;
    --shadow: 0 16px 44px rgba(38, 43, 58, .08);
    --radius: 16px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--text);
}
button, input, select, textarea { font: inherit; }
button, [role="button"] { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible {
    outline: 3px solid rgba(109, 66, 216, .25);
    outline-offset: 2px;
}
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

.login-container {
    position: relative;
    isolation: isolate;
    min-height: 100vh;
    min-height: 100svh;
    display: grid;
    place-items: center;
    overflow: auto;
    padding: 36px;
    background:
        radial-gradient(circle at 84% 14%, rgba(158, 112, 239, .2), transparent 29%),
        radial-gradient(circle at 5% 91%, rgba(124, 58, 237, .11), transparent 28%),
        linear-gradient(145deg, #fbfafc 0%, #f7f4fb 58%, #f4f0fb 100%);
}
.login-container::before,
.login-container::after {
    position: absolute;
    z-index: -1;
    width: 420px;
    height: 420px;
    border: 1px solid rgba(124, 58, 237, .08);
    border-radius: 50%;
    content: "";
}
.login-container::before { top: -230px; right: -120px; box-shadow: 0 0 0 72px rgba(124, 58, 237, .025), 0 0 0 144px rgba(124, 58, 237, .018); }
.login-container::after { bottom: -330px; left: -180px; box-shadow: 0 0 0 84px rgba(124, 58, 237, .018); }
.login-shell {
    width: min(1220px, 100%);
    min-height: 690px;
    display: grid;
    grid-template-columns: minmax(430px, .82fr) minmax(460px, 1.18fr);
    overflow: hidden;
    border: 1px solid rgba(72, 60, 96, .14);
    border-radius: 24px;
    background: var(--surface);
    box-shadow: 0 28px 70px rgba(32, 24, 52, .16);
}
.login-hero {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow: hidden;
    min-width: 0;
    padding: 54px 48px 42px;
    color: #fff;
    background:
        radial-gradient(circle at 83% 48%, rgba(145, 101, 235, .22), transparent 28%),
        linear-gradient(150deg, #181126 0%, #251936 56%, #302047 100%);
}
.login-hero::after { position: absolute; inset: 0; background: linear-gradient(120deg, transparent 44%, rgba(255,255,255,.025)); content: ""; pointer-events: none; }
.login-hero-brand { position: relative; z-index: 2; display: flex; align-items: center; gap: 14px; font-size: 1.2rem; letter-spacing: -.02em; }
.login-hero .brand-mark { width: 48px; height: 48px; border-radius: 14px; background: linear-gradient(145deg, #b597ff, #7849e8); border: 1px solid rgba(255,255,255,.22); box-shadow: 0 12px 30px rgba(91, 52, 181, .38); font-size: 1.18rem; }
.login-hero-copy { position: relative; z-index: 2; max-width: 470px; margin-top: 28px; }
.login-kicker { display: inline-block; margin-bottom: 18px; color: #cbbaff; font-size: .76rem; font-weight: 800; letter-spacing: .18em; }
.login-hero h2 { max-width: 470px; margin: 0 0 20px; font-size: clamp(2.15rem, 3.5vw, 3.4rem); line-height: 1.12; letter-spacing: -.045em; }
.login-hero p { max-width: 450px; margin: 0; color: rgba(239, 234, 249, .78); font-size: .95rem; line-height: 1.8; }
.login-orbit { position: relative; z-index: 1; width: min(440px, 100%); height: 230px; margin: -4px auto -20px; }
.login-orbit-ring { position: absolute; top: 50%; left: 50%; border: 1px solid rgba(198, 176, 255, .25); border-radius: 50%; transform: translate(-50%, -50%) rotate(-7deg); }
.login-orbit-ring.ring-one { width: 190px; height: 76px; }
.login-orbit-ring.ring-two { width: 290px; height: 118px; }
.login-orbit-ring.ring-three { width: 410px; height: 166px; border-color: rgba(198, 176, 255, .14); }
.login-orbit-core { position: absolute; top: 50%; left: 50%; width: 76px; height: 76px; border: 1px solid rgba(255,255,255,.28); border-radius: 50%; background: radial-gradient(circle at 35% 28%, #d8c8ff 0%, #9b70ef 36%, #5d38ae 74%, #352153 100%); box-shadow: 0 18px 42px rgba(116, 72, 210, .48); transform: translate(-50%, -50%); }
.login-orbit-node { position: absolute; width: 9px; height: 9px; border-radius: 50%; background: #b99af7; box-shadow: 0 0 0 4px rgba(185,154,247,.09), 0 0 18px rgba(185,154,247,.55); }
.login-orbit-node.node-one { top: 32%; left: 18%; }
.login-orbit-node.node-two { top: 65%; right: 16%; width: 12px; height: 12px; }
.login-orbit-node.node-three { top: 20%; right: 30%; width: 6px; height: 6px; }
.login-trust { position: relative; z-index: 2; display: flex; flex-wrap: wrap; gap: 9px; }
.login-trust span { display: inline-flex; align-items: center; gap: 7px; padding: 8px 12px; border: 1px solid rgba(255,255,255,.2); border-radius: 999px; color: rgba(249,247,255,.92); font-size: .75rem; background: rgba(255,255,255,.025); }
.login-trust b { color: #c8afff; font-weight: 700; }
.login-box { width: 100%; min-width: 0; display: grid; place-items: center; padding: 72px 80px; background: rgba(255,255,255,.98); }
.login-box-inner { width: min(470px, 100%); }
.login-form-kicker { display: block; margin-bottom: 14px; color: var(--brand); font-size: .76rem; font-weight: 800; letter-spacing: .14em; }
.login-box h1 { margin: 0; color: #1c1726; font-size: clamp(2.15rem, 4vw, 3rem); line-height: 1.1; letter-spacing: -.045em; }
.login-intro { margin: 13px 0 38px; color: var(--muted); font-size: .96rem; }
.login-box .form-group { margin-bottom: 21px; }
.login-box .form-group label { margin-bottom: 10px; color: #2a2533; font-size: .9rem; }
.login-box .form-group input { min-height: 56px; padding: 13px 15px; border-color: #d7d5dd; border-radius: 11px; background: #fff; transition: border-color .15s ease, box-shadow .15s ease; }
.login-box .form-group input:focus { border-color: #8154e8; box-shadow: 0 0 0 4px rgba(124,58,237,.09); outline: none; }
.password-field { position: relative; }
.password-field input { padding-right: 54px !important; }
.password-toggle { position: absolute; top: 50%; right: 8px; width: 42px; height: 42px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 9px; color: #777184; background: transparent; transform: translateY(-50%); }
.password-toggle:hover { color: var(--brand); background: var(--brand-soft); }
.password-toggle[aria-pressed="true"] { color: var(--brand); }
.login-submit { min-height: 56px; margin-top: 7px; border-radius: 11px; background: linear-gradient(90deg, #6d35df, #7b3fe3 56%, #6a32d6); box-shadow: 0 12px 24px rgba(109,53,223,.2); font-size: .96rem; }
.brand-mark { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--brand); color: white; font-weight: 800; }
.login-footnote { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 20px 0 0; color: var(--muted); font-size: .78rem; line-height: 1.55; text-align: center; }
.login-footnote span { display: grid; place-items: center; width: 20px; height: 20px; border: 1px solid rgba(124,58,237,.28); border-radius: 7px; color: var(--brand); font-weight: 800; }
.permission-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.permission-option { display: flex; align-items: flex-start; gap: 10px; padding: 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-soft); }
.permission-option input { margin-top: 3px; }
.permission-option span { display: grid; gap: 3px; }
.permission-option small { color: var(--muted); }

.form-group { margin-bottom: 18px; }
.form-group label, .field-label { display: block; color: var(--text); font-size: .85rem; font-weight: 650; margin-bottom: 7px; }
.form-control, .form-group input, .form-group textarea, .form-group select {
    width: 100%; min-height: 42px; padding: 10px 12px; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 9px;
}
.form-control-compact { width: auto; min-height: 32px; }
textarea.form-control { min-height: 110px; resize: vertical; }
.error-msg { min-height: 20px; color: var(--danger); font-size: .85rem; text-align: center; }

.app-container { min-height: 100vh; padding: 0; }
.app-shell {
    width: 100%;
    min-width: 0;
    min-height: 100vh;
    margin: 0;
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    background: var(--surface-subtle);
    border: 0;
    border-radius: 0;
    box-shadow: none;
}
.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 26px 20px 20px;
    background: var(--surface);
    color: var(--muted);
    border-right: 1px solid var(--border);
    border-radius: 0;
    display: flex;
    flex-direction: column;
    z-index: 20;
}
.sidebar-brand { display: flex; align-items: center; gap: 14px; padding: 4px 14px 30px; border-bottom: 0; }
.sidebar-brand .brand-mark { width: 46px; height: 46px; border-radius: 14px; font-size: 1.15rem; box-shadow: 0 8px 18px rgba(124, 58, 237, .18); }
.sidebar-brand strong { color: var(--text); font-size: 1.08rem; display: block; letter-spacing: -.02em; }
.sidebar-brand small { color: var(--muted); }
.nav-label { color: #9aa0ae; font-size: .72rem; letter-spacing: .08em; padding: 18px 14px 10px; }
.tabs { display: grid; gap: 7px; }
.tab {
    position: relative;
    display: flex;
    align-items: center;
    gap: 13px;
    min-height: 48px;
    padding: 12px 14px;
    border-radius: 12px;
    color: #687083;
    font-size: .92rem;
    font-weight: 620;
    border: 0;
    background: transparent;
    text-align: left;
    width: 100%;
}
.tab > span:first-child { width: 22px; color: #8991a1; text-align: center; font-size: .9rem; }
.tab:hover { color: var(--text); background: #f7f7fa; }
.tab.active { color: var(--brand); background: var(--brand-soft); }
.tab.active > span:first-child { color: var(--brand); }
.nav-count { margin-left: auto; min-width: 24px; height: 24px; padding: 0 7px; border-radius: 99px; display: inline-grid; place-items: center; color: #fff; background: #ef476f; font-size: .7rem; }
.nav-count[hidden] { display: none; }
.sidebar-footer { margin-top: auto; padding-top: 16px; border-top: 1px solid var(--border); }
.user-card { display: flex; align-items: center; gap: 10px; padding: 9px 10px; }
.user-avatar { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); font-weight: 750; }
.user-avatar-username { width: auto; min-width: 36px; max-width: 132px; padding: 0 10px; overflow: hidden; font-size: .76rem; text-overflow: ellipsis; white-space: nowrap; }
.user-details { min-width: 0; flex: 1; }
.user-card strong { display: block; color: var(--text); font-size: .84rem; max-width: 120px; overflow: hidden; text-overflow: ellipsis; }

.workspace { min-width: 0; background: var(--surface-subtle); border-radius: 0; }
.topbar { height: 84px; position: sticky; top: 0; z-index: 15; background: rgba(255,255,255,.96); backdrop-filter: blur(14px); border-bottom: 1px solid var(--border); border-radius: 0; display: flex; align-items: center; justify-content: space-between; padding: 0 38px; }
.topbar h1 { margin: 0; font-size: 1.16rem; }
.topbar p { margin: 6px 0 0; color: var(--muted); font-size: .75rem; }
.topbar-context { min-width: 0; overflow: hidden; }
.topbar-breadcrumb { display: flex; align-items: center; gap: 12px; min-width: 0; overflow: hidden; color: #959cab; font-size: .85rem; white-space: nowrap; }
.topbar-breadcrumb i { color: #b1b6c1; font-style: normal; }
.topbar-breadcrumb strong { min-width: 0; overflow: hidden; color: #626a7b; font-weight: 650; text-overflow: ellipsis; }
.top-actions { display: flex; align-items: center; gap: 9px; }
.connection-chip { display: inline-flex; align-items: center; gap: 7px; padding: 8px 11px; border: 0; border-radius: 99px; color: var(--muted); font-size: .78rem; background: transparent; }
.connection-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 3px var(--success-soft); }
.connection-chip.offline .connection-dot { background: var(--warning); box-shadow: 0 0 0 3px var(--warning-soft); }
.main-content { padding: 36px 40px 52px; max-width: none; margin: 0; }
.tab-content { display: none; }
.tab-content.active { display: block; }
.page-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; margin-bottom: 24px; }
.page-heading h2 { margin: 0 0 5px; font-size: 1.45rem; }
.page-heading p { margin: 0; color: var(--muted); font-size: .88rem; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.btn { min-height: 40px; border: 1px solid transparent; border-radius: 10px; padding: 8px 14px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; font-weight: 650; font-size: .84rem; transition: .15s ease; }
.btn-block { width: 100%; }
.btn:hover { transform: translateY(-1px); }
.btn:disabled { cursor: not-allowed; opacity: .5; transform: none; }
.btn-primary { background: var(--brand); color: white; box-shadow: 0 5px 14px rgba(124, 58, 237, .16); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-success { background: var(--success); color: white; }
.btn-warning { background: var(--warning-soft); color: var(--warning); border-color: #f3dbab; }
.btn-danger { background: var(--danger-soft); color: var(--danger); border-color: #f6cbd2; }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-sm { min-height: 32px; padding: 6px 10px; font-size: .78rem; }
.btn-xs { min-height: 26px; padding: 3px 7px; font-size: .7rem; }
.btn-icon { width: 40px; min-height: 40px; padding: 0; }
#topAddMailButton { min-height: 46px; padding-inline: 19px; }

.alert-strip { min-height: 76px; padding: 17px 20px; border-radius: 15px; border: 1px solid; display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 24px; }
.alert-strip.warning { background: var(--warning-soft); border-color: #f1dab0; color: #82500a; }
.alert-strip.success { background: var(--success-soft); border-color: #bce5d2; color: #116542; }
.alert-strip.danger { background: var(--danger-soft); border-color: #f4cad1; color: #a2293b; }
.alert-strip strong { display: block; margin-bottom: 2px; }
.alert-strip small { opacity: .82; }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 22px; }
.metric-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: 0 2px 9px rgba(23,32,51,.025); }
.metric-card .label { color: var(--muted); font-size: .78rem; display: flex; justify-content: space-between; gap: 8px; }
.metric-card .value { font-size: 1.88rem; font-weight: 760; letter-spacing: -.04em; margin: 12px 0 5px; }
.metric-card .meta { color: var(--muted); font-size: .73rem; }
.metric-card .meta.good { color: var(--success); }
.metric-card .meta.warn { color: var(--warning); }

.dashboard-hero { align-items: flex-end; margin: 4px 0 30px; }
.dashboard-hero h2 { margin-bottom: 9px; font-size: clamp(1.8rem, 2.6vw, 2.35rem); line-height: 1.14; letter-spacing: -.045em; }
.dashboard-hero p { font-size: .91rem; }
.dashboard-sync { display: inline-flex; align-items: center; gap: 9px; padding-bottom: 4px; color: var(--muted); font-size: .78rem; white-space: nowrap; }
.dashboard-primary-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; margin-bottom: 24px; }
.dashboard-primary-metrics .metric-card { min-height: 146px; padding: 22px 24px; }
.dashboard-primary-metrics .metric-card .label { font-size: .81rem; }
.dashboard-primary-metrics .metric-card .value { margin-top: 18px; font-size: 2.12rem; }
.dashboard-insight-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(320px, .9fr); gap: 20px; align-items: stretch; }
.dashboard-insight-grid > .panel { min-height: 360px; }
.dashboard-insight-grid .panel-header { min-height: 70px; }
.dashboard-insight-grid .panel-title { font-size: .98rem; }
.dashboard-stock-card { display: grid; grid-template-rows: auto 1fr auto; }
.dashboard-stock-card .panel-body { min-height: 205px; }
.trend-legend { display: flex; align-items: center; gap: 15px; color: var(--muted); font-size: .72rem; white-space: nowrap; }
.trend-legend span { display: inline-flex; align-items: center; gap: 6px; }
.trend-legend span::before { width: 9px; height: 9px; border-radius: 3px; background: var(--brand); content: ''; }
.trend-legend .success::before { background: var(--success); }
.trend-chart-shell { min-height: 230px; display: grid; place-items: center; }
.trend-chart-shell svg { display: block; width: 100%; height: auto; max-height: 270px; overflow: visible; }
.trend-grid-line { stroke: #e7e9f0; stroke-width: 1; }
.trend-axis-label { fill: var(--muted); font-size: 10px; text-anchor: middle; }
.trend-axis-y { text-anchor: end; }
.trend-line { fill: none; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.trend-line.total { stroke: var(--brand); }
.trend-line.success { stroke: var(--success); }
.trend-point { stroke: var(--surface); stroke-width: 2; vector-effect: non-scaling-stroke; }
.trend-point.total { fill: var(--brand); }
.trend-point.success { fill: var(--success); }
.dashboard-insight-grid .device-card { border: 0; border-radius: 0; padding: 13px 2px; border-bottom: 1px solid var(--border); }
.dashboard-insight-grid .device-card:last-child { border-bottom: 0; }
.stock-summary { display: grid; grid-template-columns: minmax(110px, auto) 1fr auto; align-items: center; gap: 18px; min-height: 76px; padding: 15px 20px; border-top: 1px solid var(--border); background: #fbfbfd; border-radius: 0 0 var(--radius) var(--radius); }
.stock-summary div { display: flex; align-items: baseline; gap: 10px; }
.stock-summary span, .stock-summary small { color: var(--muted); font-size: .75rem; }
.stock-summary strong { color: var(--text); font-size: 1.2rem; }
.attention-summary { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 15px 0; border-bottom: 1px solid var(--border); }
.attention-summary:last-child { border-bottom: 0; }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(280px, .75fr); gap: 18px; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 2px 9px rgba(23,32,51,.02); min-width: 0; margin-bottom: 18px; }
.panel-header { min-height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 15px 20px; border-bottom: 1px solid var(--border); }
.panel-title { font-size: .94rem; font-weight: 720; }
.panel-subtitle { color: var(--muted); font-size: .74rem; margin-top: 3px; }
.panel-body { padding: 20px; }
.panel-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.toolbar { padding: 13px 16px; border-bottom: 1px solid var(--border); display: flex; align-items: end; gap: 10px; flex-wrap: wrap; background: var(--surface-subtle); }
.toolbar .field { min-width: 145px; flex: 0 1 190px; }
.toolbar .field.search { flex: 1 1 250px; }
.toolbar label { display: block; font-size: .7rem; color: var(--muted); margin-bottom: 4px; }
.filter-toolbar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(160px, 100%), 1fr));
    align-items: end;
    gap: 11px 10px;
    padding: 16px;
}
.filter-toolbar .field,
.filter-toolbar .field.search { min-width: 0; width: auto; }
.filter-toolbar .field.search { grid-column: span 2; }
.account-filter-form { display: grid; gap: 10px; margin-bottom: 12px; }
.account-filter-panel { overflow: hidden; margin: 0; }
.account-filter-panel .field { min-width: 0; }
.account-filter-panel label { display: block; margin-bottom: 4px; color: var(--muted); font-size: .7rem; }
.account-filter-primary {
    display: grid;
    grid-template-columns: minmax(280px, 320px) repeat(3, minmax(145px, 200px)) auto;
    align-items: end;
    gap: 10px;
    padding: 14px 16px;
    background: var(--surface-subtle);
}
.account-filter-section-title { padding: 12px 16px 0; color: var(--muted); font-size: .72rem; font-weight: 700; }
.account-shop-filters {
    display: grid;
    grid-template-columns: repeat(2, minmax(220px, 1fr));
    gap: 10px;
    padding: 10px 16px 14px;
}
.account-filter-primary .account-search { width: 100%; max-width: 320px; }
.account-filter-actions { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.account-quick-filters {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 54px;
    padding: 10px 16px;
    border-top: 0;
    overflow-x: auto;
    scrollbar-width: thin;
}
.quick-filter-label { color: var(--muted); font-size: .72rem; font-weight: 650; white-space: nowrap; margin-right: 2px; }
.quick-filter-chip,
.active-filter-chip {
    min-height: 32px;
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-size: .75rem;
    font-weight: 650;
    white-space: nowrap;
    cursor: pointer;
}
.quick-filter-chip:hover,
.active-filter-chip:hover { border-color: var(--brand); color: var(--brand); }
.quick-filter-chip.active {
    border-color: var(--brand);
    background: var(--brand);
    color: #fff;
    box-shadow: 0 6px 15px rgba(125, 61, 230, .18);
}
.account-advanced-summary {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 51px;
    padding: 9px 16px;
    border-top: 0;
}
.active-filter-chips { display: flex; align-items: center; gap: 7px; flex: 1 1 auto; min-width: 0; overflow-x: auto; }
.active-filter-chip { min-height: 30px; border-color: #ddd1f6; background: #f5f0ff; color: var(--brand); }
.account-advanced-summary .toolbar-meta { margin-left: auto; white-space: nowrap; }
.account-advanced-filters {
    display: grid;
    grid-template-columns: repeat(5, minmax(150px, 210px));
    justify-content: start;
    gap: 10px;
    padding: 14px 16px;
    border-top: 1px solid var(--border);
    background: var(--surface-subtle);
}
.account-advanced-filters[hidden] { display: none; }
.account-primary-actions { justify-content: flex-start; margin: 0 0 10px; }
.registration-stats-filter { margin-bottom: 12px; }
.registration-kpi-grid { display: grid; grid-template-columns: repeat(5, minmax(150px, 1fr)); gap: 10px; margin-bottom: 12px; }
.registration-kpi-card { padding: 15px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.registration-kpi-card span { display: block; color: var(--muted); font-size: .72rem; }
.registration-kpi-card strong { display: block; margin-top: 7px; font-size: 1.45rem; }
.registration-kpi-card small { display: block; margin-top: 4px; color: var(--muted); }
.registration-suffix-filter { min-width: 220px; }
.registration-ranking-header { align-items: flex-end; }
.registration-ranking-tabs {
    display: inline-flex;
    gap: 3px;
    margin-top: 12px;
    padding: 3px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface-subtle);
}
.registration-ranking-tabs button {
    min-height: 32px;
    padding: 6px 13px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    font: inherit;
    font-size: .77rem;
    font-weight: 700;
}
.registration-ranking-tabs button.active {
    background: var(--brand);
    color: #fff;
    box-shadow: 0 4px 10px rgba(109, 66, 216, .2);
}
.registration-ranking-row-selected { background: var(--brand-soft); }
.registration-stats-table .registration-suffix-filter-button { text-align: left; }
.registration-sort { display: grid; gap: 4px; min-width: 150px; color: var(--muted); font-size: .72rem; }
.registration-stats-table button { border: 0; padding: 0; background: transparent; color: var(--brand); font: inherit; font-weight: 700; cursor: pointer; }
.account-primary-actions .btn { min-height: 36px; padding: 7px 11px; font-size: .78rem; }
.account-selection-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 42px;
    padding: 7px 10px;
    margin: -8px 0 10px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
}
.selection-actions { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.account-header-select { display: inline-flex; align-items: center; gap: 8px; }
#tab-account-ops .page-heading { margin-bottom: 12px; }
#tab-account-ops > .section-tabs { margin-bottom: 10px; }
.duplicate-email-group { padding: 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.duplicate-email-group + .duplicate-email-group { margin-top: 12px; }
.duplicate-email-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 9px; }
.duplicate-email-records { display: grid; gap: 7px; }
.duplicate-email-record { display: grid; grid-template-columns: minmax(190px, 1.3fr) minmax(150px, 1fr) minmax(140px, .8fr) minmax(150px, 1fr); gap: 9px; padding: 9px 10px; border-radius: 9px; background: var(--surface-subtle); font-size: .76rem; }
.duplicate-email-record > * { min-width: 0; overflow-wrap: anywhere; }
.toolbar-actions { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; min-width: 0; }
.toolbar-actions .btn { flex: 0 0 auto; }
.toolbar-meta { margin-left: auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .75rem; }

.table-wrap { max-width: 100%; min-width: 0; overflow: auto; overscroll-behavior-inline: contain; -webkit-overflow-scrolling: touch; }
.data-table-shell { scrollbar-gutter: stable; outline: none; }
.data-table-shell:focus-visible { box-shadow: inset 0 0 0 3px rgba(109, 66, 216, .18); }
.data-table { width: 100%; border-collapse: collapse; font-size: .8rem; }
.result-table, .mail-table, .execution-table { table-layout: fixed; }
.result-table, .execution-table { min-width: 1240px; }
.mail-table { min-width: 1450px; }
.execution-columns .col-time { width: 13%; }
.execution-columns .col-duration { width: 8%; }
.execution-columns .col-mode { width: 9%; }
.execution-columns .col-result { width: 11%; }
.execution-columns .col-reason { width: 23%; }
.execution-columns .col-device { width: 12%; }
.execution-columns .col-client { width: 11%; }
.execution-columns .col-account { width: 13%; }
.account-columns .col-email { width: 15%; }
.account-columns .col-username { width: 8%; }
.account-columns .col-password { width: 6%; }
.account-columns .col-registration { width: 8%; }
.account-columns .col-status { width: 11%; }
.account-columns .col-shop { width: 15%; }
.account-columns .col-device { width: 10%; }
.account-columns .col-registered-time { width: 9%; }
.account-columns .col-actions { width: 18%; }
.result-columns .col-completion { width: 14%; }
.result-columns .col-account { width: 25%; }
.result-columns .col-mode { width: 9%; }
.result-columns .col-result { width: 23%; }
.result-columns .col-device { width: 16%; }
.result-columns .col-note { width: 13%; }
.mail-columns .col-email { width: 13%; }
.mail-columns .col-username { width: 7%; }
.mail-columns .col-password { width: 5%; }
.mail-columns .col-registration { width: 8%; }
.mail-columns .col-listing { width: 8%; }
.mail-columns .col-health { width: 7%; }
.mail-columns .col-device { width: 10%; }
.mail-columns .col-time { width: 9%; }
.mail-columns .col-code { width: 12%; }
.mail-columns .col-actions { width: 13%; }
.mail-columns .col-note { width: 8%; }
.data-table th { position: sticky; top: 0; z-index: 1; background: #f8f9fc; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; font-size: .66rem; text-align: left; padding: 10px 13px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.data-table td { min-width: 0; padding: 11px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.data-table tbody tr:hover { background: #fafbfe; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .76rem; }
.muted { color: var(--muted); }
.text-danger { color: var(--danger); }
.nowrap { white-space: nowrap; }
.truncate { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-identity { display: grid; justify-items: start; gap: 5px; min-width: 0; }
.account-identity-inline { grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 9px; width: 100%; }
.account-details { display: grid; justify-items: start; gap: 4px; min-width: 0; }
.account-primary { font-weight: 720; }
.copyable-value { max-width: 260px; padding: 0; border: 0; background: transparent; color: inherit; font: inherit; text-align: left; cursor: copy; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-table .copyable-value, .result-table .copyable-value { max-width: 100%; }
.copyable-value:hover, .copyable-value:focus-visible { color: var(--brand); text-decoration: underline; }
.result-summary { display: flex; align-items: center; gap: 7px; min-width: 0; width: 100%; }
.result-summary .truncate { min-width: 0; flex: 1 1 auto; }
.completion-cell, .device-identity, .task-info-cell { display: grid; align-content: center; gap: 4px; min-width: 0; }
.completion-duration, .device-id, .task-retry { color: var(--muted); font-size: .7rem; }
.device-remark, .device-id, .task-mode { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.manual-state-button, .table-time { white-space: nowrap; }
.data-table .btn { white-space: nowrap; }
.row-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-width: 250px; }
.verification-code-control { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.mail-table .form-control { min-width: 0; }
.link-button { border: 0; padding: 0; background: transparent; color: var(--brand); font: inherit; text-align: left; cursor: pointer; }
.link-button:hover, .link-button:focus-visible { text-decoration: underline; }
.account-select-cell { display: flex; align-items: center; gap: 9px; min-width: 0; }
.account-select-cell .link-button { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.section-tabs { display: flex; align-items: center; gap: 6px; padding: 5px; margin-bottom: 16px; width: fit-content; max-width: 100%; overflow-x: auto; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.section-tab { border: 0; border-radius: 9px; padding: 9px 16px; background: transparent; color: var(--muted); font-weight: 700; white-space: nowrap; cursor: pointer; }
.section-tab.active { color: var(--brand); background: var(--brand-soft); }
.section-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; margin: 0 0 12px; }
.bulk-action-bar { position: sticky; top: 76px; z-index: 6; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 14px; margin-bottom: 10px; border: 1px solid rgba(109,66,216,.28); border-radius: 12px; background: #faf7ff; box-shadow: var(--shadow-sm); }

.drawer-backdrop { position: fixed; inset: 0; z-index: 80; background: rgba(23, 32, 51, .28); }
.details-drawer { position: fixed; z-index: 81; top: 0; right: 0; width: min(520px, 100vw); height: 100vh; overflow: auto; background: var(--surface); box-shadow: -18px 0 45px rgba(23,32,51,.18); }
.drawer-header { position: sticky; top: 0; z-index: 1; display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding: 20px 22px; border-bottom: 1px solid var(--border); background: var(--surface); }
.drawer-header h3, .drawer-header p { margin: 0; }
.drawer-body { display: grid; gap: 24px; padding: 22px; }
.drawer-body h4 { margin: 0 0 10px; }
.details-list { display: grid; gap: 10px; margin: 0; }
.details-list > div { display: grid; grid-template-columns: 120px 1fr; gap: 12px; }
.details-list dt { color: var(--muted); }
.details-list dd { margin: 0; overflow-wrap: anywhere; }
.timeline-list { display: grid; gap: 8px; }
.timeline-list article { display: grid; gap: 3px; padding: 11px 12px; border: 1px solid var(--border); border-radius: 10px; }
.timeline-list time { color: var(--muted); font-size: .72rem; }
.details-section + .details-section { padding-top: 20px; border-top: 1px solid var(--border); }
.account-status-stack, .runtime-device-identity { display: grid; justify-items: start; gap: 6px; min-width: 0; }
.shop-inventory-cell { display: grid; justify-items: start; gap: 5px; min-width: 0; }
.shop-inventory-cell strong, .shop-inventory-cell small { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.shop-inventory-cell strong { font-size: .75rem; white-space: nowrap; }
.shop-inventory-cell small { color: var(--muted); line-height: 1.35; }
.shop-inventory-reconciliation { margin: 12px 0; }
.shop-reconciliation-grid { display: grid; grid-template-columns: repeat(6, minmax(100px, 1fr)); gap: 8px; padding: 0 16px 16px; }
.shop-reconciliation-item { display: grid; gap: 3px; padding: 10px 12px; border-radius: 10px; background: var(--surface-subtle); }
.shop-reconciliation-item span { color: var(--muted); font-size: .72rem; }
.shop-reconciliation-item strong { font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.account-registration-time { display: grid; gap: 2px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.account-registration-time small { color: var(--muted); font-size: .7rem; }
.status-secondary { display: flex; align-items: center; gap: 4px; min-width: 0; }
.status-secondary .badge { padding-block: 2px; }
.credential-list { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; }
.credential-list .copyable-value { padding: 6px 9px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-subtle); }
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 4px 8px; border-radius: 99px; font-size: .69rem; font-weight: 700; white-space: nowrap; }
.badge.success { background: var(--success-soft); color: var(--success); }
.badge.warning { background: var(--warning-soft); color: var(--warning); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.info { background: var(--info-soft); color: var(--info); }
.badge.neutral { background: #eef1f6; color: #596479; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

.pagination { min-height: 54px; padding: 10px 14px; border-top: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--muted); font-size: .78rem; }
.pagination-actions { display: flex; align-items: center; gap: 7px; }
.empty-state { min-height: 170px; display: grid; place-items: center; text-align: center; color: var(--muted); padding: 28px; }
.empty-state strong { display: block; color: var(--text); margin-bottom: 6px; }
.loading-row { color: var(--muted); text-align: center; padding: 32px !important; }
.error-state { padding: 18px; margin: 16px; border-radius: 10px; background: var(--danger-soft); color: var(--danger); }

.device-list, .compact-list { display: grid; gap: 9px; }
.device-card { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; padding: 13px; border: 1px solid var(--border); border-radius: 11px; }
.device-card.depth-1 { margin-left: 18px; }
.device-card.depth-2 { margin-left: 36px; }
.device-card.depth-3 { margin-left: 54px; }
.device-icon { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); }
.device-card strong { display: block; font-size: .84rem; }
.device-card small { color: var(--muted); }
.timeline { display: grid; gap: 0; }
.timeline-item { display: grid; grid-template-columns: 16px 1fr; gap: 10px; min-height: 48px; }
.timeline-line { position: relative; display: flex; justify-content: center; }
.timeline-line::after { content: ""; position: absolute; top: 14px; bottom: -4px; width: 1px; background: var(--border); }
.timeline-item:last-child .timeline-line::after { display: none; }
.timeline-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--brand); margin-top: 7px; z-index: 1; }
.timeline-item p { margin: 0 0 3px; font-size: .8rem; }
.timeline-item time { color: var(--muted); font-size: .68rem; }

.split-layout { display: grid; grid-template-columns: 295px minmax(0, 1fr); gap: 16px; align-items: start; }
.tree-panel { position: sticky; top: 86px; max-height: calc(100vh - 110px); overflow: auto; }
.tree-list { display: grid; padding: 8px; gap: 3px; }
.tree-button { width: 100%; border: 0; background: transparent; padding: 10px; border-radius: 8px; color: var(--text); text-align: left; display: flex; justify-content: space-between; gap: 8px; }
.tree-button:hover, .tree-button.active { background: var(--brand-soft); color: var(--brand); }
.tree-child { padding-left: 18px; }
.config-stage { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 14px; }
.stage { padding: 10px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); color: var(--muted); font-size: .76rem; }
.stage.active { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }
.stage strong { display: block; color: inherit; margin-bottom: 2px; }
.adoption-bar { height: 8px; border-radius: 99px; background: #e9edf4; overflow: hidden; }
.adoption-bar.spaced { margin-top: 7px; }
.adoption-bar span { display: block; height: 100%; background: var(--success); }
.adoption-bar .progress-0 { width: 0%; }
.adoption-bar .progress-10 { width: 10%; }
.adoption-bar .progress-20 { width: 20%; }
.adoption-bar .progress-30 { width: 30%; }
.adoption-bar .progress-40 { width: 40%; }
.adoption-bar .progress-50 { width: 50%; }
.adoption-bar .progress-60 { width: 60%; }
.adoption-bar .progress-70 { width: 70%; }
.adoption-bar .progress-80 { width: 80%; }
.adoption-bar .progress-90 { width: 90%; }
.adoption-bar .progress-100 { width: 100%; }
.alert-flush { margin: 0; }
.notice { border: 1px dashed var(--border); border-radius: 10px; padding: 13px; color: var(--muted); font-size: .78rem; background: var(--surface-subtle); }

.settings-layout { display: grid; grid-template-columns: 190px minmax(0, 1fr); gap: 16px; align-items: start; }
.settings-nav { position: sticky; top: 86px; display: grid; gap: 4px; padding: 8px; }
.settings-nav button { padding: 10px; border: 0; border-radius: 8px; background: transparent; text-align: left; color: var(--muted); font-size: .82rem; }
.settings-nav button.active { background: var(--brand-soft); color: var(--brand); font-weight: 700; }
.settings-section { display: none; }
.settings-section.active { display: block; }
.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.setting-card { padding: 15px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.setting-card h3 { margin: 0 0 6px; font-size: .9rem; }
.setting-card p { margin: 0 0 13px; color: var(--muted); font-size: .75rem; }
.secret-field { display: flex; gap: 7px; }
.secret-field input { flex: 1; min-width: 0; }
.danger-zone { border-color: #efc4cb; }
.danger-zone .panel-header { background: #fff8f9; }

.toast-region { position: fixed; top: 18px; right: 18px; z-index: 3000; display: grid; gap: 9px; width: min(360px, calc(100vw - 36px)); pointer-events: none; }
.toast { pointer-events: auto; display: grid; grid-template-columns: auto 1fr auto; align-items: start; gap: 10px; padding: 13px; background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--info); border-radius: 10px; box-shadow: var(--shadow); animation: toast-in .18s ease-out; }
.toast.success { border-left-color: var(--success); }
.toast.warning { border-left-color: var(--warning); }
.toast.error { border-left-color: var(--danger); }
.toast p { margin: 0; font-size: .8rem; line-height: 1.4; }
.toast button { border: 0; background: transparent; color: var(--muted); padding: 0; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } }

.modal-overlay { position: fixed; inset: 0; z-index: 2000; background: rgba(17, 22, 35, .55); display: none; align-items: center; justify-content: center; padding: 20px; }
.modal-overlay.open { display: flex; }
.modal-box { width: min(720px, 100%); max-height: 90vh; overflow: auto; background: var(--surface); border-radius: 16px; box-shadow: 0 30px 80px rgba(0,0,0,.2); }
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 17px; border-bottom: 1px solid var(--border); }
.modal-header h3 { margin: 0; font-size: 1rem; }
.modal-body { padding: 17px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 13px 17px; border-top: 1px solid var(--border); }

@media (max-width: 1320px) {
    .account-filter-primary { grid-template-columns: minmax(280px, 320px) repeat(3, minmax(135px, 1fr)); }
    .account-filter-actions { grid-column: 1 / -1; }
    .registration-kpi-grid { grid-template-columns: repeat(3, minmax(150px, 1fr)); }
}
@media (max-width: 1100px) {
    .app-container { padding: 0; }
    .app-shell { min-height: 100vh; grid-template-columns: 238px minmax(0, 1fr); }
    .sidebar { top: 0; height: 100vh; padding-inline: 14px; }
    .topbar { top: 0; padding-inline: 24px; }
    .main-content { padding-inline: 25px; }
    .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .dashboard-primary-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .dashboard-insight-grid { grid-template-columns: 1fr; }
    .dashboard-grid { grid-template-columns: 1fr; }
    .split-layout { grid-template-columns: 240px 1fr; }
    .account-filter-primary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .account-filter-primary .account-search { grid-column: 1 / -1; max-width: none; }
    .account-filter-actions { grid-column: 1 / -1; }
    .account-shop-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .account-advanced-filters { grid-template-columns: repeat(auto-fit, minmax(min(160px, 100%), 1fr)); }
}
@media (max-width: 900px) {
    .login-container { overflow: auto; padding: 24px; }
    .login-shell { width: min(620px, 100%); min-height: 0; grid-template-columns: 1fr; }
    .login-hero { min-height: 310px; padding: 30px 34px 26px; gap: 22px; }
    .login-hero-copy { max-width: 430px; margin-top: 2px; }
    .login-hero h2 { font-size: 2rem; margin-bottom: 12px; }
    .login-hero p { font-size: .88rem; line-height: 1.6; }
    .login-orbit { position: absolute; right: -120px; bottom: 22px; width: 390px; height: 190px; opacity: .64; }
    .login-trust { margin-top: 6px; }
    .login-box { padding: 48px 54px 52px; }
    .login-intro { margin-bottom: 30px; }
}
@media (max-width: 920px) {
    .connection-chip span:last-child { display: none; }
}
@media (max-width: 780px) {
    .login-container { display: block; padding: 14px; }
    .login-shell { min-height: calc(100svh - 28px); border-radius: 20px; }
    .login-hero { min-height: 280px; padding: 25px 24px 22px; gap: 18px; }
    .login-hero-brand { font-size: 1.02rem; }
    .login-hero .brand-mark { width: 42px; height: 42px; }
    .login-hero h2 { max-width: 330px; font-size: 1.72rem; margin-bottom: 10px; }
    .login-hero p { max-width: 320px; font-size: .82rem; line-height: 1.55; }
    .login-kicker { margin-bottom: 10px; font-size: .68rem; }
    .login-orbit { right: -195px; bottom: 14px; opacity: .48; }
    .login-trust { gap: 6px; }
    .login-trust span { padding: 6px 9px; font-size: .66rem; }
    .login-box { padding: 34px 24px 38px; }
    .login-box h1 { font-size: 2rem; }
    .login-intro { margin: 10px 0 28px; }
    .login-box .form-group input, .login-submit { min-height: 52px; }
    .permission-grid { grid-template-columns: 1fr; }
    .app-container { padding: 0; }
    .app-shell { width: 100%; min-height: 100vh; border: 0; border-radius: 0; box-shadow: none; }
    .app-shell { grid-template-columns: 1fr; }
    .sidebar { position: fixed; inset: auto 0 0 0; width: 100%; height: auto; padding: 7px; border: 0; border-top: 1px solid var(--border); border-radius: 0; box-shadow: 0 -8px 24px rgba(35,40,55,.06); }
    .sidebar-brand, .nav-label, .sidebar-footer { display: none; }
    .tabs { display: grid; grid-template-columns: repeat(5, minmax(56px, 1fr)); gap: 2px; overflow-x: auto; }
    .tab { justify-content: center; padding: 9px 6px; font-size: .67rem; white-space: nowrap; }
    .tab > span:first-child { width: auto; }
    .nav-count { position: absolute; top: 3px; right: 4px; min-width: 18px; height: 18px; padding-inline: 5px; font-size: .6rem; }
    .workspace { padding-bottom: 64px; }
    .workspace, .topbar { border-radius: 0; }
    .topbar { top: 0; height: 68px; padding: 0 15px; }
    .topbar p { display: none; }
    .topbar-breadcrumb { gap: 7px; font-size: .77rem; }
    .connection-chip span:last-child { display: none; }
    #topAddMailButton { min-height: 38px; padding: 8px 10px; }
    .main-content { padding: 18px 13px 32px; }
    .page-heading { display: block; }
    .page-actions { margin-top: 12px; }
    .dashboard-hero { display: flex; align-items: flex-end; }
    .dashboard-hero h2 { font-size: 1.7rem; }
    .metric-grid.dashboard-primary-metrics { grid-template-columns: 1fr; }
    .dashboard-primary-metrics .metric-card { min-height: 120px; }
    .dashboard-insight-grid { grid-template-columns: 1fr; }
    .dashboard-insight-grid > .panel { min-height: auto; }
    .trend-legend { gap: 9px; font-size: .66rem; }
    .stock-summary { grid-template-columns: 1fr auto; }
    .stock-summary > small { grid-column: 1 / -1; grid-row: 2; }
    .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
    .metric-card { padding: 13px; }
    .metric-card .value { font-size: 1.4rem; }
    .split-layout, .settings-layout { grid-template-columns: 1fr; }
    .tree-panel, .settings-nav { position: static; max-height: none; }
    .settings-nav { grid-template-columns: repeat(3, 1fr); }
    .settings-grid { grid-template-columns: 1fr; }
    .config-stage { grid-template-columns: repeat(2, 1fr); }
    .filter-toolbar { padding: 13px; }
    .filter-toolbar .field.search { grid-column: 1 / -1; }
    .toolbar-actions { flex-wrap: wrap; }
    .toolbar-meta { flex-basis: 100%; order: 2; margin: 2px 0 0; }
    .account-filter-primary { grid-template-columns: 1fr; padding: 13px; }
    .account-filter-primary .account-search { max-width: none; }
    .account-filter-actions { grid-column: auto; flex-wrap: wrap; }
    .account-filter-actions .btn { flex: 1 1 auto; }
    .account-shop-filters { grid-template-columns: 1fr; padding: 10px 13px 13px; }
    .registration-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .account-quick-filters { padding-inline: 13px; }
    .account-advanced-summary { align-items: flex-start; flex-wrap: wrap; padding-inline: 13px; }
    .account-advanced-summary .toolbar-meta { flex-basis: auto; order: 0; margin-left: auto; }
    .active-filter-chips { flex-basis: 100%; order: 2; }
    .account-advanced-filters { grid-template-columns: 1fr; padding: 13px; }
    .account-selection-toolbar { align-items: flex-start; flex-direction: column; margin-top: -4px; }
    .account-primary-actions { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 3px; }
    .account-primary-actions .btn { flex: 0 0 auto; }
    .duplicate-email-record { grid-template-columns: 1fr; }
    .data-table colgroup { display: none; }
    .data-table thead { display: none; }
    .data-table { min-width: 0; table-layout: auto; }
    .data-table, .data-table tbody, .data-table tr, .data-table td { display: block; width: 100%; }
    .data-table tr { padding: 10px 13px; border-bottom: 1px solid var(--border); }
    .data-table td { display: grid; grid-template-columns: 105px 1fr; border: 0; padding: 5px 0; }
    .data-table td::before { content: attr(data-label); color: var(--muted); font-size: .7rem; }
    .data-table td:not([data-label]) { grid-template-columns: 1fr; }
    .data-table td:not([data-label])::before { content: none; }
    .pagination { align-items: flex-start; flex-direction: column; }
}

/* Restored operational workspaces */
.modal-extra-wide { width: min(1500px, calc(100vw - 48px)); }
.modal-wide { width: min(980px, calc(100vw - 48px)); }
.operations-grid,
.editor-card-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.operation-card,
.editor-card,
.listing-product-card { border: 1px solid var(--border); border-radius: 16px; background: var(--surface); padding: 16px; }
.operation-card h4,
.editor-card strong { margin: 0; }
.operation-card p { min-height: 42px; color: var(--muted); }
.operation-actions,
.listing-sidebar-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.compact-header { margin-bottom: 12px; }
.field-gap { margin-top: 12px; }
.setting-card-wide { grid-column: span 2; }
.section-title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.section-title-row h3,
.section-title-row h4,
.listing-editor-section h3 { margin: 0; }
.section-title-row p { margin: 4px 0 0; }

.listing-editor-panel .panel-body { padding: 0; }
.listing-editor-layout { display: grid; grid-template-columns: minmax(240px, 300px) minmax(0, 1fr); min-height: 640px; border-top: 1px solid var(--border); }
.listing-group-sidebar { border-right: 1px solid var(--border); padding: 16px; background: var(--surface-subtle); }
.listing-sidebar-actions { margin-bottom: 12px; }
.listing-tree { display: grid; gap: 6px; }
.listing-tree-item { width: 100%; display: grid; grid-template-columns: 20px minmax(0, 1fr) auto; align-items: center; gap: 8px; border: 1px solid transparent; border-radius: 12px; padding: 10px; background: transparent; color: var(--text); text-align: left; cursor: pointer; }
.listing-tree-item[data-depth="1"] { padding-left: 24px; }
.listing-tree-item[data-depth="2"] { padding-left: 38px; }
.listing-tree-item:hover,
.listing-tree-item.active { border-color: var(--brand); background: var(--brand-soft); }
.listing-tree-item span:nth-child(2) { display: grid; min-width: 0; }
.listing-tree-item small { color: var(--muted); }
.listing-editor-workspace { min-width: 0; padding: 20px; overflow: auto; }
.listing-empty-workspace { display: grid; place-items: center; min-height: 400px; color: var(--muted); text-align: center; }
.listing-editor-section { padding: 18px 0; border-bottom: 1px solid var(--border); }
.listing-editor-section:last-child { border-bottom: 0; }
.editor-card-grid { margin-top: 14px; }
.editor-card { display: flex; flex-direction: column; min-width: 0; }
.listing-product-list { display: grid; gap: 14px; margin-top: 14px; }
.listing-product-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.product-field { min-width: 0; }
.product-field .field-label { display: block; margin-bottom: 6px; }
.product-field-wide { grid-column: span 3; }
.chip-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.chip { display: inline-flex; border: 1px solid var(--border); border-radius: 999px; padding: 5px 10px; background: var(--surface-subtle); }
.selection-list { display: grid; gap: 8px; max-height: 480px; overflow: auto; }
.selection-row { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 10px; border: 1px solid var(--border); border-radius: 10px; padding: 10px; }
.selection-row span { display: grid; }
.import-preview { margin-top: 12px; }
.compact-metrics { margin-bottom: 16px; }
.listing-default-config-card { display: grid; gap: 14px; }
.listing-config-stats { display: flex; flex-wrap: wrap; gap: 8px; }
.listing-config-stats span { border-radius: 999px; padding: 5px 9px; background: var(--surface-subtle); color: var(--muted); font-size: .75rem; }
.listing-fail-records { border-top: 1px solid var(--border); padding-top: 12px; }
.listing-fail-records summary { color: var(--muted); cursor: pointer; font-size: .8rem; }
.listing-fail-record-list { display: grid; gap: 7px; margin-top: 10px; }
.listing-fail-record { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 12px; align-items: center; border-radius: 10px; padding: 8px 10px; background: var(--surface-subtle); font-size: .75rem; }
.listing-fail-record span,
.listing-fail-record time { color: var(--muted); }

@media (max-width: 1100px) {
    .listing-editor-layout { grid-template-columns: 220px minmax(0, 1fr); }
    .listing-product-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .product-field-wide { grid-column: span 2; }
}

@media (max-width: 780px) {
    .modal-extra-wide,
    .modal-wide { width: 100%; }
    .operations-grid,
    .editor-card-grid { grid-template-columns: 1fr; }
    .setting-card-wide { grid-column: span 1; }
    .listing-editor-layout { grid-template-columns: 1fr; }
    .listing-group-sidebar { border-right: 0; border-bottom: 1px solid var(--border); max-height: 300px; overflow: auto; }
    .listing-product-fields { grid-template-columns: 1fr; }
    .product-field-wide { grid-column: span 1; }
    .listing-fail-record { grid-template-columns: 1fr; gap: 3px; }
    .shop-reconciliation-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .registration-ranking-header { align-items: stretch; }
    .registration-ranking-tabs { width: 100%; }
    .registration-ranking-tabs button { flex: 1 1 0; }
    .registration-sort { width: 100%; }
}
@media (max-width: 470px) {
    .topbar-breadcrumb > span, .topbar-breadcrumb > i, .connection-chip { display: none; }
    .topbar { padding-inline: 10px; }
    .topbar-context { flex: 1 1 auto; }
    .top-actions { flex: 0 0 auto; gap: 6px; }
    .top-actions .btn-icon { width: 36px; min-height: 36px; }
    .metric-grid { grid-template-columns: 1fr 1fr; }
    .dashboard-primary-metrics { grid-template-columns: 1fr; }
    #topAddMailButton { width: 38px; min-width: 38px; padding: 0; font-size: 0; }
    #topAddMailButton::before { content: '+'; font-size: 1.25rem; line-height: 1; }
    .alert-strip { align-items: stretch; flex-direction: column; overflow: hidden; }
    .alert-strip > div { min-width: 0; }
    .alert-strip .btn { width: auto; max-width: 100%; align-self: stretch; }
    .dashboard-hero { display: block; }
    .dashboard-sync { margin-top: 12px; }
    .trend-legend { display: none; }
    .filter-toolbar { grid-template-columns: 1fr; }
    .filter-toolbar .field.search,
    .toolbar-actions { grid-column: auto; }
    .toolbar-actions .btn { flex: 1 1 0; min-width: 0; }
    #mailFilterForm .toolbar-actions .btn { flex-basis: calc(33.333% - 6px); }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
