:root {
    color-scheme: light;
    --bg: #ffffff;
    --sidebar: #f7f9fc;
    --panel: #ffffff;
    --soft: #f7f9fc;
    --soft-blue: #eef4ff;
    --text: #101828;
    --muted: #667085;
    --muted-2: #98a2b3;
    --line: #e4e7ec;
    --line-strong: #d0d5dd;
    --blue: #2864e8;
    --blue-dark: #1d4ed8;
    --blue-soft: #e8efff;
    --green: #12b76a;
    --green-dark: #039855;
    --green-soft: #ecfdf3;
    --amber: #f79009;
    --amber-dark: #b54708;
    --amber-soft: #fff4ed;
    --red: #d92d20;
    --red-soft: #fef3f2;
    --shadow-focus: 0 0 0 3px rgba(40, 100, 232, .12);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body {
    margin: 0;
    color: var(--text);
    background: var(--bg);
    font: 14px/1.45 Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--blue); }
button, input, select, textarea { font: inherit; }
button { color: inherit; }

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

.sidebar {
    position: sticky;
    z-index: 30;
    top: 0;
    height: 100vh;
    padding: 14px 10px 16px;
    border-right: 1px solid var(--line);
    background: var(--sidebar);
    display: flex;
    flex-direction: column;
}
.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 48px;
    padding: 0 8px 8px;
    font-size: 16px;
    font-weight: 750;
}
.brand-mark {
    display: block;
    flex: 0 0 auto;
    width: 34px;
    height: 34px;
    border-radius: 9px;
    object-fit: cover;
}
.sidebar-close { display: none; }
.nav-title {
    padding: 19px 10px 7px;
    color: #697386;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .09em;
    text-transform: uppercase;
}
.nav { display: grid; gap: 3px; }
.nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 42px;
    padding: 9px 11px;
    border-radius: 9px;
    color: #344054;
    text-decoration: none;
    transition: background .16s ease, color .16s ease;
}
.nav a:hover { background: #edf2fb; color: var(--blue-dark); }
.nav a.is-active { background: #dfe8ff; color: var(--blue-dark); font-weight: 650; }
.nav a.nav-sub {
    min-height: 34px;
    padding-left: 18px;
    font-size: 12px;
}
.nav-icon { width: 16px; color: #8090aa; text-align: center; }
.nav a.is-active .nav-icon { color: var(--blue); }
.nav-dot {
    width: 8px;
    height: 8px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: #20bf8b;
}
.nav-dot.stale { background: var(--amber); }
.sidebar-foot {
    margin-top: auto;
    padding: 14px 10px 0;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.45;
}
.sidebar-foot p { margin: 0 0 10px; }
.logout-link {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 32px;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    font-size: 12px;
    font-weight: 650;
}
.logout-link:hover { color: var(--blue); }
.sidebar-backdrop { display: none; }

.login-body {
    min-height: 100vh;
    background:
        radial-gradient(circle at 15% 15%, rgba(40, 100, 232, .12), transparent 28%),
        radial-gradient(circle at 85% 12%, rgba(18, 183, 106, .10), transparent 26%),
        var(--soft);
}
.login-shell {
    display: grid;
    place-items: center;
    min-height: 100vh;
    padding: 24px 14px;
}
.login-card {
    width: min(100%, 430px);
    padding: 24px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: rgba(255, 255, 255, .94);
    box-shadow: 0 18px 60px rgba(16, 24, 40, .12);
}
.login-brand {
    display: flex;
    align-items: center;
    gap: 11px;
}
.login-brand strong,
.login-brand span { display: block; }
.login-brand strong { font-size: 16px; }
.login-brand span {
    margin-top: 1px;
    color: var(--muted);
    font-size: 12px;
}
.login-head { margin: 28px 0 18px; }
.login-head h1 {
    margin: 0;
    font-size: 28px;
    line-height: 1.15;
    letter-spacing: -.035em;
}
.login-head p {
    margin: 8px 0 0;
    color: var(--muted);
}
.login-form { display: grid; gap: 14px; }
.check-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--soft);
    cursor: pointer;
}
.check-row input {
    width: 18px;
    height: 18px;
    margin: 1px 0 0;
    accent-color: var(--blue);
}
.check-row strong,
.check-row small { display: block; }
.check-row strong { font-size: 13px; }
.check-row small {
    margin-top: 2px;
    color: var(--muted);
    font-size: 12px;
}

.main {
    min-width: 0;
    width: 100%;
    max-width: 1600px;
    padding: 22px 30px 56px;
}
.mobile-topbar { display: none; }
.page-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 22px;
}
.page-title {
    margin: 0;
    font-size: 25px;
    line-height: 1.22;
    letter-spacing: -.025em;
}
.page-subtitle { margin: 5px 0 0; color: var(--muted); }
.separator { margin: 0 4px; color: var(--line-strong); }
.dashboard-head { align-items: center; }
.page-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}
.freshness {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--muted);
    font-size: 12px;
}
.refresh-button { min-height: 34px; padding: 0 12px; font-size: 12px; white-space: nowrap; }
.refresh-button:disabled { cursor: wait; opacity: .72; }
.icon-btn {
    display: inline-grid;
    place-items: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: #667085;
    cursor: pointer;
    text-decoration: none;
}
.icon-btn:hover { border-color: #aebbd0; color: var(--blue); background: var(--soft-blue); }
.eyebrow-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
    color: var(--blue);
    font-size: 12px;
    font-weight: 650;
    text-decoration: none;
}
.fresh-badge {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 28px;
    padding: 4px 10px;
    border: 1px solid #abefc6;
    border-radius: 999px;
    background: var(--green-soft);
    color: var(--green-dark);
    font-size: 12px;
}
.fresh-badge.warn { border-color: #fedf89; background: #fffaeb; color: var(--amber-dark); }
.fresh-badge.danger { border-color: #fecdca; background: var(--red-soft); color: var(--red); }

.overview-cards {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}
.metric-card, .card, .panel {
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--panel);
}
.metric-card {
    min-height: 106px;
    padding: 18px 18px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}
.card-label {
    display: block;
    color: var(--muted);
    font-size: 12px;
}
.card-value {
    display: block;
    margin-top: 4px;
    color: var(--text);
    font-size: 27px;
    line-height: 1.15;
    font-weight: 750;
    letter-spacing: -.03em;
}
.card-date { font-size: 19px; letter-spacing: -.015em; }
.metric-icon {
    width: 34px;
    color: #98a2b3;
    font-size: 25px;
    text-align: center;
}
.health-card { display: block; }
.health-line {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
    color: var(--green-dark);
}
.health-line > i { font-size: 27px; }
.health-line strong, .health-line span { display: block; }
.health-line strong { font-size: 14px; }
.health-line span { margin-top: 2px; font-size: 11px; font-weight: 500; }
.health-line.warning { color: var(--amber-dark); }
.health-line.danger { color: var(--red); }
.help { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; }

.panel { padding: 20px; margin-bottom: 16px; }
.panel h2 { margin: 0; font-size: 17px; line-height: 1.35; letter-spacing: -.015em; }
.panel h3 { margin: 0; font-size: 14px; }
.muted { color: var(--muted); }
.section-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}
.section-heading p { margin: 4px 0 0; }
.storage-heading { align-items: center; }
.inline-legend {
    display: flex;
    align-items: center;
    gap: 23px;
    margin-top: 12px;
    color: var(--muted);
    font-size: 12px;
}
.inline-legend span { display: inline-flex; align-items: center; gap: 7px; }
.attention {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    max-width: 430px;
    min-height: 34px;
    padding: 7px 12px;
    border-radius: 8px;
    background: var(--amber-soft);
    color: var(--amber-dark);
    font-size: 12px;
}
.storage-panel { padding-bottom: 13px; }
.storage-comparison { display: grid; gap: 0; margin-top: 18px; }
.storage-row {
    display: grid;
    grid-template-columns: minmax(155px, .78fr) minmax(430px, 3.3fr) minmax(140px, .8fr) 50px;
    align-items: center;
    gap: 14px;
    min-height: 44px;
    color: var(--text);
    text-decoration: none;
}
.storage-row:hover .storage-name { color: var(--blue); }
.storage-name { overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.disk-bar, .project-bar {
    display: flex;
    overflow: hidden;
    width: 100%;
    height: 14px;
    border-radius: 6px;
    background: #e8edf4;
}
.comparison-bar { height: 26px; margin: 0; border-radius: 4px; }
.comparison-bar > span {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
}
.comparison-bar em {
    overflow: hidden;
    padding: 0 5px;
    color: #fff;
    font-size: 11px;
    font-style: normal;
    font-weight: 650;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.comparison-bar .disk-free em { color: #667085; }
.disk-projects, .application { background: var(--blue); }
.disk-other { background: #8d9bb2; }
.disk-free { background: #e5eaf1; }
.dependencies { background: #7c3aed; }
.media { background: #12b76a; }
.cache_logs { background: #f79009; }
.git { background: #667085; }
.storage-total { color: var(--muted); font-size: 12px; text-align: right; white-space: nowrap; }
.storage-percent { font-size: 16px; text-align: right; }
.storage-percent.warn { color: var(--amber-dark); }
.storage-percent.danger { color: var(--red); }
.panel-note { margin: 8px 0 0; color: var(--muted-2); font-size: 11px; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; }

.table-wrap { overflow-x: auto; }
.server-status-panel { padding: 0; overflow: hidden; }
.server-status-panel > .section-heading { padding: 16px 18px 12px; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td {
    padding: 11px 12px;
    border-top: 1px solid var(--line);
    text-align: left;
    vertical-align: middle;
}
.table th {
    color: var(--muted);
    font-size: 10px;
    font-weight: 650;
    letter-spacing: .01em;
    white-space: nowrap;
}
.table td { font-size: 12px; }
.table td > strong, .table td > small { display: block; }
.table td > small { margin-top: 2px; color: var(--muted); font-size: 10px; }
.server-cell {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 160px;
    color: var(--text);
    text-decoration: none;
}
.server-cell > i { color: #8090aa; }
.server-cell strong, .server-cell small { display: block; }
.server-cell small { margin-top: 2px; color: var(--muted); font-size: 10px; font-weight: 400; }
.server-cell:hover strong { color: var(--blue); }
.server-table th { padding-top: 8px; padding-bottom: 8px; }
.server-table td { height: 52px; padding-top: 7px; padding-bottom: 7px; }
.server-table .mini-bar { margin-top: 3px; }
.state-text {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--green-dark);
    font-weight: 600;
    white-space: nowrap;
}
.state-text.warn { color: var(--amber-dark); }
.state-text.danger { color: var(--red); }
.status-hint {
    display: block;
    margin-top: 3px;
    color: var(--muted);
    font-size: 10px;
    line-height: 1.25;
}
.mini-bar {
    display: block;
    overflow: hidden;
    width: 66px;
    height: 4px;
    margin-top: 5px;
    border-radius: 999px;
    background: #e4e7ec;
}
.mini-bar i { display: block; height: 100%; border-radius: inherit; background: #4dc88d; }
.row-arrow { display: grid; place-items: center; width: 26px; height: 26px; color: #98a2b3; text-decoration: none; }
.row-arrow:hover { color: var(--blue); }

.recent-panel { padding: 0; overflow: hidden; }
.recent-panel > .section-heading { padding: 16px 18px 12px; align-items: center; }
.recent-list { border-top: 1px solid var(--line); }
.recent-row {
    display: grid;
    grid-template-columns: 18px minmax(0, 1fr) auto 12px;
    align-items: center;
    gap: 11px;
    min-height: 52px;
    padding: 9px 18px;
    border-bottom: 1px solid var(--line);
    color: var(--text);
    text-decoration: none;
}
.recent-row:last-child { border-bottom: 0; }
.recent-row > i { color: var(--blue); }
.recent-row > i:last-child { color: #98a2b3; font-size: 10px; }
.recent-row strong, .recent-row small { display: block; }
.recent-row small { margin-top: 2px; color: var(--muted); font-size: 11px; font-weight: 400; }
.recent-row time { color: var(--muted); font-size: 11px; }
.recent-row:hover { background: #fbfcfe; }
.recent-row:hover strong { color: var(--blue); }

.server-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.55fr) minmax(300px, .62fr);
    gap: 16px;
    align-items: start;
}
.sticky-aside { position: sticky; top: 20px; }
.server-name-form { display: flex; align-items: center; gap: 8px; }
.server-name-input {
    min-width: 250px;
    max-width: 680px;
    padding: 0;
    border: 0;
    border-bottom: 1px dashed transparent;
    background: transparent;
    color: var(--text);
    font-size: 25px;
    font-weight: 750;
    line-height: 36px;
    letter-spacing: -.025em;
}
.server-name-input:hover { border-color: var(--line-strong); }
.server-name-input:focus { border-color: var(--blue); outline: 0; }
.save-name { opacity: 0; transition: opacity .15s ease; }
.server-name-form:focus-within .save-name, .server-name-form:hover .save-name { opacity: 1; }
.badges { display: flex; gap: 6px; flex-wrap: wrap; }
.badge {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 3px 8px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #fff;
    color: var(--muted);
    font-size: 11px;
}
.badge.ok { border-color: #abefc6; background: var(--green-soft); color: var(--green-dark); }
.badge.warn { border-color: #fedf89; background: #fffaeb; color: var(--amber-dark); }
.featured-disk {
    margin-top: 18px;
    padding: 15px;
    border-radius: 10px;
    background: var(--soft);
}
.featured-disk .disk-bar { margin: 11px 0 12px; }
.disk-legend-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}
.disk-legend-grid > div { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 11px; }
.disk-legend-grid span { display: inline-flex; align-items: center; gap: 6px; }
.disk-legend-grid strong { color: #475467; }
.row-between { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.system-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    margin-top: 14px;
}
.system-item {
    position: relative;
    min-height: 66px;
    padding: 11px 10px 9px 34px;
    border: 1px solid var(--line);
    border-radius: 8px;
}
.system-item > i { position: absolute; top: 13px; left: 11px; color: #98a2b3; }
.system-item span, .system-item strong { display: block; }
.system-item span { color: var(--muted); font-size: 10px; }
.system-item strong { margin-top: 3px; font-size: 12px; }
.storage-insights {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-top: 16px;
}
.insight-block, .history-block {
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
}
.insight-block { padding: 14px; }
.history-block { margin-top: 16px; padding: 14px; }
.subsection-title {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}
.subsection-title h3 { margin: 0; font-size: 14px; }
.subsection-title span { color: var(--muted); font-size: 11px; text-align: right; }
.usage-list { display: grid; gap: 9px; }
.usage-row {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(90px, .8fr) minmax(74px, auto);
    align-items: center;
    gap: 10px;
}
.usage-row strong, .usage-row code { display: block; }
.usage-row > div > strong {
    overflow: hidden;
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.usage-row > div > code {
    color: var(--muted);
    font-size: 10px;
}
.usage-row > strong {
    font-size: 12px;
    text-align: right;
    white-space: nowrap;
}
.usage-bar {
    display: block;
    overflow: hidden;
    height: 8px;
    border-radius: 999px;
    background: #e8edf4;
}
.usage-bar i {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: var(--blue);
}
.usage-bar.known i { background: var(--amber); }
.usage-bar.home i { background: #7c3aed; }
.home-storage-block {
    margin-top: 16px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
}
.compact-status {
    margin: 0 0 12px;
    padding: 10px 12px;
    font-size: 12px;
}
.home-account-list {
    display: grid;
    gap: 10px;
}
.home-account-card {
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--soft);
}
.home-account-main {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}
.home-account-main strong,
.home-account-main code,
.home-account-main small { display: block; }
.home-account-main > div > strong { font-size: 13px; }
.home-account-main > div > code {
    color: var(--muted);
    font-size: 10px;
}
.home-account-main small {
    margin-top: 3px;
    color: var(--muted);
    font-size: 11px;
}
.home-account-main > strong {
    white-space: nowrap;
}
.account-split {
    display: flex;
    overflow: hidden;
    height: 10px;
    margin-top: 10px;
    border-radius: 999px;
    background: #e8edf4;
}
.account-split span { display: block; height: 100%; }
.home-account-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 16px;
    margin-top: 8px;
    color: var(--muted);
    font-size: 11px;
}
.home-child-list {
    display: grid;
    gap: 7px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--line);
}
.home-child-row {
    grid-template-columns: minmax(0, 1.35fr) minmax(86px, .65fr) minmax(74px, auto);
}
.wide-usage-row {
    grid-template-columns: minmax(0, 1.6fr) minmax(100px, .7fr) minmax(78px, auto);
}
.history-chart {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(16px, 1fr);
    align-items: end;
    gap: 5px;
    height: 150px;
    padding: 12px 4px 0;
    border-bottom: 1px solid var(--line);
}
.history-column {
    display: grid;
    grid-template-rows: 1fr 18px;
    align-items: end;
    min-width: 0;
    height: 100%;
}
.history-stack {
    display: flex;
    flex-direction: column-reverse;
    overflow: hidden;
    width: 100%;
    min-height: 2px;
    border-radius: 5px 5px 0 0;
    background: #8d9bb2;
}
.history-stack i {
    display: block;
    width: 100%;
    background: var(--blue);
}
.history-column small {
    overflow: hidden;
    margin-top: 4px;
    color: var(--muted);
    font-size: 9px;
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.history-legend { margin-top: 10px; }
.compact-empty {
    margin: 0;
    padding: 18px 10px;
    font-size: 12px;
}
.subsection-head {
    margin: 19px -20px 0;
    padding: 14px 20px 10px;
    border-top: 1px solid var(--line);
}
.subsection-head h3 { display: inline; }
.subsection-head span { margin-left: 8px; color: var(--muted); font-size: 11px; }
.project-list { display: grid; margin: 0 -20px -20px; }
.project-row {
    display: grid;
    grid-template-columns: 18px minmax(0, 1.6fr) minmax(125px, .55fr) auto;
    gap: 12px;
    align-items: center;
    min-height: 62px;
    padding: 9px 20px;
    border-top: 1px solid var(--line);
}
.project-icon { color: var(--blue); }
.project-name { color: var(--text); font-weight: 700; text-decoration: none; }
.project-name:hover { color: var(--blue); }
.project-size strong { display: block; }
code, .mono { font: 11px/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; overflow-wrap: anywhere; }

.panel-icon-title { display: flex; align-items: flex-start; gap: 11px; }
.panel-icon-title > span {
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--soft-blue);
    color: var(--blue);
}
.panel-icon-title p { margin: 3px 0 0; font-size: 12px; }
.access-panel .panel-icon-title { margin-bottom: 18px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.form-grid.form-single { grid-template-columns: 1fr; margin-top: 17px; }
.field { display: grid; gap: 6px; }
.field.full { grid-column: 1 / -1; }
.field label { color: #344054; font-size: 12px; font-weight: 650; }
.input, .select, .textarea {
    width: 100%;
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    background: #fff;
    color: var(--text);
    transition: border-color .15s ease, box-shadow .15s ease;
}
.input, .select { height: 40px; padding: 0 11px; }
.textarea { min-height: 108px; padding: 10px 11px; resize: vertical; }
.input:hover, .select:hover, .textarea:hover { border-color: #aab4c5; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--blue); box-shadow: var(--shadow-focus); outline: 0; }
.input-with-icon { position: relative; }
.input-with-icon > i { position: absolute; z-index: 1; top: 13px; left: 11px; color: #98a2b3; font-size: 12px; }
.input-with-icon .input { padding-left: 32px; }
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 40px;
    padding: 0 16px;
    border: 1px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 650;
    text-decoration: none;
    transition: background .15s ease, border-color .15s ease, color .15s ease, transform .05s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { border-color: var(--blue); background: var(--blue); color: #fff; }
.btn-primary:hover { border-color: var(--blue-dark); background: var(--blue-dark); }
.btn-secondary { border-color: var(--line-strong); background: #fff; color: #344054; }
.btn-secondary:hover { border-color: #aeb8c8; background: var(--soft); }
.btn-ghost { background: transparent; color: var(--blue); }
.btn-danger { background: var(--red); color: #fff; }
.btn-small { min-height: 31px; padding: 0 10px; font-size: 11px; }
.btn-block { width: 100%; margin-top: 14px; }
.admin-link { white-space: nowrap; }
.secret-row, .actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.secret {
    display: inline-flex;
    align-items: center;
    min-height: 31px;
    min-width: 96px;
    padding: 5px 9px;
    border-radius: 7px;
    background: #f2f4f7;
    color: #344054;
}
.secret.is-visible { user-select: all; }

.two-cols {
    display: grid;
    grid-template-columns: minmax(0, 1.3fr) minmax(320px, .7fr);
    gap: 16px;
    align-items: start;
}
.project-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.project-page-head { align-items: flex-end; }
.project-bar { margin: 16px 0 13px; }
.legend { display: grid; gap: 8px; }
.legend-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 11px; }
.legend-key { display: inline-flex; align-items: center; gap: 7px; }
.facts, .credential-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px 18px; }
.fact { min-width: 0; }
.fact-label { display: block; margin-bottom: 3px; color: var(--muted); font-size: 10px; }
.credential { padding: 14px 0; border-top: 1px solid var(--line); }
.credential:first-of-type { margin-top: 12px; }
.access-context { margin-top: 12px; margin-bottom: 12px; }
.credential-access {
    margin-top: 12px;
    padding: 13px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fbfcfe;
}
.credential-access-head,
.credential-access-line { display: flex; align-items: center; gap: 9px; }
.credential-access-head { justify-content: space-between; margin-bottom: 11px; }
.credential-access-head strong { display: block; font-size: 13px; }
.credential-access-line { min-height: 38px; border-top: 1px solid var(--line); }
.credential-access-line .fact-label { flex: 0 0 106px; margin: 0; }
.credential-access-line code { min-width: 0; flex: 1 1 auto; }
.credential-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.icon-action {
    display: inline-grid;
    place-items: center;
    flex: 0 0 auto;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: #475467;
    cursor: pointer;
}
.icon-action:hover { border-color: #aab4c5; color: var(--blue); }
.icon-action:focus-visible { box-shadow: var(--shadow-focus); outline: 0; }
.modal-backdrop {
    position: fixed;
    z-index: 1000;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgb(16 24 40 / 52%);
}
.modal-backdrop[hidden] { display: none; }
.modal-card {
    width: min(600px, 100%);
    max-height: calc(100vh - 40px);
    overflow: auto;
    padding: 22px;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 24px 60px rgb(16 24 40 / 24%);
}
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.modal-head h2 { margin: 3px 0 0; font-size: 20px; }
.modal-card form { display: grid; gap: 15px; }
.credential-password-grid { margin-top: 0; }
.credential-show-check { margin: 0; }
.credential-safety-note {
    display: flex;
    gap: 10px;
    padding: 12px;
    border: 1px solid #b2ddff;
    border-radius: 9px;
    background: var(--soft-blue);
    color: #1849a9;
    font-size: 12px;
    line-height: 1.45;
}
.credential-safety-note i { margin-top: 2px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; }
body.modal-open { overflow: hidden; }
.check { display: flex; align-items: center; gap: 8px; min-height: 40px; color: #344054; font-size: 12px; }
.form-section-title { margin-top: 18px !important; padding-top: 16px; border-top: 1px solid var(--line); }
.form-section-title i { margin-right: 5px; color: var(--blue); }
.comment { padding: 12px 0; border-top: 1px solid var(--line); }
.comment-meta { color: var(--muted); font-size: 11px; }
.comment-body { margin-top: 5px; white-space: pre-wrap; }
.inline-form { display: inline; }
.danger-link { padding: 0; border: 0; background: transparent; color: var(--red); cursor: pointer; font-size: 11px; }

.foreign-group-panel { overflow: hidden; }
.foreign-card-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-top: 16px;
}
.foreign-card {
    display: grid;
    gap: 14px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--soft);
    color: var(--text);
    text-decoration: none;
}
.foreign-card:hover {
    border-color: #b7c5dc;
    background: #fff;
}
.foreign-card-head {
    display: flex;
    align-items: center;
    gap: 11px;
}
.foreign-card-head strong,
.foreign-card-head small { display: block; }
.foreign-card-head strong { font-size: 15px; }
.foreign-card-head small {
    margin-top: 2px;
    color: var(--muted);
    font-size: 12px;
}
.foreign-flag {
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    width: 34px;
    height: 34px;
    border-radius: 9px;
    background: var(--soft-blue);
    color: var(--blue);
}
.row-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--blue);
    font-size: 12px;
    font-weight: 650;
}

.status {
    margin-bottom: 16px;
    padding: 10px 13px;
    border: 1px solid #abefc6;
    border-radius: 8px;
    background: var(--green-soft);
    color: #067647;
}
.status-error { border-color: #fecdca; background: var(--red-soft); color: #b42318; }
.empty { padding: 28px 18px; color: var(--muted); text-align: center; }

@media (max-width: 1250px) {
    .storage-row { grid-template-columns: minmax(140px, .7fr) minmax(360px, 2.6fr) minmax(120px, .7fr) 45px; }
    .server-table th:nth-child(5), .server-table td:nth-child(5) { display: none; }
}

@media (max-width: 1080px) {
    .overview-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .server-grid, .two-cols, .storage-insights, .foreign-card-grid { grid-template-columns: 1fr; }
    .sticky-aside { position: static; }
    .server-table th:nth-child(5), .server-table td:nth-child(5) { display: table-cell; }
}

@media (max-width: 900px) {
    .shell { display: block; }
    .sidebar {
        position: fixed;
        left: 0;
        transform: translateX(-102%);
        width: 250px;
        box-shadow: 18px 0 40px rgba(16, 24, 40, .12);
        transition: transform .2s ease;
    }
    body.sidebar-open { overflow: hidden; }
    body.sidebar-open .sidebar { transform: translateX(0); }
    .sidebar-close {
        display: grid;
        place-items: center;
        width: 30px;
        height: 30px;
        margin-left: auto;
        border: 0;
        background: transparent;
        color: var(--muted);
        cursor: pointer;
    }
    .sidebar-backdrop {
        position: fixed;
        z-index: 20;
        inset: 0;
        border: 0;
        background: rgba(16, 24, 40, .38);
    }
    body.sidebar-open .sidebar-backdrop { display: block; }
    .main { padding-top: 0; }
    .mobile-topbar {
        display: flex;
        align-items: center;
        gap: 12px;
        height: 62px;
        margin: 0 -30px 20px;
        padding: 0 20px;
        border-bottom: 1px solid var(--line);
        background: #fff;
    }
    .mobile-menu {
        display: grid;
        place-items: center;
        width: 36px;
        height: 36px;
        border: 1px solid var(--line);
        border-radius: 8px;
        background: #fff;
    }
    .mobile-brand { display: flex; align-items: center; gap: 9px; }
    .mobile-brand .brand-mark { width: 30px; height: 30px; font-size: 13px; }
    .storage-row { grid-template-columns: 135px minmax(300px, 1fr) 120px 42px; min-width: 760px; }
    .storage-comparison { overflow-x: auto; }
}

[hidden] { display: none !important; }
.project-search-controls { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.project-search-label { width: 100%; font-size: 13px; font-weight: 600; }
.project-search-controls input { flex: 1; min-width: 160px; border: 1px solid var(--line); border-radius: 8px; padding: 11px 14px; font: inherit; }
.project-search-controls input:focus-visible { outline: 2px solid #2563eb; outline-offset: 2px; }
.project-server-group { border-top: 1px solid var(--line); }
.project-server-group summary { cursor: pointer; padding: 14px 0; }
.project-server-group summary .muted { margin-left: 15px; font-size: 13px; }
.project-name-list { list-style: none; padding: 0 0 10px 18px; margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 8px 20px; }
.project-name-list li { overflow-wrap: anywhere; padding: 6px 0; }
.project-name-list a { color: #245bce; }

@media (max-width: 680px) {
    .main { padding: 0 14px 40px; }
    .mobile-topbar { margin: 0 -14px 18px; padding: 0 14px; }
    .page-head, .dashboard-head, .project-page-head { display: block; }
    .freshness, .fresh-badge, .project-page-head > .btn { margin-top: 13px; }
    .page-title, .server-name-input { font-size: 22px; }
    .server-name-input { min-width: 0; width: calc(100vw - 100px); }
    .overview-cards, .project-metrics, .form-grid, .facts, .credential-grid, .system-grid, .disk-legend-grid, .usage-row { grid-template-columns: 1fr; }
    .metric-card { min-height: 94px; }
    .storage-heading { display: block; }
    .attention { margin-top: 13px; }
    .inline-legend { flex-wrap: wrap; gap: 10px 18px; }
    .storage-comparison { overflow: visible; }
    .storage-row {
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 6px 10px;
        min-width: 0;
        padding: 9px 0;
        border-bottom: 1px solid var(--line);
    }
    .storage-name { grid-column: 1; grid-row: 1; }
    .storage-percent { grid-column: 2; grid-row: 1; }
    .comparison-bar { grid-column: 1 / -1; grid-row: 2; }
    .storage-total { grid-column: 1 / -1; grid-row: 3; text-align: left; }
    .panel { padding: 16px; }
    .subsection-head { margin-right: -16px; margin-left: -16px; padding-right: 16px; padding-left: 16px; }
    .project-list { margin-right: -16px; margin-bottom: -16px; margin-left: -16px; }
    .project-row { grid-template-columns: 18px minmax(0, 1fr) auto; padding-right: 16px; padding-left: 16px; }
    .project-size { grid-column: 2 / 3; }
    .project-row .btn { grid-column: 3; grid-row: 1 / 3; }
    .recent-row { grid-template-columns: 18px minmax(0, 1fr) 10px; padding-right: 14px; padding-left: 14px; }
    .recent-row time { display: none; }
    .section-heading { align-items: flex-start; }
    .subsection-title { display: block; }
    .subsection-title span { display: block; margin-top: 3px; text-align: left; }
    .usage-row > strong { text-align: left; }
    .history-chart { overflow-x: auto; grid-auto-columns: 22px; }
    .server-status-panel { overflow: visible; }
    .server-status-panel .table-wrap { border-radius: 0 0 12px 12px; }
    .credential-access-line { align-items: flex-start; flex-wrap: wrap; padding: 9px 0; }
    .credential-access-line .fact-label { flex-basis: 100%; }
    .credential-actions { width: 100%; }
    .credential-actions .btn { flex: 1 1 auto; }
    .modal-backdrop { align-items: end; padding: 0; }
    .modal-card { width: 100%; max-height: 92vh; border-radius: 14px 14px 0 0; }
    .modal-actions .btn { flex: 1 1 0; }
}
