:root {
    --bg: #f5f8fc;
    --surface: #ffffff;
    --surface-soft: #eef6ff;
    --line: #dbe7f3;
    --text: #172033;
    --muted: #6b7a90;
    --primary: #0f8bff;
    --primary-dark: #0767c4;
    --teal: #18b6a7;
    --danger: #d94b63;
    --shadow: 0 14px 38px rgba(29, 74, 124, 0.12);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
    letter-spacing: 0;
}

a {
    color: var(--primary);
    text-decoration: none;
}

button,
input,
select,
textarea {
    font: inherit;
}

.shell {
    display: grid;
    grid-template-columns: 248px minmax(0, 1fr);
    min-height: 100vh;
}

.sidebar {
    padding: 24px 18px;
    background: rgba(255, 255, 255, 0.88);
    border-right: 1px solid var(--line);
    position: sticky;
    top: 0;
    height: 100vh;
}

.brand,
.userbox,
.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.brand {
    justify-content: flex-start;
    margin-bottom: 28px;
}

.brand-mark {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    color: #fff;
    background: linear-gradient(135deg, var(--primary), var(--teal));
    font-weight: 800;
}

.brand-mark.large {
    width: 54px;
    height: 54px;
    font-size: 24px;
}

.brand strong {
    display: block;
    font-size: 18px;
}

.brand span,
.eyebrow,
.panel p,
label,
td,
th {
    color: var(--muted);
}

nav {
    display: grid;
    gap: 8px;
}

.nav-groups {
    gap: 18px;
}

.nav-group {
    display: grid;
    gap: 6px;
}

.nav-group h3 {
    margin: 0 0 2px;
    padding: 0 6px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

nav a {
    color: var(--text);
    padding: 10px 12px;
    border-radius: 8px;
    font-weight: 600;
}

nav a.active,
nav a:hover {
    background: var(--surface-soft);
    color: var(--primary-dark);
}

.main {
    padding: 28px;
    min-width: 0;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 18px;
    margin-bottom: 22px;
}

.topbar h1,
.login-copy h1 {
    margin: 2px 0 0;
    font-size: 28px;
}

.eyebrow {
    margin: 0;
    font-size: 13px;
    font-weight: 700;
}

.button {
    border: 0;
    border-radius: 8px;
    padding: 10px 14px;
    cursor: pointer;
    font-weight: 700;
}

.button.primary {
    background: var(--primary);
    color: #fff;
}

.button.primary:hover {
    background: var(--primary-dark);
}

.button.ghost {
    color: var(--primary-dark);
    background: var(--surface-soft);
}

.button.danger {
    color: #fff;
    background: var(--danger);
}

.button.danger:hover {
    background: #b83248;
}

.button.full {
    width: 100%;
}

.stats-grid,
.grid {
    display: grid;
    gap: 16px;
}

.stats-grid {
    grid-template-columns: repeat(5, minmax(120px, 1fr));
    margin-bottom: 16px;
}

.stats-grid.four {
    grid-template-columns: repeat(4, minmax(120px, 1fr));
}

.grid.two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-bottom: 16px;
}

.stat,
.panel,
.login-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.stat {
    padding: 18px;
}

.stat span {
    color: var(--muted);
    font-weight: 700;
}

.stat strong {
    display: block;
    margin-top: 10px;
    font-size: 30px;
}

.panel {
    padding: 18px;
    overflow: hidden;
}

.panel h2 {
    margin: 0 0 14px;
    font-size: 18px;
}

.panel-head h2 {
    margin-bottom: 0;
}

