* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    background: #f3f4f6;
    color: #111827;
}

a {
    color: inherit;
}

.login-body {
    background: #111827;
}

.login-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.login-card {
    width: 100%;
    max-width: 430px;
    background: white;
    border-radius: 14px;
    padding: 34px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25);
}

.login-card h1 {
    margin: 0 0 8px;
    font-size: 40px;
}

.login-subtitle {
    margin: 0 0 24px;
    color: #6b7280;
}

.login-form {
    display: grid;
    gap: 10px;
}

.login-form label {
    font-weight: bold;
    color: #374151;
}

.login-form input {
    width: 100%;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 11px 12px;
    font-size: 16px;
}

.login-form button,
.logout-button {
    border: 0;
    cursor: pointer;
    font-weight: bold;
}

.login-form button {
    margin-top: 10px;
    background: #2563eb;
    color: white;
    border-radius: 8px;
    padding: 12px 14px;
    font-size: 16px;
}

.alert-error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
    border-radius: 8px;
    padding: 11px 12px;
    margin-bottom: 18px;
    font-weight: bold;
}

.topbar {
    background: #111827;
    color: white;
    padding: 22px 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.eyebrow {
    color: #60a5fa;
    font-size: 12px;
    font-weight: bold;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 6px;
}

.topbar h1 {
    margin: 0;
    font-size: 30px;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.topbar-meta {
    color: #d1d5db;
    font-weight: bold;
}

.logout-button {
    background: #374151;
    color: white;
    padding: 9px 12px;
    border-radius: 8px;
}

.small-link {
    color: white;
    text-decoration: none;
    background: #2563eb;
    padding: 9px 12px;
    border-radius: 8px;
    font-weight: bold;
}

.shell {
    max-width: 1180px;
    margin: 0 auto;
    padding: 28px;
}

.section-heading {
    margin-bottom: 20px;
}

.section-heading h2 {
    margin: 0 0 6px;
    font-size: 28px;
}

.section-heading p {
    margin: 0;
    color: #6b7280;
}

.nest-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 18px;
}

.nest-card {
    display: block;
    text-decoration: none;
    background: white;
    border-radius: 14px;
    padding: 22px;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
    border: 1px solid #e5e7eb;
}

.nest-card:hover {
    border-color: #2563eb;
}

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

.nest-card h3 {
    margin: 0;
    font-size: 22px;
}

.nest-description {
    margin: 0 0 20px;
    color: #6b7280;
}

.status-pill {
    display: inline-block;
    background: #e0f2fe;
    color: #075985;
    border-radius: 999px;
    padding: 5px 9px;
    font-size: 12px;
    font-weight: bold;
    white-space: nowrap;
}

.status-hashing {
    background: #dcfce7;
    color: #166534;
}

.status-offline {
    background: #fee2e2;
    color: #991b1b;
}

.status-unknown {
    background: #fef3c7;
    color: #92400e;
}

.metric-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-bottom: 18px;
}

.metric-label {
    color: #6b7280;
    font-size: 13px;
    margin-bottom: 4px;
}

.metric-value {
    font-size: 24px;
    font-weight: bold;
}

.card-footer {
    border-top: 1px solid #e5e7eb;
    padding-top: 14px;
    color: #6b7280;
    font-size: 13px;
}

.table-card {
    background: white;
    border-radius: 14px;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
    overflow-x: auto;
    border: 1px solid #e5e7eb;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 13px 14px;
    border-bottom: 1px solid #e5e7eb;
    text-align: left;
    white-space: nowrap;
}

th {
    background: #f9fafb;
    color: #374151;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

td {
    color: #111827;
}

.empty-state {
    background: white;
    border-radius: 14px;
    padding: 30px;
    color: #6b7280;
    border: 1px solid #e5e7eb;
}

@media (max-width: 700px) {
    .topbar {
        align-items: flex-start;
        flex-direction: column;
        gap: 12px;
    }

    .topbar-actions {
        align-items: flex-start;
        flex-direction: column;
    }

    .shell {
        padding: 18px;
    }
}

.admin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 18px;
}

.admin-card {
    display: block;
    text-decoration: none;
    background: white;
    border-radius: 14px;
    padding: 22px;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
    border: 1px solid #e5e7eb;
}

.admin-card:hover {
    border-color: #2563eb;
}

.admin-card h3 {
    margin: 0 0 8px;
    font-size: 22px;
}

.admin-card p {
    margin: 0;
    color: #6b7280;
}

.form-card {
    background: white;
    border-radius: 14px;
    padding: 22px;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
    border: 1px solid #e5e7eb;
    margin-bottom: 22px;
}

