* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
    background: #0f1115;
    color: #e6e8ec;
    font-size: 14px;
}

.hidden { display: none !important; }
.muted { color: #8b93a1; }
.right { text-align: right; }
.error { color: #ff6b6b; margin: 8px 0 0; }

button {
    font: inherit;
    border: 1px solid #2c313c;
    background: #1b1f27;
    color: #e6e8ec;
    padding: 7px 14px;
    border-radius: 8px;
    cursor: pointer;
}
button:hover { border-color: #3c4455; background: #222833; }
button.ghost { background: transparent; }
button.danger { background: #4a1d24; border-color: #7c2d38; color: #ffb3bd; }
button.danger:hover { background: #5d222b; }
button:disabled { opacity: .45; cursor: default; }

input, select {
    font: inherit;
    background: #12161d;
    border: 1px solid #2c313c;
    color: #e6e8ec;
    border-radius: 8px;
    padding: 8px 11px;
    outline: none;
}
input:focus { border-color: #4a7dff; }

/* ---------------------------------------------------------------- gate */

.gate {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at 50% 30%, #1a2130, #0b0d11 70%);
    z-index: 50;
}
.gate-card {
    width: 320px;
    padding: 32px 28px;
    background: #14181f;
    border: 1px solid #232a35;
    border-radius: 16px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .45);
}
.gate-card h1 { font-size: 18px; margin: 0 0 6px; }
.gate-card input { width: 100%; margin: 16px 0 12px; text-align: center; letter-spacing: 2px; }
.gate-card button { width: 100%; background: #2f5df0; border-color: #2f5df0; }
.gate-card button:hover { background: #3d69f2; }

/* ---------------------------------------------------------------- shell */

.app { display: flex; flex-direction: column; min-height: 100vh; }

.topbar {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 14px 20px;
    border-bottom: 1px solid #1d232d;
    background: #12161d;
}
.brand { font-weight: 600; }
.brand .muted { font-weight: 400; margin-left: 8px; font-size: 12px; }
.stats { display: flex; gap: 18px; margin-left: auto; color: #8b93a1; font-size: 13px; }
.stats b { color: #e6e8ec; }

.layout { display: flex; flex: 1; min-height: 0; }

.sidebar {
    width: 240px;
    border-right: 1px solid #1d232d;
    padding: 16px 12px;
    overflow-y: auto;
    background: #10141a;
}
.sidebar-title { font-size: 12px; color: #8b93a1; margin: 0 8px 10px; letter-spacing: 1px; }
.clients { list-style: none; margin: 0; padding: 0; }
.clients li {
    padding: 9px 10px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 2px;
}
.clients li:hover { background: #171c25; }
.clients li.active { background: #1d2635; }
.clients .dot { width: 7px; height: 7px; border-radius: 50%; background: #454c5a; flex: none; }
.clients .dot.online { background: #35d07f; box-shadow: 0 0 8px rgba(53, 208, 127, .6); }
.clients .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clients .count { color: #8b93a1; font-size: 12px; }

.content { flex: 1; padding: 16px 20px; overflow: auto; min-width: 0; }
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; }
.toolbar input { flex: 1; max-width: 420px; }

table.files { width: 100%; border-collapse: collapse; }
table.files th, table.files td { text-align: left; padding: 10px 12px; border-bottom: 1px solid #1a1f28; }
table.files th { font-size: 12px; color: #8b93a1; font-weight: 500; }
table.files tbody tr:hover { background: #141922; }
table.files td.name { max-width: 420px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
table.files td.path { color: #8b93a1; font-size: 12px; }
table.files td a { color: #6f9bff; text-decoration: none; }
table.files td a:hover { text-decoration: underline; }
table.files td .row-actions { display: flex; gap: 6px; justify-content: flex-end; }
table.files td .row-actions button { padding: 4px 9px; font-size: 12px; }

.empty { padding: 60px 0; text-align: center; color: #8b93a1; }

.pager { display: flex; gap: 12px; align-items: center; justify-content: center; margin: 18px 0; }

/* ---------------------------------------------------------------- dialog + toast */

.dialog { position: fixed; inset: 0; background: rgba(6, 8, 12, .6); display: flex; align-items: center; justify-content: center; z-index: 60; }
.dialog-card { background: #151a22; border: 1px solid #262d3a; border-radius: 12px; padding: 22px; width: 360px; }
.dialog-card p { margin: 0 0 18px; line-height: 1.5; }
.dialog-actions { display: flex; gap: 10px; justify-content: flex-end; }

.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: #1d2530;
    border: 1px solid #2f3a49;
    padding: 10px 18px;
    border-radius: 10px;
    z-index: 70;
}