.panel-head {
    margin-bottom: 14px;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

th {
    text-align: left;
    font-size: 12px;
    font-weight: 700;
    background: #f8fbff;
}

th,
td {
    padding: 11px 10px;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
}

td {
    color: var(--text);
}

.pill,
.status {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 3px 9px;
    border-radius: 999px;
    background: #edf4ff;
    color: var(--primary-dark);
    font-size: 12px;
    font-weight: 700;
}

.status.ok {
    background: #e9fbf7;
    color: #087f70;
}

.status.bad {
    background: #fff1f3;
    color: #a33548;
}

.muted-note,
.empty-state,
.empty-cell {
    color: var(--muted);
    font-size: 13px;
    line-height: 1.6;
}

.empty-cell {
    text-align: center;
}

.positive {
    color: #087f70;
    font-weight: 800;
}

.negative {
    color: var(--danger);
    font-weight: 800;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.form-grid.compact {
    grid-template-columns: 1fr;
}

.form-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

label {
    display: grid;
    gap: 6px;
    font-size: 13px;
    font-weight: 700;
}

label.wide {
    grid-column: 1 / -1;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px 12px;
    color: var(--text);
    background: #fff;
    outline: none;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(15, 139, 255, 0.12);
}

fieldset.checks {
    grid-column: 1 / -1;
    border: 1px solid var(--line);
    border-radius: 8px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin: 0;
    padding: 12px;
}

fieldset.checks legend {
    color: var(--muted);
    font-weight: 800;
}

.checks label {
    display: flex;
    align-items: center;
    gap: 8px;
}

.checks input {
    width: auto;
}

.check-group-title {
    grid-column: 1 / -1;
    margin-top: 4px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
}

.inline-form {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.inline-check {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.inline-check input {
    width: auto;
}

.divider {
    height: 1px;
    background: var(--line);
    margin: 20px 0;
}

.alert {
    margin-bottom: 14px;
    padding: 12px 14px;
    border-radius: 8px;
    background: #fff1f3;
    color: #a33548;
    border: 1px solid #ffd6dd;
}

.toast-stack {
    position: fixed;
    top: 22px;
    right: 22px;
    z-index: 1200;
    display: grid;
    gap: 10px;
    width: min(420px, calc(100vw - 32px));
    pointer-events: none;
}

.toast {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 32px;
    gap: 12px;
    align-items: flex-start;
    padding: 14px 12px 14px 16px;
    border: 1px solid var(--line);
    border-left: 5px solid var(--primary);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 18px 48px rgba(17, 28, 48, 0.18);
    pointer-events: auto;
}

.toast.success {
    border-left-color: var(--teal);
}

.toast.error {
    border-left-color: var(--danger);
}

.toast strong {
    display: block;
    margin-bottom: 4px;
    color: var(--text);
    font-size: 14px;
}

.toast p {
    margin: 0;
    color: var(--muted);
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.toast-close {
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 8px;
    background: var(--surface-soft);
    color: var(--muted);
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
}

.toast-close:hover {
    color: var(--text);
    background: #e2efff;
}

.toast.is-hiding {
    opacity: 0;
    transform: translateY(-8px);
    transition: opacity 160ms ease, transform 160ms ease;
}

.generated {
    margin-top: 16px;
    padding: 14px;
    border-radius: 8px;
    background: var(--surface-soft);
}

.generated h3 {
    margin: 0 0 10px;
}

.generated textarea {
    min-height: 180px;
    font-family: Consolas, monospace;
}

.generated-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(17, 28, 48, 0.48);
}

.generated-dialog {
    width: min(760px, 100%);
    max-height: min(720px, calc(100vh - 48px));
    display: grid;
    gap: 14px;
    padding: 18px;
    overflow: auto;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: var(--surface);
    box-shadow: 0 26px 80px rgba(17, 28, 48, 0.28);
}

.generated-dialog-head,
.generated-dialog-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.generated-dialog-head h2 {
    margin: 2px 0 0;
}

.generated-dialog textarea {
    min-height: 260px;
    font-family: Consolas, monospace;
    font-size: 15px;
}

.generated-dialog-actions span {
    color: var(--muted);
    line-height: 1.5;
}

.suffix-only {
    display: block;
    font-family: Consolas, monospace;
    font-weight: 800;
}

td small {
    display: block;
    margin-top: 3px;
    color: var(--muted);
}

.advanced {
    grid-column: 1 / -1;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px;
    background: #fbfdff;
}

.advanced summary,
.integration-item summary {
    cursor: pointer;
    color: var(--primary-dark);
    font-weight: 800;
}

.integration-list {
    display: grid;
    gap: 12px;
}

.app-list {
    display: grid;
    gap: 10px;
}

.app-edit {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfdff;
}

.app-edit > summary {
    display: grid;
    grid-template-columns: 1.5fr 0.8fr 1fr 0.8fr auto;
    align-items: center;
    gap: 10px;
    padding: 12px;
    cursor: pointer;
    font-weight: 700;
}

.app-edit small {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    font-weight: 700;
}

.app-edit-form {
    padding: 0 12px 12px;
    border-top: 1px solid var(--line);
}

.integration-item {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 14px;
    background: #fbfdff;
}

.secret-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin: 14px 0;
}

.secret-grid div {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px;
    background: #fff;
}

.secret-grid span {
    display: block;
    margin-bottom: 6px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

code {
    word-break: break-all;
}

.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background: linear-gradient(135deg, #edf7ff, #f8fcff 44%, #eafaf7);
}

.login-panel {
    width: min(980px, 100%);
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 22px;
    align-items: center;
}

.login-copy {
    padding: 28px;
}

.login-copy p {
    color: var(--muted);
    font-size: 18px;
    line-height: 1.7;
    max-width: 540px;
}

.login-card {
    padding: 24px;
}

.login-card h2 {
    margin: 0 0 18px;
}

.login-card label {
    margin-bottom: 14px;
}

.login-link {
    margin: 14px 0 0;
    color: var(--muted);
    text-align: center;
    font-size: 13px;
    font-weight: 700;
}

.copy-block {
    display: grid;
    gap: 10px;
    color: var(--muted);
    line-height: 1.7;
}

.copy-block p {
    margin: 0;
}

.dashboard-hero {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 18px;
    margin-bottom: 18px;
    padding: 20px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(240, 248, 255, 0.92)),
        #fff;
    box-shadow: var(--shadow);
}

.dashboard-hero h2 {
    margin: 3px 0 8px;
    font-size: 24px;
}

.dashboard-hero p {
    margin: 0;
    max-width: 760px;
    color: var(--muted);
    line-height: 1.65;
}

.hero-status {
    min-width: 230px;
    display: grid;
    justify-items: end;
    gap: 5px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.hero-status strong {
    color: var(--text);
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 16px;
}

.metric-card {
    position: relative;
    overflow: hidden;
    padding: 16px;
    min-height: 142px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow);
    transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.metric-card::before {
    content: "";
    position: absolute;
    inset: 0;
    border-top: 4px solid var(--metric, var(--primary));
    opacity: 0.9;
    pointer-events: none;
}

.metric-card:hover {
    transform: translateY(-2px);
    border-color: rgba(15, 139, 255, 0.28);
    box-shadow: 0 18px 42px rgba(29, 74, 124, 0.16);
}

.metric-top,
.split-line,
.progress-head,
.rank-row,
.device-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.metric-top span {
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

.metric-value {
    display: block;
    margin-top: 15px;
    color: var(--text);
    font-size: 32px;
    line-height: 1.05;
}

.metric-card p {
    margin: 12px 0 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.5;
}

.tone-blue,
.metric-card.tone-blue {
    --metric: #0f8bff;
}

.tone-green,
.metric-card.tone-green {
    --metric: #18b67b;
}

.tone-cyan,
.metric-card.tone-cyan {
    --metric: #14abc8;
}

.tone-red,
.metric-card.tone-red {
    --metric: #d94b63;
}

.tone-orange,
.metric-card.tone-orange {
    --metric: #f28a2e;
}

.tone-purple,
.metric-card.tone-purple {
    --metric: #7b61ff;
}

.tone-slate,
.metric-card.tone-slate {
    --metric: #64748b;
}

.live-dot,
.pulse-dot,
.device-row i,
.legend-list i {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--metric, var(--primary));
    display: inline-block;
}

.live-dot,
.pulse-dot,
.device-row i.online {
    background: var(--teal);
    box-shadow: 0 0 0 rgba(24, 182, 167, 0.35);
    animation: pulse 1.8s ease-out infinite;
}

.visual-grid {
    display: grid;
    grid-template-columns: 1fr 1.45fr;
    gap: 16px;
    margin-bottom: 16px;
}

.visual-grid:has(.visual-panel:nth-child(3)) {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.visual-panel {
    min-height: 320px;
}

.visual-panel.wide {
    min-width: 0;
}

.device-visual {
    display: grid;
    grid-template-columns: 180px 1fr;
    align-items: center;
    gap: 20px;
}

.ring {
    --value: 0;
    width: 170px;
    aspect-ratio: 1;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background:
        conic-gradient(var(--teal) calc(var(--value) * 1%), #e7eef7 0),
        #eef6ff;
    animation: softIn 0.5s ease both;
}

.ring > div {
    width: 118px;
    aspect-ratio: 1;
    display: grid;
    place-items: center;
    align-content: center;
    border-radius: 50%;
    background: #fff;
    box-shadow: inset 0 0 0 1px var(--line);
}

.ring strong {
    font-size: 30px;
}

.ring span,
.legend-list span,
.bar-item span,
.line-point span,
.device-row span,
.device-row em {
    color: var(--muted);
    font-size: 12px;
    font-style: normal;
}

.legend-list {
    display: grid;
    gap: 10px;
}

.legend-list div {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 9px;
    padding: 9px 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfdff;
}

.legend-list i {
    background: var(--metric, var(--primary));
}

.funnel-list {
    display: grid;
    gap: 14px;
}

.funnel-row {
    display: grid;
    gap: 8px;
}

.funnel-row div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: var(--muted);
    font-weight: 800;
}

.funnel-row strong {
    color: var(--text);
}

.funnel-row b {
    height: 22px;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--metric, var(--primary)), rgba(15, 139, 255, 0.22));
    animation: growX 0.72s ease both;
}

.mini-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
}

.mini-stats span {
    padding: 6px 10px;
    border-radius: 999px;
    background: #f2f7fd;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

.mini-stats.compact {
    margin-top: 14px;
}

.bar-chart,
.line-chart {
    height: 190px;
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    align-items: end;
    gap: 12px;
    padding: 10px 4px 0;
}

.bar-item,
.line-point {
    height: 100%;
    min-width: 0;
    display: grid;
    grid-template-rows: 1fr auto;
    align-items: end;
    justify-items: center;
    gap: 8px;
}

.bar-item b {
    width: 100%;
    max-width: 28px;
    min-height: 8px;
    border-radius: 999px 999px 4px 4px;
    background: linear-gradient(180deg, #0f8bff, #18b6a7);
    animation: growY 0.65s ease both;
}

.line-point {
    position: relative;
}

.line-point b {
    width: 12px;
    height: 12px;
    margin-bottom: var(--height);
    border-radius: 50%;
    background: #7b61ff;
    box-shadow: 0 0 0 5px rgba(123, 97, 255, 0.12);
    animation: softIn 0.55s ease both;
}

.split-line {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 13px;
}

.progress-stack {
    display: grid;
    gap: 14px;
}

.progress-bar,
.tiny-progress {
    overflow: hidden;
    height: 12px;
    border-radius: 999px;
    background: #edf3f9;
}

.progress-bar b,
.tiny-progress b {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--primary), var(--teal));
    animation: growX 0.72s ease both;
}

.rank-list,
.device-list {
    display: grid;
    gap: 10px;
}

.rank-row {
    min-height: 42px;
    padding: 10px 0;
    border-bottom: 1px solid var(--line);
}

.rank-row code,
.rank-row span {
    min-width: 0;
}

.tiny-progress {
    width: min(130px, 26vw);
    height: 8px;
}

.tiny-progress.wide-progress {
    width: 100%;
    margin: 12px 0 4px;
}

.device-row {
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfdff;
}

.device-row i {
    flex: 0 0 auto;
    background: #aab7c6;
}

.device-row div {
    min-width: 0;
    display: grid;
    gap: 3px;
}

.device-row strong,
.device-row span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.device-row em {
    white-space: nowrap;
}

.empty-text {
    color: var(--muted);
    text-align: center;
}

.dashboard-hero.compact {
    align-items: center;
}

.dashboard-hero.compact h2 {
    font-size: 22px;
}

.dashboard-hero .hero-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

.section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 8px 0 12px;
}

.section-title h2 {
    margin: 0;
    font-size: 18px;
}

.section-title p {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 13px;
}

.card-wall {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 16px;
}

.data-card,
.action-drawer,
.timeline-item,
.kanban-column,
.device-tile,
.price-card {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.data-card,
.price-card,
.device-tile {
    padding: 15px;
    transition: transform 0.18s ease, border-color 0.18s ease;
}

.data-card:hover,
.price-card:hover,
.device-tile:hover {
    transform: translateY(-2px);
    border-color: rgba(15, 139, 255, 0.26);
}

.data-card header,
.price-card header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
}

.data-card h3,
.price-card h3,
.device-tile h3 {
    margin: 0;
    font-size: 16px;
}

.data-card small,
.price-card small,
.device-tile small {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    font-weight: 700;
}

.card-meta {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.card-meta div,
.card-meta .meta-action {
    min-width: 0;
    padding: 9px;
    border-radius: 8px;
    background: #f7fbff;
}

.card-meta .meta-action {
    border: 1px solid transparent;
    color: inherit;
    text-align: left;
    cursor: pointer;
}

.card-meta .meta-action:hover,
.card-meta .meta-action:focus {
    border-color: #bfdbfe;
    background: #eef6ff;
    outline: none;
}

.card-meta span,
.card-meta .meta-action span {
    display: block;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

.card-meta strong,
.card-meta .meta-action strong {
    display: block;
    margin-top: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.qr-modal[hidden] {
    display: none;
}

.qr-dialog {
    width: min(560px, 100%);
}

.action-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 16px;
}

.action-grid.single {
    grid-template-columns: minmax(0, 520px);
}

.lookup-panel {
    margin-bottom: 16px;
}

.lookup-form {
    align-items: end;
}

.lookup-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-top: 12px;
    color: var(--muted);
    font-weight: 700;
}

.action-drawer {
    overflow: hidden;
}

.action-drawer > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 14px 16px;
    cursor: pointer;
    color: var(--primary-dark);
    font-weight: 800;
    background: #fbfdff;
}

.action-drawer > summary::after {
    content: "+";
    color: var(--muted);
    font-size: 18px;
}

.action-drawer[open] > summary::after {
    content: "-";
}

.action-body {
    padding: 16px;
    border-top: 1px solid var(--line);
}

.status-board {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.slot-board {
    margin-bottom: 16px;
}

.slot-summary {
    display: grid;
    grid-template-columns: 150px minmax(0, 1fr);
    align-items: center;
    gap: 18px;
    margin-bottom: 16px;
}

.slot-ring {
    --value: 0;
    width: 138px;
    aspect-ratio: 1;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background:
        conic-gradient(var(--teal) calc(var(--value) * 1%), #e7eef7 0),
        #eef6ff;
    animation: softIn 0.5s ease both;
}

.slot-ring > div {
    width: 96px;
    aspect-ratio: 1;
    display: grid;
    place-items: center;
    align-content: center;
    border-radius: 50%;
    background: #fff;
    box-shadow: inset 0 0 0 1px var(--line);
}

.slot-ring strong {
    font-size: 28px;
}

.slot-ring span,
.slot-progress span,
.slot-progress p,
.slot-copy small,
.slot-mini span {
    color: var(--muted);
}

.slot-progress {
    min-width: 0;
    display: grid;
    gap: 10px;
}

.slot-progress div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-weight: 800;
}

.slot-progress b {
    overflow: hidden;
    height: 13px;
    border-radius: 999px;
    background: #edf3f9;
}

.slot-progress i {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--primary), var(--teal));
    animation: growX 0.72s ease both;
}