.form-card h3 {
    margin: 0 0 18px;
    font-size: 22px;
}

.admin-form {
    display: grid;
    gap: 10px;
}

.admin-form label {
    font-weight: bold;
    color: #374151;
}

.admin-form input,
.admin-form textarea,
.admin-form select {
    width: 100%;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 11px 12px;
    font-size: 16px;
    font-family: Arial, Helvetica, sans-serif;
}

.admin-form button {
    margin-top: 10px;
    border: 0;
    cursor: pointer;
    background: #2563eb;
    color: white;
    border-radius: 8px;
    padding: 12px 14px;
    font-size: 16px;
    font-weight: bold;
    width: fit-content;
}

.table-link {
    color: #2563eb;
    font-weight: bold;
    text-decoration: none;
}

.table-link:hover {
    text-decoration: underline;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
}

.form-grid > div {
    display: grid;
    gap: 8px;
}

.inline-form {
    display: inline;
}

.inline-form button {
    border: 0;
    cursor: pointer;
    background: #2563eb;
    color: white;
    border-radius: 8px;
    padding: 8px 10px;
    font-weight: bold;
}

.muted {
    color: #6b7280;
}

.topbar {
    background: #111827;
    color: white;
    padding: 18px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.topbar-brand {
    display: grid;
    gap: 4px;
}

.brand-subtitle {
    color: #60a5fa;
    font-size: 12px;
    font-weight: bold;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.topbar h1 {
    margin: 0;
    font-size: 30px;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.topbar-button,
.client-switcher button {
    border: 1px solid rgba(255, 255, 255, 0.2);
    cursor: pointer;
    text-decoration: none;
    font-weight: bold;
    border-radius: 8px;
    padding: 10px 13px;
    line-height: 1;
    display: inline-block;
}

.topbar-button-primary {
    background: #2563eb;
    color: white;
}

.topbar-button-secondary {
    background: #374151;
    color: white;
}

.topbar-button:hover,
.client-switcher button:hover {
    filter: brightness(1.08);
}

.topbar-role {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.14);
    color: #f9fafb;
    border-radius: 8px;
    padding: 9px 12px;
    font-weight: bold;
}

.client-switcher {
    display: flex;
    align-items: center;
    gap: 7px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 10px;
    padding: 7px;
}

.client-switcher label {
    font-size: 12px;
    font-weight: bold;
    color: #d1d5db;
}

.client-switcher input,
.client-switcher select {
    border: 1px solid #4b5563;
    background: white;
    color: #111827;
    border-radius: 7px;
    padding: 8px 9px;
    font-size: 14px;
}

.client-switcher input {
    width: 150px;
}

.client-switcher select {
    min-width: 170px;
}

.client-switcher button {
    background: #2563eb;
    color: white;
}

@media (max-width: 900px) {
    .topbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .topbar-actions {
        justify-content: flex-start;
    }

    .client-switcher {
        align-items: flex-start;
        flex-direction: column;
    }
}

.brand-subtitle {
    color: #60a5fa;
    font-size: 13px;
    font-weight: bold;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.topbar-button,
.client-switcher button {
    border: 1px solid rgba(255, 255, 255, 0.25);
    cursor: pointer;
    text-decoration: none;
    font-weight: bold;
    border-radius: 8px;
    padding: 10px 14px;
    line-height: 1;
    display: inline-block;
    white-space: nowrap;
}

.topbar-button-primary {
    background: #2563eb;
    color: white;
}

.topbar-button-super {
    background: #7c3aed;
    color: white;
}

.topbar-button-secondary {
    background: #374151;
    color: white;
}

.client-switcher {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 10px;
    padding: 7px;
}

.client-switcher label {
    font-size: 12px;
    font-weight: bold;
    color: #d1d5db;
}

.client-switcher select {
    border: 1px solid #4b5563;
    background: white;
    color: #111827;
    border-radius: 7px;
    padding: 8px 9px;
    font-size: 14px;
    min-width: 190px;
}

.client-switcher button {
    background: #2563eb;
    color: white;
}

.topbar-button:hover,
.client-switcher button:hover {
    filter: brightness(1.08);
}

.topbar-button-super {
    background: #7c3aed;
    color: white;
}

.compact-form-card {
    max-width: 1120px;
}

.form-help {
    margin: 14px 0 0;
    color: #6b7280;
    font-size: 14px;
}

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

.inline-reset-form input {
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 8px 9px;
    font-size: 14px;
    width: 180px;
}

.inline-reset-form button,
.permission-user-card button {
    border: 0;
    cursor: pointer;
    background: #2563eb;
    color: white;
    border-radius: 8px;
    padding: 9px 11px;
    font-weight: bold;
    white-space: nowrap;
}

.permission-summary {
    display: block;
    max-width: 360px;
    white-space: normal;
    line-height: 1.4;
    color: #374151;
}

.permission-user-grid {
    display: grid;
    gap: 18px;
}

.permission-user-card {
    background: white;
    border-radius: 14px;
    padding: 22px;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
    border: 1px solid #e5e7eb;
}

.permission-user-header {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: flex-start;
    border-bottom: 1px solid #e5e7eb;
    padding-bottom: 14px;
    margin-bottom: 16px;
}

.permission-user-header h3 {
    margin: 0 0 4px;
}

.permission-user-header p {
    margin: 0;
    color: #6b7280;
}

.role-badge {
    background: #eef2ff;
    color: #3730a3;
    border-radius: 999px;
    padding: 7px 10px;
    font-size: 12px;
    font-weight: bold;
    white-space: nowrap;
}

.topbar-button-super {
    background: #7c3aed;
    color: white;
}

.form-grid-clean {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    align-items: end;
}

.temp-password-card {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: center;
    background: #ecfdf5;
    color: #064e3b;
    border: 1px solid #a7f3d0;
    border-radius: 14px;
    padding: 18px 22px;
    margin-bottom: 22px;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.06);
}

.temp-password-card h3 {
    margin: 0 0 6px;
}

.temp-password-card p {
    margin: 0;
}

.copy-input-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.copy-input-row input {
    border: 1px solid #10b981;
    border-radius: 8px;
    padding: 10px 12px;
    min-width: 230px;
    font-weight: bold;
}

.copy-input-row button,
.table-action-button {
    border: 0;
    cursor: pointer;
    background: #2563eb;
    color: white;
    border-radius: 8px;
    padding: 10px 12px;
    font-weight: bold;
    white-space: nowrap;
}

.permissions-list {
    display: grid;
    gap: 22px;
}

.permissions-card {
    background: white;
    border-radius: 14px;
    padding: 22px;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
    border: 1px solid #e5e7eb;
}

.permissions-card-header {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: flex-start;
    border-bottom: 1px solid #e5e7eb;
    padding-bottom: 14px;
    margin-bottom: 16px;
}

.permissions-card-header h3 {
    margin: 0 0 4px;
}

.permissions-card-header p {
    margin: 0;
    color: #6b7280;
}

.permissions-checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 12px;
}

.permission-checkbox-card {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 12px;
}

.permission-checkbox-card input {
    margin-top: 4px;
    width: auto;
}

.permission-checkbox-card span {
    display: grid;
    gap: 4px;
}

.permission-checkbox-card strong {
    color: #111827;
}

.permission-checkbox-card small {
    color: #6b7280;
    line-height: 1.35;
}

.permissions-card-footer {
    border-top: 1px solid #e5e7eb;
    margin-top: 16px;
    padding-top: 16px;
}

.permissions-card-footer button {
    border: 0;
    cursor: pointer;
    background: #2563eb;
    color: white;
    border-radius: 8px;
    padding: 11px 14px;
    font-weight: bold;
}

@media (max-width: 800px) {
    .temp-password-card,
    .copy-input-row {
        align-items: stretch;
        flex-direction: column;
    }

    .copy-input-row input {
        min-width: 0;
        width: 100%;
    }
}

.copy-input-row-wide {
    align-items: stretch;
}

.copy-input-row-wide textarea {
    border: 1px solid #10b981;
    border-radius: 8px;
    padding: 10px 12px;
    min-width: 360px;
    min-height: 120px;
    font-weight: bold;
    font-family: Arial, Helvetica, sans-serif;
    resize: vertical;
}

.danger-button {
    background: #dc2626;
}

.user-select-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 14px;
    margin-bottom: 22px;
}

.user-select-card {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
    text-decoration: none;
    background: white;
    border-radius: 14px;
    padding: 18px;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
    border: 1px solid #e5e7eb;
}

.user-select-card:hover,
.user-select-card.selected {
    border-color: #2563eb;
}

.user-select-card h3 {
    margin: 0 0 5px;
    font-size: 18px;
}

.user-select-card p {
    margin: 0;
    color: #6b7280;
}

.permissions-editor-card {
    background: white;
    border-radius: 14px;
    padding: 22px;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
    border: 1px solid #e5e7eb;
}

@media (max-width: 800px) {
    .copy-input-row-wide textarea {
        min-width: 0;
        width: 100%;
    }
}
