:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #eff6ff;

    --sidebar-bg: #111827;
    --sidebar-hover: #1f2937;
    --sidebar-active: #243244;

    --body-bg: #f4f6f9;
    --card-bg: #ffffff;

    --text-main: #111827;
    --text-muted: #6b7280;
    --text-soft: #9ca3af;

    --border: #e5e7eb;
    --border-dark: #d1d5db;

    --success: #16a34a;
    --warning: #d97706;
    --danger: #dc2626;

    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 16px;

    --shadow: 0 8px 20px rgba(15, 23, 42, 0.06);
}

* {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
}

body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    background: var(--body-bg);
    color: var(--text-main);
    font-size: 14px;
}

a {
    text-decoration: none;
    color: var(--primary);
}

button,
input,
select,
textarea {
    font-family: inherit;
}

/* Layout */
.admin-wrapper {
    display: flex;
    min-height: 100vh;
}

.admin-sidebar {
    width: 270px;
    background: var(--sidebar-bg);
    color: #ffffff;
    position: fixed;
    inset: 0 auto 0 0;
    padding: 22px 16px;
    z-index: 1000;
    transition: transform .25s ease;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 8px 22px;
    margin-bottom: 14px;
    border-bottom: 1px solid rgba(255,255,255,.08);
}

.brand-icon {
    width: 42px;
    height: 42px;
    border-radius: 13px;
    background: var(--primary);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    letter-spacing: .4px;
    flex: 0 0 42px;
}

.brand-text strong,
.auth-logo strong {
    display: block;
    font-size: 15px;
    line-height: 1.2;
}

.brand-text span,
.auth-logo span {
    display: block;
    font-size: 12px;
    color: #cbd5e1;
    margin-top: 3px;
}

.sidebar-menu {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.menu-link {
    display: flex;
    align-items: center;
    min-height: 42px;
    padding: 11px 14px;
    border-radius: 12px;
    color: #e5e7eb;
    font-size: 14px;
    transition: background .18s ease, color .18s ease;
}

.menu-link:hover {
    background: var(--sidebar-hover);
    color: #ffffff;
}

.menu-link.active {
    background: var(--sidebar-active);
    color: #ffffff;
    font-weight: 700;
}

.admin-main {
    margin-left: 270px;
    width: calc(100% - 270px);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.admin-topbar {
    min-height: 78px;
    background: #ffffff;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 26px;
    position: sticky;
    top: 0;
    z-index: 900;
}

.sidebar-toggle {
    display: none;
    border: 1px solid var(--border);
    background: #ffffff;
    border-radius: 10px;
    padding: 8px 11px;
    cursor: pointer;
    font-size: 18px;
}

.topbar-title {
    flex: 1;
    min-width: 0;
}

.topbar-title h1 {
    margin: 0;
    font-size: 22px;
    line-height: 1.15;
}

.topbar-title p {
    margin: 5px 0 0;
    font-size: 13px;
    color: var(--text-muted);
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    white-space: nowrap;
}

.logout-btn {
    border: none;
    background: #fee2e2;
    color: #991b1b;
    padding: 9px 12px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 700;
}

.logout-btn:hover {
    background: #fecaca;
}

.admin-content {
    flex: 1;
    padding: 22px 26px;
}

.admin-footer {
    border-top: 1px solid var(--border);
    background: #ffffff;
    padding: 14px 26px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: var(--text-muted);
    font-size: 12px;
}

/* Alerts */
.alert {
    padding: 12px 14px;
    border-radius: 12px;
    margin-bottom: 16px;
    font-size: 13px;
    line-height: 1.45;
}

.alert-success {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.alert-danger {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

/* Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 16px;
}

.stat-card,
.panel-card,
.table-card,
.form-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

.stat-card {
    padding: 17px 18px;
}

.stat-card span {
    display: block;
    color: var(--text-muted);
    font-size: 13px;
    margin-bottom: 8px;
}

.stat-card strong {
    display: block;
    font-size: 26px;
    line-height: 1;
}

.panel-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(280px, .8fr);
    gap: 16px;
}

.panel-card {
    padding: 20px;
}

.panel-header h2,
.card-title {
    margin: 0 0 7px;
    font-size: 18px;
    line-height: 1.25;
}

.panel-header p,
.muted-text {
    margin: 0;
    color: var(--text-muted);
    font-size: 13px;
    line-height: 1.45;
}

.quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
}

/* Buttons */
.page-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
}

.primary-btn,
.secondary-btn,
.small-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    cursor: pointer;
    line-height: 1;
    border: 1px solid transparent;
    text-decoration: none;
    white-space: nowrap;
}

.primary-btn {
    background: var(--primary);
    color: #ffffff;
    padding: 11px 14px;
    font-size: 14px;
    font-weight: 700;
    border-color: var(--primary);
}

.primary-btn:hover {
    background: var(--primary-dark);
    color: #ffffff;
}

.secondary-btn {
    background: #ffffff;
    color: var(--text-main);
    padding: 11px 14px;
    font-size: 14px;
    font-weight: 700;
    border-color: var(--border-dark);
}

.secondary-btn:hover {
    background: #f9fafb;
}

.small-btn {
    background: #ffffff;
    color: var(--text-main);
    padding: 7px 9px;
    font-size: 12px;
    font-weight: 700;
    border-color: var(--border-dark);
}

.small-btn:hover {
    background: #f9fafb;
}

.small-btn.danger {
    color: var(--danger);
    border-color: #fecaca;
    background: #fff7f7;
}

.primary-btn:disabled,
.secondary-btn:disabled {
    opacity: .45;
    cursor: not-allowed;
}

/* Tables */
.table-card {
    padding: 0;
    overflow: hidden;
}

.table-responsive {
    width: 100%;
    overflow-x: auto;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 860px;
}

.admin-table th {
    text-align: left;
    font-size: 12px;
    color: var(--text-muted);
    background: #f9fafb;
    border-bottom: 1px solid var(--border);
    padding: 12px 14px;
    white-space: nowrap;
}

.admin-table td {
    border-bottom: 1px solid var(--border);
    padding: 12px 14px;
    font-size: 13px;
    vertical-align: middle;
}

.admin-table tr:last-child td {
    border-bottom: none;
}

.admin-table td strong {
    font-weight: 800;
}

.admin-table td small {
    display: block;
    margin-top: 4px;
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.35;
}

.text-right {
    text-align: right;
}

.inline-form {
    display: inline-flex;
    margin-left: 5px;
}

.empty-table {
    text-align: center;
    color: var(--text-muted);
    padding: 28px 14px !important;
}

/* Badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    padding: 5px 9px;
    font-size: 11px;
    font-weight: 800;
    min-width: 58px;
}

.status-badge.active {
    background: #dcfce7;
    color: #166534;
}

.status-badge.passive,
.status-badge.pending {
    background: #fef3c7;
    color: #92400e;
}

.status-badge.suspended,
.status-badge.cancelled,
.status-badge.expired {
    background: #fee2e2;
    color: #991b1b;
}

/* Forms */
.form-card {
    padding: 20px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px 16px;
}

.form-group {
    margin: 0;
}

.form-group.full {
    grid-column: 1 / -1;
}

.form-group label {
    display: block;
    font-size: 12px;
    font-weight: 800;
    margin-bottom: 6px;
    color: #374151;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    border: 1px solid var(--border-dark);
    border-radius: 10px;
    padding: 10px 11px;
    font-size: 13px;
    outline: none;
    background: #ffffff;
    color: var(--text-main);
}

.form-group textarea {
    resize: vertical;
    min-height: 82px;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .10);
}

.form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.checkbox-label {
    display: inline-flex !important;
    align-items: center;
    gap: 7px;
    margin: 0;
    color: var(--text-main);
}

.checkbox-label input {
    width: auto;
}

code {
    background: #eef2ff;
    color: #1e40af;
    padding: 3px 6px;
    border-radius: 7px;
    font-size: 12px;
}

/* Pagination */
.pagination-wrap {
    padding: 12px 14px;
    border-top: 1px solid var(--border);
}

nav[role="navigation"] {
    font-size: 13px;
}

nav[role="navigation"] .flex {
    gap: 6px;
}

/* Auth */
.auth-body {
    min-height: 100vh;
    background: linear-gradient(135deg, #eef2ff, #f8fafc);
}

.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 22px;
    box-shadow: var(--shadow);
    padding: 28px;
}

.auth-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 22px;
}