.slot-progress p {
    margin: 0;
    font-size: 13px;
    font-weight: 700;
}

.slot-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.phone-slot {
    min-width: 0;
    min-height: 128px;
    display: grid;
    grid-template-columns: 52px minmax(0, 1fr);
    align-items: center;
    gap: 12px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfdff;
    box-shadow: var(--shadow);
    animation: softIn 0.48s ease both;
}

.phone-slot.occupied.online {
    border-color: rgba(24, 182, 167, 0.34);
    background: linear-gradient(135deg, #ffffff 0%, #f0fffb 100%);
}

.phone-slot.free {
    border-style: dashed;
    background: #f8fbff;
}

.phone-shell {
    position: relative;
    width: 44px;
    height: 76px;
    border: 3px solid #27384d;
    border-radius: 14px;
    background: #0f172a;
    box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.08), 0 10px 24px rgba(15, 23, 42, 0.12);
}

.phone-shell::before {
    content: "";
    position: absolute;
    top: 5px;
    left: 50%;
    width: 16px;
    height: 3px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.28);
    transform: translateX(-50%);
}

.phone-shell i {
    position: absolute;
    inset: 12px 7px 10px;
    overflow: hidden;
    border-radius: 8px;
    background: linear-gradient(180deg, rgba(15, 139, 255, 0.8), rgba(24, 182, 167, 0.72));
}

