/* ============================================================
   Prosting Admin – IONOS-inspired Design System
   ============================================================ */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    /* IONOS Brand */
    --ion-blue: #003d8f;
    --ion-blue-mid: #0050b3;
    --ion-blue-light: #e8f0fb;
    --ion-accent: #ff6900;

    /* Surfaces */
    --bg: #f4f6f9;
    --sf: #ffffff;
    --sf2: #f9fafb;
    --bo: #dde1e9;
    --bo2: #edf0f5;

    /* Text */
    --tx: #1a1d23;
    --tx2: #4a5568;
    --mu: #8a92a0;

    /* Status */
    --su: #00875a;
    --su-bg: #e3f9f0;
    --er: #c0392b;
    --er-bg: #fdecea;
    --wa: #d97706;
    --wa-bg: #fef3c7;
    --in: #0050b3;
    --in-bg: #e8f0fb;

    /* Radien & Schatten */
    --r-sm: 4px;
    --r: 6px;
    --r-lg: 10px;
    --sh: 0 1px 4px rgba(0, 0, 0, .08), 0 0 0 1px rgba(0, 0, 0, .04);
    --sh2: 0 4px 16px rgba(0, 0, 0, .12);

    /* Sidebar */
    --sb-w: 240px;
    --sb-bg: #001d4a;
    --sb-bg2: #003070;
    --sb-tx: #b8c8e0;
    --sb-tx-on: #ffffff;
}

/* ============================================================ BODY */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
    font-size: 14px;
    background: var(--bg);
    color: var(--tx);
    min-height: 100vh;
    line-height: 1.5;
}

/* ============================================================ LAYOUT */
.layout {
    display: flex;
    min-height: 100vh;
}

/* ── Sidebar ── */
.sidebar {
    width: var(--sb-w);
    background: var(--sb-bg);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 200;
    transition: transform .25s;
}

.sb-logo {
    padding: 20px 20px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
    display: flex;
    align-items: center;
    gap: 10px;
}

.sb-logo-mark {
    width: 32px;
    height: 32px;
    background: var(--ion-blue-mid);
    border-radius: var(--r);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    color: #fff;
    font-size: 15px;
    letter-spacing: -.5px;
}

.sb-logo-name {
    font-size: 15px;
    font-weight: 700;
    color: #fff;
}

.sb-logo-name em {
    color: var(--ion-accent);
    font-style: normal;
}

.sb-logo-badge {
    margin-left: auto;
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    background: var(--ion-accent);
    color: #fff;
    padding: 2px 6px;
    border-radius: 20px;
}

.sb-section {
    padding: 18px 14px 4px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: rgba(255, 255, 255, .28);
}

.sb-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 16px;
    color: var(--sb-tx);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    border-radius: 0;
    transition: background .15s, color .15s;
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}

.sb-link .ico {
    font-size: 15px;
    width: 20px;
    text-align: center;
    opacity: .75;
}

.sb-link:hover {
    background: rgba(255, 255, 255, .07);
    color: #fff;
}

.sb-link:hover .ico {
    opacity: 1;
}

.sb-link.on {
    background: var(--sb-bg2);
    color: var(--sb-tx-on);
    border-left: 3px solid var(--ion-accent);
}

.sb-link.on .ico {
    opacity: 1;
}

.sb-footer {
    margin-top: auto;
    padding: 14px;
    border-top: 1px solid rgba(255, 255, 255, .08);
}

.sb-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
}

.sb-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--ion-blue-mid);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: #fff;
    font-size: 13px;
    flex-shrink: 0;
    object-fit: cover;
}

.sb-user-info {
    flex: 1;
    min-width: 0;
}

.sb-user-name {
    font-size: 12px;
    font-weight: 600;
    color: #fff;
    truncate: ellipsis;
    white-space: nowrap;
    overflow: hidden;
}

.sb-user-role {
    font-size: 10px;
    color: var(--sb-tx);
    text-transform: uppercase;
    letter-spacing: .06em;
}

.sb-logout {
    background: none;
    border: 1px solid rgba(255, 255, 255, .15);
    color: var(--sb-tx);
    border-radius: var(--r-sm);
    padding: 6px 10px;
    font-size: 12px;
    cursor: pointer;
    transition: background .15s;
    text-decoration: none;
    display: block;
    text-align: center;
    margin-top: 8px;
}

.sb-logout:hover {
    background: rgba(255, 255, 255, .08);
    color: #fff;
}

/* ── Main ── */
.main {
    margin-left: var(--sb-w);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* ── Topbar ── */
.topbar {
    background: var(--sf);
    border-bottom: 1px solid var(--bo);
    padding: 0 28px;
    height: 56px;
    display: flex;
    align-items: center;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.topbar-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--tx);
}

.topbar-sub {
    font-size: 12px;
    color: var(--mu);
    margin-left: 4px;
}