.auth-logo span {
    color: var(--text-muted);
}

.auth-card h1 {
    margin: 0 0 8px;
    font-size: 24px;
}

.auth-card p {
    margin: 0 0 20px;
    color: var(--text-muted);
    font-size: 13px;
}

.form-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    font-size: 13px;
    margin-bottom: 16px;
}

.primary-btn.full {
    width: 100%;
}

.auth-bottom-link {
    margin-top: 16px;
    text-align: center;
    font-size: 13px;
}

/* Mobile */
@media (max-width: 1100px) {
    .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .panel-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .admin-sidebar {
        transform: translateX(-100%);
    }

    .admin-sidebar.open {
        transform: translateX(0);
    }

    .admin-main {
        margin-left: 0;
        width: 100%;
    }

    .sidebar-toggle {
        display: inline-flex;
    }

    .admin-topbar {
        min-height: 70px;
        padding: 12px 16px;
        align-items: flex-start;
    }

    .topbar-title h1 {
        font-size: 18px;
    }

    .topbar-title p {
        display: none;
    }

    .topbar-user {
        flex-direction: column;
        align-items: flex-end;
        gap: 6px;
    }

    .admin-content {
        padding: 16px;
    }

    .stats-grid,
    .form-grid {
        grid-template-columns: 1fr;
    }

    .page-actions {
        justify-content: stretch;
    }

    .page-actions .primary-btn {
        width: 100%;
    }

    .admin-footer {
        flex-direction: column;
        gap: 6px;
        text-align: center;
    }

    .auth-card {
        padding: 24px;
    }
}

/* ITCRAFT_MOBILE_MENU_FIX_START */

@media (max-width: 768px) {
    body.sidebar-open::after {
        content: "";
        position: fixed;
        inset: 0;
        background: rgba(15, 23, 42, .38);
        z-index: 990;
    }

    .admin-sidebar {
        z-index: 1000;
    }

    .sidebar-toggle {
        position: relative;
        z-index: 1001;
    }
}

/* ITCRAFT_MOBILE_MENU_FIX_END */


/* ITCRAFT_STEP3_STATUS_CSS_START */

.status-badge.valid {
    background: #dcfce7;
    color: #166534;
}

.status-badge.invalid,
.status-badge.error,
.status-badge.blocked {
    background: #fee2e2;
    color: #991b1b;
}

.status-badge.expired,
.status-badge.suspended {
    background: #fef3c7;
    color: #92400e;
}

/* ITCRAFT_STEP3_STATUS_CSS_END */


/* ITCRAFT_USERS_CSS_START */

.small-btn:disabled {
    opacity: .45;
    cursor: not-allowed;
    pointer-events: none;
}

.form-group label small {
    display: inline-block;
    margin-left: 6px;
    font-size: 11px;
}

/* ITCRAFT_USERS_CSS_END */