.phone-shell span {
    position: absolute;
    right: -3px;
    top: 10px;
    width: 9px;
    height: 9px;
    border: 2px solid #fff;
    border-radius: 50%;
    background: #aab7c6;
}

.phone-slot.online .phone-shell span {
    background: var(--teal);
    animation: pulse 1.8s ease-out infinite;
}

.phone-slot.running .phone-shell i::after {
    content: "";
    position: absolute;
    left: -45%;
    top: 0;
    width: 40%;
    height: 100%;
    background: rgba(255, 255, 255, 0.38);
    transform: skewX(-18deg);
    animation: phoneScan 1.45s ease-in-out infinite;
}

.phone-slot.free .phone-shell {
    border-color: #aab7c6;
    background: #e8eef5;
    box-shadow: none;
}

.phone-slot.free .phone-shell i {
    background: linear-gradient(180deg, #d7e0eb, #edf3f9);
}

.slot-copy {
    min-width: 0;
    display: grid;
    gap: 6px;
}

.slot-copy strong,
.slot-copy small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

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

.slot-mini span {
    padding: 4px 7px;
    border-radius: 999px;
    background: #eef6ff;
    font-size: 12px;
    font-weight: 800;
}

.slot-action {
    margin-top: 4px;
}

.slot-action .button {
    width: 100%;
    padding: 7px 9px;
}

.slot-bulk-control,
.run-control {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.slot-bulk-control {
    margin: 0 0 12px;
}

.run-control.compact .button {
    padding: 6px 9px;
    min-height: 30px;
    font-size: 12px;
}

.phone-slot .run-control {
    margin-top: 4px;
}

.phone-slot .run-control .button {
    flex: 1 1 54px;
}

.kanban-column {
    min-height: 128px;
    padding: 14px;
    overflow: hidden;
}

.kanban-column h3 {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin: 0 0 10px;
    font-size: 15px;
}

.kanban-column strong {
    font-size: 28px;
}

.kanban-column p {
    margin: 8px 0 0;
    color: var(--muted);
    font-size: 12px;
}

.kanban-bar {
    overflow: hidden;
    height: 9px;
    border-radius: 999px;
    background: #edf3f9;
}

.kanban-bar b {
    display: block;
    height: 100%;
    min-width: 8px;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--metric, var(--primary)), rgba(15, 139, 255, 0.2));
    animation: growX 0.72s ease both;
}