.topbar-spacer {
    flex: 1;
}

.topbar-badge {
    background: var(--in-bg);
    color: var(--in);
    font-size: 11px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 20px;
}

.mobile-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--tx2);
    font-size: 20px;
}

/* ── Content ── */
.content {
    padding: 28px;
    flex: 1;
}

.page-header {
    margin-bottom: 24px;
}

.page-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--tx);
}

.page-desc {
    font-size: 13px;
    color: var(--mu);
    margin-top: 4px;
}

/* ============================================================ CARDS */
.card {
    background: var(--sf);
    border: 1px solid var(--bo);
    border-radius: var(--r-lg);
    box-shadow: var(--sh);
    margin-bottom: 20px;
    overflow: hidden;
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--bo2);
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--tx);
}

.card-subtitle {
    font-size: 12px;
    color: var(--mu);
}

.card-body {
    padding: 20px;
}

.card-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--bo2);
    background: var(--sf2);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ============================================================ STAT GRID */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--sf);
    border: 1px solid var(--bo);
    border-radius: var(--r-lg);
    padding: 20px;
    box-shadow: var(--sh);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--ion-blue-mid);
}

.stat-card.er::before {
    background: var(--er);
}

.stat-card.wa::before {
    background: var(--wa);
}

.stat-card.su::before {
    background: var(--su);
}

.stat-val {
    font-size: 28px;
    font-weight: 800;
    color: var(--ion-blue);
    line-height: 1;
}

.stat-card.er .stat-val {
    color: var(--er);
}

.stat-card.wa .stat-val {
    color: var(--wa);
}

.stat-card.su .stat-val {
    color: var(--su);
}

.stat-lbl {
    font-size: 11px;
    font-weight: 600;
    color: var(--mu);
    margin-top: 6px;
    text-transform: uppercase;
    letter-spacing: .06em;
}

.stat-ico {
    position: absolute;
    right: 16px;
    top: 16px;
    font-size: 22px;
    opacity: .18;
}

/* ============================================================ TABS */
.tabs {
    display: flex;
    gap: 2px;
    border-bottom: 2px solid var(--bo);
    margin-bottom: 24px;
}

.tab-btn {
    padding: 10px 18px;
    font-size: 13px;
    font-weight: 600;
    color: var(--tx2);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: color .15s;
    white-space: nowrap;
}

.tab-btn:hover {
    color: var(--ion-blue-mid);
}

.tab-btn.on {
    color: var(--ion-blue);
    border-bottom-color: var(--ion-blue);
}

.tab-pane {
    display: none;
}

.tab-pane.on {
    display: block;
}

/* ============================================================ TABLE */
.tbl-wrap {
    overflow-x: auto;
}

table.tbl {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

table.tbl th {
    text-align: left;
    padding: 10px 14px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--mu);
    background: var(--sf2);
    border-bottom: 1px solid var(--bo);
    white-space: nowrap;
}

table.tbl td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--bo2);
    vertical-align: middle;
    color: var(--tx2);
}

table.tbl tr:last-child td {
    border-bottom: none;
}

table.tbl tbody tr:hover td {
    background: #f7f9fc;
}

.tbl-empty {
    text-align: center;
    color: var(--mu);
    padding: 32px 0;
    font-size: 13px;
}

/* ============================================================ BADGES */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .02em;
}

.badge-blue {
    background: var(--in-bg);
    color: var(--in);
}

.badge-green {
    background: var(--su-bg);
    color: var(--su);
}

.badge-red {
    background: var(--er-bg);
    color: var(--er);
}

.badge-orange {
    background: var(--wa-bg);
    color: var(--wa);
}

.badge-gray {
    background: var(--bo2);
    color: var(--tx2);
}

/* ============================================================ BUTTONS */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--r);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: background .15s, box-shadow .15s;
    text-decoration: none;
    white-space: nowrap;
}

.btn:disabled {
    opacity: .5;
    cursor: not-allowed;
}

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

.btn-primary:hover:not(:disabled) {
    background: var(--ion-blue-mid);
}

.btn-secondary {
    background: var(--sf);
    color: var(--tx2);
    border: 1px solid var(--bo);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--sf2);
}

.btn-danger {
    background: var(--er-bg);
    color: var(--er);
    border: 1px solid #fca5a5;
}

.btn-danger:hover:not(:disabled) {
    background: var(--er);
    color: #fff;
}

.btn-sm {
    padding: 5px 12px;
    font-size: 12px;
}

.btn-xs {
    padding: 3px 8px;
    font-size: 11px;
}

.btn-icon {
    padding: 6px;
    width: 32px;
    height: 32px;
}

/* ============================================================ FORM */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--tx2);
    margin-bottom: 5px;
}

