:root {
    --bg: #f4f6f8;
    --panel: #ffffff;
    --ink: #151f27;
    --muted: #63717d;
    --line: #dfe6eb;
    --brand: #11675c;
    --brand-soft: #e8f5f2;
    --warn: #8a6416;
    --warn-bg: #fff7df;
    --error: #963434;
    --error-bg: #fff0f0;
    --radius: 8px;
    --shadow: 0 12px 32px rgba(18, 34, 46, 0.06);
    --sans: "Noto Sans TC", system-ui, sans-serif;
    --serif: "Playfair Display", serif;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--sans);
    line-height: 1.7;
}

button,
input,
select {
    font: inherit;
}

.dashboard-shell {
    width: min(1440px, calc(100% - 40px));
    margin: 0 auto;
    padding: 40px 0;
}

.hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 24px;
    align-items: end;
    margin-bottom: 24px;
}

.eyebrow {
    margin: 0 0 8px;
    color: var(--brand);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

h1 {
    margin: 0 0 10px;
    font-family: var(--serif);
    font-size: clamp(2.5rem, 5vw, 5rem);
    line-height: 0.98;
}

.hero-copy {
    max-width: 720px;
    margin: 0;
    color: var(--muted);
}

.status {
    min-width: 280px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--panel);
    color: #35444f;
    font-size: 0.92rem;
    font-weight: 700;
}

.status[data-tone="success"] {
    border-color: #8fcabf;
    background: var(--brand-soft);
    color: var(--brand);
}

.status[data-tone="warning"] {
    border-color: #e7c46b;
    background: var(--warn-bg);
    color: var(--warn);
}

.status[data-tone="error"] {
    border-color: #e7a3a3;
    background: var(--error-bg);
    color: var(--error);
}

.controls,
.site-manager form {
    display: grid;
    grid-template-columns: minmax(220px, 0.9fr) minmax(300px, 1.3fr) minmax(150px, 0.55fr) minmax(150px, auto) auto auto auto;
    gap: 12px;
    align-items: end;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--panel);
    box-shadow: var(--shadow);
}

label {
    display: grid;
    gap: 6px;
}

label span,
.site-panel span {
    color: var(--muted);
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

input,
select,
code {
    width: 100%;
    min-height: 44px;
    padding: 0 12px;
    border: 1px solid #cfd8df;
    border-radius: 6px;
    background: #fff;
    color: var(--ink);
}

code {
    width: auto;
    min-height: 0;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.92em;
}

input:focus,
select:focus {
    outline: 2px solid rgba(17, 103, 92, 0.18);
    border-color: var(--brand);
}

.button {
    min-height: 44px;
    padding: 0 18px;
    border: 1px solid #111a20;
    border-radius: 6px;
    background: #111a20;
    color: #fff;
    font-weight: 800;
    cursor: pointer;
}

.button.secondary {
    background: #fff;
    color: #111a20;
}

.button.ghost {
    border-color: transparent;
    background: #edf2f5;
    color: #35444f;
}

.button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.button[data-connect]:disabled,
.button[data-refresh]:disabled {
    cursor: progress;
}

.remember-option {
    min-height: 44px;
    display: flex;
    gap: 8px;
    align-items: center;
    padding: 0 12px;
    border: 1px solid #cfd8df;
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
}

.remember-option input {
    width: 16px;
    min-height: 16px;
    accent-color: var(--brand);
}

.remember-option span {
    color: var(--ink);
    font-size: 0.9rem;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: none;
}

.text-button {
    border: 0;
    background: transparent;
    color: var(--brand);
    font-weight: 800;
    cursor: pointer;
}

.site-panel,
.site-manager {
    margin-top: 14px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--panel);
}

.site-panel {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
}

.site-panel strong,
.site-panel small {
    display: block;
}

.site-panel small,
.site-manager p {
    color: var(--muted);
}

.site-manager form {
    grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
    box-shadow: none;
    padding: 0;
    border: 0;
}

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

.metrics article,
.panel {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--panel);
    box-shadow: var(--shadow);
}

.metrics article {
    min-height: 132px;
    padding: 20px;
}

.metrics span {
    display: block;
    margin-bottom: 18px;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}

.metrics strong {
    display: block;
    font-size: clamp(2rem, 4vw, 3.2rem);
    line-height: 1;
}

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

.panel {
    min-height: 360px;
    padding: 20px;
}

.panel-wide {
    grid-column: span 2;
}

.panel header {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: baseline;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #edf1f4;
}

.panel h2 {
    margin: 0;
    font-size: 1rem;
    font-weight: 800;
}

.panel small {
    color: #7c8a95;
    font-size: 0.78rem;
}

.list {
    display: grid;
    gap: 8px;
    padding: 0;
    margin: 0;
    list-style: none;
}

.list li {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 6px 16px;
    align-items: baseline;
    padding: 10px 0;
    border-bottom: 1px solid #f0f3f5;
}

.list li span {
    overflow: hidden;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.list li strong {
    color: var(--brand);
}

.list li small {
    grid-column: 1 / -1;
}

.list .empty {
    display: block;
    color: #7c8a95;
}

.notes p {
    margin: 0;
    color: var(--muted);
}

@media (max-width: 980px) {
    .hero,
    .controls,
    .site-manager form,
    .grid {
        grid-template-columns: 1fr;
    }

    .status {
        min-width: 0;
    }

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

    .panel-wide {
        grid-column: auto;
    }
}

@media (max-width: 640px) {
    .dashboard-shell {
        width: min(100% - 28px, 1440px);
        padding: 24px 0;
    }

    .site-panel {
        display: grid;
    }

    .metrics {
        grid-template-columns: 1fr;
    }

    .metrics article,
    .panel {
        min-height: auto;
        padding: 16px;
    }
}
