:root {
    --bg: #0f1420;
    --surface: #1a2130;
    --surface-2: #232c3d;
    --border: #2f3a4f;
    --text: #e6ebf2;
    --muted: #94a3b8;
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --danger: #ef4444;
    --success: #22c55e;
    --warning: #f59e0b;
    --radius: 10px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding-bottom: 56px;
    font-family: "Segoe UI", Roboto, system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
}

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

a:hover {
    text-decoration: underline;
}

h1, h2, h3 {
    line-height: 1.25;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.site-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 10;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 60px;
    flex-wrap: wrap;
}

.brand {
    font-weight: 700;
    font-size: 18px;
    color: var(--text);
}

.brand:hover {
    text-decoration: none;
}

.nav {
    display: flex;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
}

.nav a {
    color: var(--muted);
    font-weight: 500;
}

.nav a:hover {
    color: var(--text);
    text-decoration: none;
}

.nav-user {
    color: var(--muted);
    font-size: 14px;
}

.inline-form {
    display: inline;
    margin: 0;
}

.main {
    flex: 1 0 auto;
    padding: 32px 20px 48px;
    overflow-x: auto;
}

.site-footer {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10;
    border-top: 1px solid var(--border);
    background: var(--surface);
    color: var(--muted);
    font-size: 13px;
    padding: 16px 0;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 20px;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    font-size: 15px;
    font-weight: 600;
    border: 1px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: background .15s, border-color .15s, color .15s;
    color: var(--text);
    background: var(--surface-2);
}

.btn:hover {
    text-decoration: none;
}

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

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

.btn-ghost {
    background: transparent;
    border-color: var(--border);
    color: var(--muted);
    padding: 6px 14px;
    font-size: 14px;
}

.btn-ghost:hover {
    color: var(--text);
    border-color: var(--muted);
}

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

.btn-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin: 20px 0;
}

.form-row {
    margin-bottom: 16px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-width: 320px;
}

.field label {
    font-size: 14px;
    color: var(--muted);
}

input[type="text"],
input[type="password"],
input[type="email"],
input:not([type]),
textarea {
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface-2);
    color: var(--text);
    font-size: 15px;
    width: 100%;
}

textarea {
    font-family: inherit;
    resize: vertical;
    min-height: 76px;
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="email"]:focus,
input:not([type]):focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.validation,
.error {
    color: var(--danger);
    font-size: 14px;
}

.muted {
    color: var(--muted);
}

.server-desc {
    font-size: 13px;
    line-height: 1.4;
    margin-top: 4px;
    white-space: pre-wrap;
    word-break: break-word;
    padding: 8px 10px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 8px;
}

.server-desc-line {
    font-size: 12px;
    font-weight: 400;
    margin-top: 4px;
    white-space: pre-wrap;
    max-width: 320px;
}

.install-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 14px;
    max-width: 780px;
    margin-bottom: 20px;
}

.install-form .validation {
    grid-column: 1 / -1;
}

.install-form .field {
    max-width: none;
}

.install-actions {
    grid-column: 1 / -1;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 4px;
}

.install-form .install-ack {
    grid-column: 1 / -1;
    border: 1px solid var(--warning);
    border-radius: 8px;
    padding: 10px 12px;
    background: rgba(245, 158, 11, .08);
}

.install-form .install-ack label {
    color: var(--text);
}

.install-log {
    max-height: 340px;
    overflow: auto;
}

.status-box,
pre.output {
    background: #0b0f18;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 14px;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-word;
    font-family: Consolas, "Courier New", monospace;
    font-size: 13px;
    color: #cbd5e1;
}

code {
    background: var(--surface-2);
    padding: 2px 8px;
    border-radius: 6px;
    font-family: Consolas, "Courier New", monospace;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 12px;
}

th, td {
    text-align: left;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}

th {
    color: var(--muted);
    font-weight: 600;
}

.tag {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}

.tag-ok {
    background: rgba(34, 197, 94, .15);
    color: var(--success);
}

.tag-pending {
    background: rgba(245, 158, 11, .15);
    color: var(--warning);
}

.tag-danger {
    background: rgba(239, 68, 68, .15);
    color: var(--danger);
}

.notice {
    padding: 12px 16px;
    border-radius: 8px;
    margin: 16px 0;
    font-size: 14px;
}

.notice-warning {
    background: rgba(245, 158, 11, .12);
    border: 1px solid rgba(245, 158, 11, .4);
    color: var(--warning);
}

.section-title {
    margin-top: 32px;
}

.quota {
    display: inline-block;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 16px;
    margin: 12px 0;
    font-size: 14px;
}

.create-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    align-items: start;
}

.create-form .validation {
    grid-column: 1 / -1;
}

.create-form .field {
    max-width: none;
}

.btn-small {
    padding: 5px 10px;
    font-size: 13px;
    font-weight: 500;
}

.actions {
    display: flex;
    gap: 6px;
    flex-wrap: nowrap;
    justify-content: flex-start;
}

td.actions {
    white-space: nowrap;
}

.actions .inline-form {
    display: inline;
}

.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .6);
    z-index: 50;
    align-items: center;
    justify-content: center;
}

.modal-body {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 20px;
    text-align: center;
}

.modal-body h3 {
    margin: 0 0 12px;
    font-size: 16px;
}

.modal-body img {
    background: #fff;
    border-radius: 8px;
    padding: 6px;
    display: block;
    margin: 0 auto 12px;
    width: 180px;
    height: 180px;
}

.tabs {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin: 16px 0 24px;
    border-bottom: 1px solid var(--border);
}

.tab {
    display: inline-block;
    padding: 10px 16px;
    color: var(--muted);
    font-weight: 600;
    font-size: 14px;
    border: 1px solid transparent;
    border-bottom: 2px solid transparent;
    border-radius: 8px 8px 0 0;
    margin-bottom: -1px;
}

.tab:hover {
    color: var(--text);
    text-decoration: none;
}

.tab.active {
    color: var(--text);
    border-color: var(--border);
    border-bottom-color: var(--primary);
    background: var(--surface);
}

tr.row-selected {
    background: rgba(59, 130, 246, .12);
}

.invite-new {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 14px 16px;
    margin-bottom: 16px;
}

.invite-link {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-top: 6px;
    max-width: 620px;
}

.invite-link input {
    flex: 1;
    font-size: 13px;
}

.pagination {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 16px;
    font-size: 14px;
}

.pagination a,
.pagination span {
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
}

.pagination span.disabled {
    color: var(--muted);
    opacity: .5;
}

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

.quota-form input[type="number"] {
    width: 90px;
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface-2);
    color: var(--text);
}

input[type="number"],
select,
input[type="date"] {
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface-2);
    color: var(--text);
    font-size: 15px;
    width: 100%;
}

select:focus,
input[type="number"]:focus,
input[type="date"]:focus {
    outline: none;
    border-color: var(--primary);
}

.server-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
    max-width: 420px;
    margin-bottom: 24px;
}

.field-check label {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text);
    font-size: 14px;
}

.field-check input[type="checkbox"] {
    width: auto;
}