.timeline-list {
    display: grid;
    gap: 10px;
}

.timeline-item {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 12px;
    padding: 12px;
}

.timeline-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--metric, var(--primary));
    box-shadow: 0 0 0 4px rgba(15, 139, 255, 0.1);
}

.timeline-item h3 {
    margin: 0;
    font-size: 14px;
}

.timeline-item p {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 12px;
}

.timeline-item time {
    color: var(--muted);
    font-size: 12px;
    white-space: nowrap;
}

.card-actions {
    margin-top: 12px;
}

.sub-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin: 0 0 16px;
}

.sub-tabs.customer-tabs {
    grid-template-columns: repeat(5, minmax(0, 1fr));
}

.sub-tabs a {
    position: relative;
    min-height: 78px;
    display: grid;
    align-content: center;
    gap: 4px;
    padding: 16px 18px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--text);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.sub-tabs.customer-tabs a {
    min-height: 72px;
    padding: 14px 16px;
}

.sub-tabs a::after {
    content: "";
    position: absolute;
    right: 14px;
    top: 18px;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgba(15, 139, 255, 0.12);
    transform: scale(0.78);
    transition: transform 0.2s ease, background 0.2s ease;
}

.sub-tabs a.active {
    border-color: rgba(15, 139, 255, 0.38);
    background: linear-gradient(135deg, #ffffff 0%, #eef7ff 100%);
}

.sub-tabs a.active::after {
    background: rgba(24, 182, 167, 0.18);
    transform: scale(1);
    animation: pulse 1.8s ease-out infinite;
}

.sub-tabs strong {
    position: relative;
    z-index: 1;
    font-size: 18px;
}

.sub-tabs span {
    position: relative;
    z-index: 1;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.manage-table th:last-child,
.manage-table td:last-child {
    min-width: 180px;
}

.row-detail {
    min-width: 170px;
}

.row-detail > summary {
    width: max-content;
    min-width: 96px;
    padding: 7px 10px;
    border-radius: 8px;
    cursor: pointer;
    color: var(--primary-dark);
    background: var(--surface-soft);
    font-weight: 800;
    list-style-position: inside;
}

.row-detail[open] > summary {
    margin-bottom: 10px;
}

.detail-grid {
    width: min(420px, 72vw);
    display: grid;
    grid-template-columns: 86px minmax(0, 1fr);
    gap: 7px 10px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfdff;
}

.detail-grid span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

.detail-grid strong {
    min-width: 0;
    overflow-wrap: anywhere;
    font-size: 13px;
}

.status-actions {
    display: grid;
    gap: 8px;
    margin-top: 10px;
}

.danger-text {
    margin: 10px 0 0;
    color: var(--danger);
    font-size: 12px;
    line-height: 1.5;
}

.maintenance-hero {
    border-left: 4px solid var(--danger);
}

.maintenance-grid {
    align-items: start;
}

.maintenance-list {
    display: grid;
    gap: 10px;
}

.maintenance-item {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfdff;
}

.maintenance-item strong {
    display: block;
    margin-bottom: 5px;
}

.maintenance-item p {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.55;
}

.maintenance-item span {
    min-width: 68px;
    padding: 5px 8px;
    border-radius: 8px;
    background: #edf4ff;
    color: var(--primary-dark);
    text-align: center;
    font-weight: 900;
}

.maintenance-list.preserved .maintenance-item span {
    background: #e9fbf7;
    color: #087f70;
}

.maintenance-danger {
    border-color: rgba(217, 75, 99, 0.28);
}

.maintenance-form {
    grid-template-columns: minmax(220px, 360px) minmax(0, 1fr);
    align-items: end;
}

.device-matrix {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.device-tile {
    min-height: 142px;
}

.device-tile header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.device-tile .device-status {
    width: 11px;
    height: 11px;
    flex: 0 0 auto;
    margin-top: 3px;
    border-radius: 50%;
    background: #aab7c6;
}

.device-tile .device-status.online {
    background: var(--teal);
    animation: pulse 1.8s ease-out infinite;
}

.device-tile footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 14px;
}

.price-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 16px;
}

.price-card .price {
    margin: 14px 0;
    font-size: 30px;
    font-weight: 900;
}

.feature-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.feature-tags span {
    padding: 5px 8px;
    border-radius: 999px;
    background: #eef6ff;
    color: var(--primary-dark);
    font-size: 12px;
    font-weight: 800;
}

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

.table-scroll table {
    min-width: 760px;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(24, 182, 167, 0.35);
    }
    70% {
        box-shadow: 0 0 0 9px rgba(24, 182, 167, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(24, 182, 167, 0);
    }
}

@keyframes growX {
    from {
        transform: scaleX(0.08);
        transform-origin: left center;
    }
    to {
        transform: scaleX(1);
        transform-origin: left center;
    }
}

@keyframes growY {
    from {
        transform: scaleY(0.08);
        transform-origin: center bottom;
    }
    to {
        transform: scaleY(1);
        transform-origin: center bottom;
    }
}

@keyframes softIn {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes phoneScan {
    0% {
        left: -45%;
        opacity: 0;
    }
    18% {
        opacity: 1;
    }
    100% {
        left: 110%;
        opacity: 0;
    }
}

@media (max-width: 1024px) {
    .shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
        height: auto;
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }

    nav {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .stats-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .grid.two,
    .login-panel,
    .action-grid,
    .action-grid.single,
    .sub-tabs,
    .card-wall,
    .price-grid,
    .device-matrix,
    .status-board,
    .visual-grid,
    .visual-grid:has(.visual-panel:nth-child(3)) {
        grid-template-columns: 1fr;
    }

    .metric-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .card-wall,
    .price-grid,
    .device-matrix,
    .status-board {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .slot-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 680px) {
    .toast-stack {
        top: 12px;
        right: 12px;
        left: 12px;
        width: auto;
    }

    .main {
        padding: 18px;
    }

    .topbar,
    .userbox,
    .dashboard-hero,
    .maintenance-item,
    .device-visual {
        align-items: stretch;
        flex-direction: column;
    }

    nav,
    .stats-grid,
    .metric-grid,
    .sub-tabs,
    .slot-summary,
    .slot-grid,
    .card-wall,
    .price-grid,
    .device-matrix,
    .status-board,
    .action-grid,
    .action-grid.single,
    .secret-grid,
    .app-edit > summary,
    .form-grid,
    .maintenance-form,
    fieldset.checks {
        grid-template-columns: 1fr;
    }

    .dashboard-hero {
        display: grid;
    }

    .hero-status {
        justify-items: start;
        min-width: 0;
    }

    .device-visual {
        display: grid;
    }

    .ring {
        width: min(170px, 72vw);
        justify-self: center;
    }

    .panel {
        overflow-x: auto;
    }
}