.form-input, .form-select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--bo);
    border-radius: var(--r);
    font-size: 13px;
    color: var(--tx);
    background: var(--sf);
    transition: border-color .15s, box-shadow .15s;
    outline: none;
}

.form-input:focus, .form-select:focus {
    border-color: var(--ion-blue-mid);
    box-shadow: 0 0 0 3px rgba(0, 80, 179, .12);
}

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%238a92a0' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 28px;
}

/* ============================================================ ALERTS */
.alert {
    padding: 12px 16px;
    border-radius: var(--r);
    font-size: 13px;
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 16px;
}

.alert-err {
    background: var(--er-bg);
    color: var(--er);
    border: 1px solid #fca5a5;
}

.alert-ok {
    background: var(--su-bg);
    color: var(--su);
    border: 1px solid #6ee7b7;
}

.alert-info {
    background: var(--in-bg);
    color: var(--in);
    border: 1px solid #93c5fd;
}

/* ============================================================ TOASTS */
#tc {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-end;
}

.toast {
    background: var(--tx);
    color: #fff;
    padding: 10px 16px;
    border-radius: var(--r);
    font-size: 13px;
    font-weight: 500;
    box-shadow: var(--sh2);
    max-width: 340px;
    animation: slide-in .2s ease;
}

.toast.ok {
    background: var(--su);
}

.toast.err {
    background: var(--er);
}

.toast.wa {
    background: var(--wa);
}

@keyframes slide-in {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ============================================================ PAGINATION */
.pagination {
    display: flex;
    align-items: center;
    gap: 8px;
}

.page-info {
    font-size: 12px;
    color: var(--mu);
}

/* ============================================================ TOOLBAR */
.toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.toolbar-spacer {
    flex: 1;
}

/* ============================================================ SPINNER */
.spin {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin .6s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ============================================================ LOGIN PAGE */
.login-layout {
    min-height: 100vh;
    display: flex;
    background: linear-gradient(135deg, var(--ion-blue) 0%, var(--ion-blue-mid) 60%, #0066cc 100%);
}

.login-left {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: #fff;
}

.login-logo {
    font-size: 36px;
    font-weight: 800;
    letter-spacing: -.04em;
    margin-bottom: 12px;
}

.login-logo em {
    color: var(--ion-accent);
    font-style: normal;
}

.login-tagline {
    font-size: 16px;
    opacity: .8;
    max-width: 320px;
    text-align: center;
    line-height: 1.6;
}

.login-features {
    margin-top: 40px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.login-feature {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    opacity: .85;
}

.login-feature-ico {
    font-size: 20px;
}

.login-right {
    width: 440px;
    flex-shrink: 0;
    background: var(--sf);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px 40px;
}

.login-box {
    width: 100%;
}

.login-box-title {
    font-size: 22px;
    font-weight: 800;
    color: var(--tx);
    margin-bottom: 6px;
}

.login-box-sub {
    font-size: 13px;
    color: var(--mu);
    margin-bottom: 32px;
}

.login-divider {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 24px 0;
}

.login-divider::before, .login-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--bo);
}

.login-divider span {
    font-size: 11px;
    color: var(--mu);
    font-weight: 600;
    text-transform: uppercase;
}

.btn-google {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 12px 20px;
    border: 1.5px solid var(--bo);
    border-radius: var(--r);
    background: var(--sf);
    font-size: 14px;
    font-weight: 600;
    color: var(--tx);
    cursor: pointer;
    text-decoration: none;
    transition: box-shadow .15s, border-color .15s;
}

.btn-google:hover {
    border-color: #93c5fd;
    box-shadow: 0 2px 8px rgba(0, 80, 179, .12);
}

.btn-google svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.login-admin-notice {
    margin-top: 24px;
    padding: 12px 14px;
    background: var(--in-bg);
    border-radius: var(--r);
    font-size: 12px;
    color: var(--in);
    display: flex;
    gap: 8px;
}

.login-footer {
    margin-top: 32px;
    font-size: 11px;
    color: var(--mu);
    text-align: center;
}

/* ============================================================ MODAL */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    display: none;
}

.modal-overlay.open {
    display: flex;
}

.modal {
    background: var(--sf);
    border-radius: var(--r-lg);
    box-shadow: var(--sh2);
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 28px;
    position: relative;
}

.modal-title {
    font-size: 17px;
    font-weight: 700;
    margin-bottom: 20px;
    color: var(--tx);
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--mu);
    font-size: 20px;
    line-height: 1;
}

.modal-close:hover {
    color: var(--tx);
}

/* ============================================================ MOBILE */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
        box-shadow: var(--sh2);
    }

    .main {
        margin-left: 0;
    }

    .mobile-toggle {
        display: flex;
    }

    .content {
        padding: 16px;
    }

    .login-left {
        display: none;
    }

    .login-right {
        width: 100%;
    }

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

