/* ═══════════════════════════════════════
   MicroChainAI Dark Design System
   Inspired by Linear + Coinbase + Kraken
   ═══════════════════════════════════════ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Noto+Sans+SC:wght@400;500;700&display=swap');

:root {
    /* Primary — Emerald */
    --primary: #10b981;
    --primary-hover: #0ea572;
    --primary-dark: #059669;
    --primary-gradient: linear-gradient(135deg, #10b981, #059669);

    /* Secondary */
    --green: #10b981;
    --orange: #f59e0b;
    --purple: #8b5cf6;
    --blue: #5e6ad2;
    --teal: #6BCBD3;

    /* Status */
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;

    /* Background — dark surfaces */
    --bg-app: hsl(0, 0%, 5%);        /* #0d0d0d */
    --bg-card: hsl(0, 0%, 6%);       /* #0f0f0f */
    --bg-sidebar: hsl(0, 0%, 7%);    /* #121212 */

    /* Text */
    --text-primary: #f7f8f8;
    --text-secondary: #8a8f98;
    --text-muted: rgba(255, 255, 255, 0.4);
    --text-inverse: #ffffff;

    /* Border */
    --border-light: rgba(255, 255, 255, 0.06);
    --divider: rgba(255, 255, 255, 0.06);

    /* Elevation — dark shadows */
    --shadow-soft: 0px 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-card: 0px 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-hover: 0px 8px 24px rgba(0, 0, 0, 0.5);

    /* Radius */
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 20px;
    --radius-pill: 999px;

    /* Sidebar */
    --sidebar-width: 200px;
}

/* ========== Reset & Base ========== */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { height: 100%; }
body {
    font-family: 'Inter', 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Roboto', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background: var(--bg-app);
    color: var(--text-primary);
    line-height: 1.5;
    font-size: 14px;
    height: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-feature-settings: "cv01", "ss03";
}

::selection {
    background: rgba(16, 185, 129, 0.3);
}

/* ========== Layout: Sidebar + Main ========== */
.app-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    align-items: stretch;
    padding: 20px 0;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 100;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 16px;
    margin-bottom: 32px;
    text-decoration: none;
    transition: opacity 0.2s;
}

.sidebar-logo:hover {
    opacity: 0.8;
}

.sidebar-logo img {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
}

.sidebar-logo-text {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.3px;
    white-space: nowrap;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    padding: 0 12px;
}

.sidebar-link {
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 0 16px;
    gap: 12px;
    border-radius: var(--radius-sm);
    color: rgba(255, 255, 255, 0.4);
    text-decoration: none;
    transition: all 0.2s ease;
    position: relative;
    white-space: nowrap;
}

.sidebar-link span {
    font-size: 14px;
    font-weight: 500;
}

.sidebar-link:hover {
    background: rgba(16, 185, 129, 0.08);
    color: var(--primary);
}

.sidebar-link.active {
    color: var(--primary);
    background: rgba(16, 185, 129, 0.1);
}

.sidebar-link.active::before {
    content: '';
    position: absolute;
    left: 0;
    width: 3px;
    height: 24px;
    background: var(--primary);
    border-radius: 0 3px 3px 0;
}

.sidebar-link svg {
    width: 22px;
    height: 22px;
    min-width: 22px;
    min-height: 22px;
    stroke-width: 1.8;
}

.sidebar-bottom {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 0 12px;
}

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 28px 32px;
    max-width: calc(100% - var(--sidebar-width));
    min-height: 100vh;
}

/* ========== Top Bar ========== */
.top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 28px;
}

.top-bar-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
}

.top-bar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-pill);
    font-size: 13px;
    color: var(--text-secondary);
}

.user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 12px;
    font-weight: 600;
}

.logout-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    color: var(--text-muted);
    text-decoration: none;
    transition: all 0.2s;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-light);
}

.logout-link:hover {
    color: var(--danger);
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
}

/* ========== Flash Messages ========== */
.flash-messages {
    margin-bottom: 20px;
}

.flash {
    padding: 12px 18px;
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    animation: flashIn 0.3s ease;
}

@keyframes flashIn {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

.flash-success { background: rgba(16, 185, 129, 0.1); color: #6ee7b7; border: 1px solid rgba(16, 185, 129, 0.2); }
.flash-error { background: rgba(239, 68, 68, 0.1); color: #fca5a5; border: 1px solid rgba(239, 68, 68, 0.2); }
.flash-warning { background: rgba(245, 158, 11, 0.1); color: #fcd34d; border: 1px solid rgba(245, 158, 11, 0.2); }
.flash-info { background: rgba(94, 106, 210, 0.1); color: #a5b4fc; border: 1px solid rgba(94, 106, 210, 0.2); }

/* ========== Cards ========== */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 24px;
    border: 1px solid var(--border-light);
    margin-bottom: 24px;
}

.card-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.card-subtitle {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

/* ========== Stats ========== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 22px 24px;
    border: 1px solid var(--border-light);
    transition: border-color 0.2s, transform 0.2s;
}

.stat-card:hover {
    border-color: rgba(255, 255, 255, 0.12);
    transform: translateY(-2px);
}

.stat-card-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 14px;
}

.stat-card-icon.blue { background: rgba(16, 185, 129, 0.1); color: var(--primary); }
.stat-card-icon.green { background: rgba(16, 185, 129, 0.15); color: #34d399; }
.stat-card-icon.orange { background: rgba(245, 158, 11, 0.1); color: var(--orange); }
.stat-card-icon.purple { background: rgba(139, 92, 246, 0.1); color: var(--purple); }

.stat-card-icon svg { width: 22px; height: 22px; }

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.stat-label {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ========== Buttons ========== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-pill);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
    font-family: inherit;
    line-height: 1;
    white-space: nowrap;
}

.btn-primary {
    background: var(--primary);
    color: var(--text-inverse);
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.2);
}
.btn-primary:hover {
    background: var(--primary-hover);
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.3);
    transform: translateY(-1px);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-secondary);
    border: 1px solid var(--border-light);
}
.btn-secondary:hover { background: rgba(255, 255, 255, 0.08); color: var(--text-primary); }

.btn-success {
    background: var(--green);
    color: white;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.2);
}
.btn-success:hover { box-shadow: 0 4px 14px rgba(16, 185, 129, 0.3); }

.btn-danger {
    background: var(--danger);
    color: white;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.2);
}
.btn-danger:hover { box-shadow: 0 4px 14px rgba(239, 68, 68, 0.3); }

.btn-warning {
    background: var(--orange);
    color: white;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.2);
}
.btn-warning:hover { box-shadow: 0 4px 14px rgba(245, 158, 11, 0.3); }

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-light);
    color: var(--text-secondary);
}
.btn-outline:hover { background: rgba(255, 255, 255, 0.04); border-color: var(--primary); color: var(--primary); }

.btn-block { width: 100%; }

.btn-sm { padding: 7px 14px; font-size: 13px; }
.btn-xs { padding: 5px 10px; font-size: 12px; border-radius: 8px; }

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 12px;
}

/* ========== Form ========== */
input[type="date"] {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    min-height: 42px;
    color-scheme: dark;
}

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

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-input,
.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.03);
    transition: all 0.2s;
    outline: none;
}

.form-input:focus,
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: rgba(16, 185, 129, 0.4);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.form-input::placeholder,
.form-group input::placeholder,
.form-group textarea::placeholder {
    color: rgba(255, 255, 255, 0.2);
}

.inline-form {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: flex-end;
}

.inline-form input,
.inline-form select {
    padding: 10px 14px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.03);
    transition: all 0.2s;
    outline: none;
}

.inline-form input:focus,
.inline-form select:focus {
    border-color: rgba(16, 185, 129, 0.4);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.settings-form { max-width: 520px; }

.required { color: var(--danger); }
.hint { font-size: 13px; color: var(--text-muted); margin-top: 8px; line-height: 1.6; }

/* Select option fallback for dark theme */
select option {
    background: #0f0f0f;
    color: #f7f8f8;
}

/* ========== Filter Bar ========== */
.filter-bar {
    margin-bottom: 20px;
}

.filter-form {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.filter-form input,
.filter-form select {
    padding: 9px 14px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-sm);
    font-size: 14px;
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-primary);
    font-family: inherit;
    transition: all 0.2s;
    outline: none;
}

.filter-form input:focus,
.filter-form select:focus {
    border-color: rgba(16, 185, 129, 0.4);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

/* ========== Table ========== */
.table-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
    overflow: hidden;
    margin-bottom: 24px;
}

.table-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    border-bottom: 1px solid var(--divider);
}

.table-card-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    border: none;
    background: transparent;
}

.data-table th {
    background: hsl(0, 0%, 8%);
    padding: 12px 16px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--divider);
}

.data-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--divider);
    font-size: 14px;
    color: var(--text-primary);
}

.data-table tbody tr {
    transition: background 0.15s;
}

.data-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

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

.data-table .actions {
    white-space: nowrap;
    display: flex;
    gap: 6px;
    align-items: center;
}

.text-center { text-align: center; }
.mono { font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-size: 12px; color: var(--text-secondary); }

.detail-cell {
    max-width: 280px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13px;
    color: var(--text-secondary);
}

/* ========== Badges ========== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    border-radius: var(--radius-pill);
    font-size: 12px;
    font-weight: 500;
    line-height: 1;
}

.badge-pending { background: rgba(245, 158, 11, 0.1); color: #fbbf24; }
.badge-authorized { background: rgba(16, 185, 129, 0.15); color: #34d399; }
.badge-rejected { background: rgba(239, 68, 68, 0.1); color: #f87171; }
.badge-expired { background: rgba(255, 255, 255, 0.04); color: rgba(255, 255, 255, 0.3); }
.badge-cancelled { background: rgba(255, 255, 255, 0.04); color: rgba(255, 255, 255, 0.3); }

.row-pending { background: rgba(245, 158, 11, 0.04) !important; }
.row-pending:hover { background: rgba(245, 158, 11, 0.08) !important; }

/* ========== Radio Group ========== */
.radio-group { display: flex; gap: 12px; margin-top: 6px; }
.radio-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    cursor: pointer;
    padding: 10px 18px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    transition: all .2s;
    color: var(--text-secondary);
}
.radio-label:has(input:checked) {
    border-color: var(--primary);
    background: rgba(16, 185, 129, 0.06);
    color: var(--primary);
}
.radio-label input[type="radio"] { margin: 0; accent-color: var(--primary); }

/* ========== Pagination ========== */
.pagination {
    margin: 20px 0;
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
}

.pagination a {
    text-decoration: none;
    color: var(--primary);
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-light);
    transition: all 0.2s;
}

.pagination a:hover {
    background: rgba(16, 185, 129, 0.08);
    border-color: rgba(16, 185, 129, 0.3);
    transform: translateY(-1px);
}

.pagination span {
    font-size: 13px;
    color: var(--text-muted);
    padding: 0 8px;
}

/* ========== Autocomplete ========== */
.autocomplete-container {
    position: absolute;
    background: hsl(0, 0%, 8%);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-card);
    z-index: 100;
    max-height: 200px;
    overflow-y: auto;
}

.ac-item {
    padding: 10px 16px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-primary);
    transition: background 0.1s;
}

.ac-item:hover { background: rgba(255, 255, 255, 0.04); }

/* ========== Modal ========== */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    z-index: 1000;
    animation: fadeIn 0.2s ease;
}

.modal-overlay.active { display: flex; align-items: center; justify-content: center; }

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: hsl(0, 0%, 7%);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 28px;
    max-width: 520px;
    width: 90%;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(24px); }
    to { opacity: 1; transform: translateY(0); }
}

.modal-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 20px;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 24px;
}

.compliance-modal {
    max-width: 900px;
    padding: 0;
    overflow: hidden;
    width: min(92vw, 900px);
}

.compliance-modal-head {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 24px 30px 18px;
    border-bottom: 1px solid var(--border-light);
    background:
        radial-gradient(circle at 18% 0%, rgba(248, 113, 113, 0.16), transparent 34%),
        rgba(255, 255, 255, 0.025);
}

.compliance-icon {
    display: flex;
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    color: #34d399;
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.compliance-icon.warning {
    color: #f87171;
    background: rgba(248, 113, 113, 0.12);
    border-color: rgba(248, 113, 113, 0.22);
}

.compliance-modal-head h3 {
    margin: 0;
    color: var(--text-primary);
    font-size: 21px;
    font-weight: 700;
}

.compliance-modal-head p {
    margin: 6px 0 0;
    color: var(--text-muted);
    font-size: 14px;
    line-height: 1.6;
}

.compliance-modal-body {
    max-height: min(62vh, 620px);
    overflow-y: auto;
    margin: 22px 30px;
    padding: 28px 32px;
    color: rgba(255, 255, 255, 0.74);
    font-size: 15px;
    line-height: 1.85;
    background: rgba(255, 255, 255, 0.035);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035), 0 10px 30px rgba(0, 0, 0, 0.22);
}

.compliance-modal-body p { margin: 0 0 12px; }
.compliance-modal-body h4 {
    position: relative;
    margin: 24px 0 10px;
    padding-left: 16px;
    color: rgba(255, 255, 255, 0.92);
    font-size: 16px;
    font-weight: 800;
}

.compliance-modal-body h4::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0.35em;
    width: 3px;
    height: 1em;
    border-radius: 999px;
    background: #f87171;
}

.compliance-modal-body strong { color: rgba(255, 255, 255, 0.9); }
.compliance-modal-body ul {
    margin: 8px 0 14px;
    padding-left: 20px;
}
.compliance-modal-body li + li { margin-top: 6px; }
.compliance-modal-body li::marker { color: #f87171; }
.compliance-modal-body li strong { color: #fecaca; }

.compliance-modal-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 30px 22px;
    border-top: 1px solid var(--border-light);
    background: rgba(255, 255, 255, 0.02);
}

.compliance-confirm-check {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
    font-size: 14px;
    line-height: 1.5;
    cursor: pointer;
    user-select: none;
}

.compliance-confirm-check input {
    width: 17px;
    height: 17px;
    accent-color: #ef4444;
}

.compliance-action-buttons {
    display: flex;
    align-items: center;
    gap: 10px;
}

.compliance-modal .btn-primary:disabled {
    cursor: not-allowed;
    opacity: 0.45;
    filter: grayscale(0.35);
}

/* ========== Login Page — Dark with Emerald Glow ========== */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    background: #0b0c10;
}

/* Decorative glow */
.login-page::before,
.login-page::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.5;
    pointer-events: none;
}

.login-page::before {
    width: 500px;
    height: 500px;
    background: rgba(16, 185, 129, 0.07);
    top: -150px;
    right: -100px;
}

.login-page::after {
    width: 400px;
    height: 400px;
    background: rgba(94, 106, 210, 0.06);
    bottom: -100px;
    left: -80px;
}

/* Arc line decoration */
.login-page .login-box::before {
    content: '';
    position: absolute;
    width: 520px;
    height: 520px;
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
}

/* Brand top-left */
.login-brand {
    position: absolute;
    top: 28px;
    left: 32px;
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 10;
}

.login-brand-icon-img {
    width: 36px;
    height: 36px;
    border-radius: 10px;
}

.login-brand-text {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.3px;
}

/* Glass card — dark frosted */
.login-box {
    max-width: 420px;
    width: 90%;
    background: rgba(255, 255, 255, 0.02);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.06);
    padding: 44px 40px 36px;
    border-radius: 24px;
    box-shadow: 0 8px 48px rgba(0, 0, 0, 0.5);
    position: relative;
    z-index: 5;
    animation: loginCardIn 0.6s ease;
}

@keyframes loginCardIn {
    from { opacity: 0; transform: translateY(20px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.login-box h2 {
    text-align: center;
    margin-bottom: 6px;
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
}

.login-subtitle {
    text-align: center;
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 28px;
    line-height: 1.5;
}

/* Logo icon circle */
.login-logo {
    width: 52px;
    height: 52px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
}

.login-logo img {
    width: 30px;
    height: 30px;
}

/* Input groups with icons */
.login-input-group {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 16px;
    height: 48px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    margin-bottom: 4px;
    transition: border-color 0.2s;
}

.login-input-group:focus-within {
    border-color: var(--primary);
}

.login-input-icon {
    display: flex;
    align-items: center;
    color: rgba(255, 255, 255, 0.3);
    flex-shrink: 0;
}

.login-input-group input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 14px;
    font-family: inherit;
    color: var(--text-primary);
    outline: none;
    height: 100%;
    padding: 0;
}

.login-input-group input::placeholder {
    color: rgba(255, 255, 255, 0.2);
}

/* Override browser autofill background */
.login-input-group input:-webkit-autofill,
.login-input-group input:-webkit-autofill:hover,
.login-input-group input:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0 1000px #0b0c10 inset !important;
    -webkit-text-fill-color: #f7f8f8 !important;
    background-color: transparent !important;
    transition: background-color 5000s ease-in-out 0s;
}

.login-input-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.3);
    padding: 4px;
    border-radius: 6px;
    transition: color 0.2s;
}

.login-input-toggle:hover {
    color: var(--text-secondary);
}

/* Primary login button */
.login-btn {
    display: block;
    width: 100%;
    padding: 14px;
    margin-top: 24px;
    background: var(--primary);
    color: #ffffff;
    border: none;
    border-radius: var(--radius-pill);
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.2);
    letter-spacing: 0.3px;
}

.login-btn:hover {
    background: var(--primary-hover);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.3);
    transform: translateY(-1px);
}

.login-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.15);
}

/* Bottom divider text */
.login-divider {
    display: flex;
    align-items: center;
    margin-top: 28px;
    gap: 12px;
}

.login-divider::before,
.login-divider::after {
    content: '';
    flex: 1;
    height: 0;
    border-top: 1px dashed rgba(255, 255, 255, 0.08);
}

.login-divider span {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
    letter-spacing: 0.3px;
}

/* Login page responsive */
@media (max-width: 480px) {
    .login-box {
        padding: 36px 24px 28px;
        border-radius: 20px;
    }

    .login-brand {
        top: 16px;
        left: 16px;
    }

    .login-box::before {
        display: none;
    }
}

/* ========== Form Page (Public) — reuses dark login-page style ========== */
.form-radio-section {
    margin: 20px 0 4px;
}

.form-radio-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.form-radio-group {
    display: flex;
    gap: 10px;
}

.form-radio-option {
    flex: 1;
    cursor: pointer;
}

.form-radio-option input[type="radio"] {
    display: none;
}

.form-radio-btn {
    display: block;
    text-align: center;
    padding: 10px 0;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.02);
    transition: all 0.2s;
}

.form-radio-option input[type="radio"]:checked + .form-radio-btn {
    color: var(--primary);
    border-color: var(--primary);
    background: rgba(16, 185, 129, 0.08);
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.15);
}

.form-radio-btn:hover {
    border-color: rgba(255, 255, 255, 0.15);
}

/* ========== Result Box ========== */
.result-box {
    margin-top: 16px;
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    line-height: 1.5;
}

.result-success { background: rgba(16, 185, 129, 0.1); color: #6ee7b7; border: 1px solid rgba(16, 185, 129, 0.2); }
.result-info { background: rgba(94, 106, 210, 0.1); color: #a5b4fc; border: 1px solid rgba(94, 106, 210, 0.2); }
.result-error { background: rgba(239, 68, 68, 0.1); color: #fca5a5; border: 1px solid rgba(239, 68, 68, 0.2); }

/* ========== Action Bar ========== */
.action-bar { margin-bottom: 20px; }

/* ========== Tooltip ========== */
[data-tooltip] {
    position: relative;
}

[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    left: calc(100% + 8px);
    top: 50%;
    transform: translateY(-50%);
    background: hsl(0, 0%, 12%);
    color: var(--text-primary);
    padding: 4px 10px;
    border: 1px solid var(--border-light);
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 200;
    pointer-events: none;
}

/* Tooltips hidden on desktop since sidebar shows text labels */
.sidebar [data-tooltip]:hover::after {
    display: none;
}

/* ========== Responsive ========== */
@media (max-width: 1024px) {
    .main-content {
        padding: 20px 20px;
    }

    .stats-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 12px;
    }
}

@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        bottom: 0;
        top: auto;
        left: 0;
        height: auto;
        width: 100%;
        flex-direction: row;
        align-items: stretch;
        padding: 0;
        border-right: none;
        border-top: 1px solid var(--border-light);
        z-index: 200;
        background: var(--bg-card);
        box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.3);
    }

    .sidebar-logo { display: none; }

    .sidebar-nav,
    .sidebar-bottom {
        display: contents;
    }

    .sidebar-link {
        flex: 1;
        height: 56px;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        padding: 6px 0;
        gap: 2px;
        border-radius: 0;
    }

    .sidebar-link span {
        display: block;
        font-size: 10px;
        font-weight: 500;
        color: inherit;
    }

    .sidebar-link svg {
        width: 22px;
        height: 22px;
    }

    .sidebar-link.active {
        background: rgba(16, 185, 129, 0.06);
    }

    .sidebar-link.active::before {
        left: 50%;
        transform: translateX(-50%);
        top: 0;
        bottom: auto;
        width: 24px;
        height: 3px;
        border-radius: 0 0 3px 3px;
    }

    .sidebar [data-tooltip]:hover::after {
        display: none;
    }

    .main-content {
        margin-left: 0;
        max-width: 100%;
        padding: 16px 16px 72px 16px;
    }

    .top-bar {
        flex-direction: row;
        align-items: center;
        gap: 12px;
    }

    .top-bar-title {
        font-size: 18px;
        flex: 1;
    }

    .stats-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
    }

    .stat-card {
        padding: 14px;
        text-align: center;
    }

    .stat-card-icon {
        width: 36px;
        height: 36px;
        border-radius: 10px;
        margin: 0 auto 8px;
    }

    .stat-card-icon svg { width: 18px; height: 18px; }

    .stat-value { font-size: 20px; }
    .stat-label { font-size: 11px; }

    .filter-form {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-form input,
    .filter-form select {
        width: 100%;
    }

    .inline-form {
        flex-direction: column;
    }

    .inline-form.inline-form-row {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .inline-form input,
    .inline-form select {
        width: 100%;
    }

    .inline-form .inline-form-field {
        width: 100% !important;
        min-width: 0 !important;
        flex: none !important;
    }

    .inline-form .inline-form-field input,
    .inline-form .inline-form-field select {
        width: 100%;
    }

    .inline-form input.inline-form-field,
    .inline-form select.inline-form-field {
        width: 100% !important;
        min-width: 0 !important;
        flex: none !important;
    }

    .btn-block-mobile {
        width: 100%;
    }

    .data-table { font-size: 13px; }
    .data-table th,
    .data-table td { padding: 10px 12px; }

    .data-table .actions {
        flex-direction: column;
        gap: 4px;
    }

    .card { padding: 18px; }

    .modal-content {
        margin: 16px;
        padding: 24px;
    }

    .login-box { padding: 28px; }
    .form-box { padding: 28px; }

    /* Hide columns on mobile */
    .hide-mobile { display: none; }
}

@media (max-width: 480px) {
    .top-bar-title { font-size: 17px; }

    .stat-value { font-size: 22px; }

    .user-badge { font-size: 12px; padding: 4px 10px; }

    .data-table th,
    .data-table td { padding: 8px 10px; font-size: 12px; }
}

/* ========== Scrollbar — Linear dark style ========== */
* {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.1); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.2); }

/* ========== Table Responsive Wrapper ========== */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* ═══════════════════════════════════════════
   Form Page — Split Layout (Left Showcase + Right Form)
   Matches screenshot design: dark bg, left marketing, right form
   ═══════════════════════════════════════════ */

.form-page {
    min-height: 100vh;
    background: #0b0c10;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.form-split {
    display: flex;
    max-width: 960px;
    width: 100%;
    border-radius: 24px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5);
    animation: loginCardIn 0.6s ease;
}

/* ── Left Panel ── */
.form-left {
    flex: 1;
    background: hsl(0, 0%, 7%);
    padding: 48px 40px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

/* Subtle top-right emerald glow */
.form-left::before {
    content: '';
    position: absolute;
    width: 300px;
    height: 300px;
    background: rgba(16, 185, 129, 0.06);
    border-radius: 50%;
    filter: blur(80px);
    top: -80px;
    right: -60px;
    pointer-events: none;
}

.form-left-inner {
    position: relative;
    z-index: 1;
}

/* Brand */
.form-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 32px;
}

.form-brand img {
    width: 28px;
    height: 28px;
    border-radius: 8px;
}

.form-brand-text {
    display: flex;
    flex-direction: column;
}

.form-brand-name {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.form-brand-sub {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.15em;
    color: rgba(255, 255, 255, 0.3);
    text-transform: uppercase;
}

/* Badge */
.form-badge {
    display: inline-block;
    padding: 5px 14px;
    border-radius: var(--radius-pill);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: #10b981;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.2);
    margin-bottom: 20px;
}

/* Hero Title */
.form-hero-title {
    font-size: 36px;
    font-weight: 800;
    line-height: 1.2;
    color: var(--text-primary);
    margin-bottom: 16px;
    letter-spacing: -0.5px;
}

.form-hero-accent {
    color: #10b981;
}

.form-hero-desc {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.5);
    line-height: 1.6;
    margin-bottom: 32px;
}

.form-hero-count {
    color: #ef4444;
    font-weight: 600;
    background: rgba(239, 68, 68, 0.15);
    padding: 1px 6px;
    border-radius: 4px;
}

/* Features */
.form-features {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 32px;
}

.form-feature {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.form-feature-icon {
    width: 32px;
    height: 32px;
    min-width: 32px;
    border-radius: 8px;
    background: rgba(16, 185, 129, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #10b981;
}

.form-feature-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.form-feature-desc {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.35);
}

/* Avatars */
.form-avatars {
    display: flex;
    align-items: center;
    gap: 12px;
}

.form-avatar-stack {
    display: flex;
}

.form-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    color: #fff;
    border: 2px solid hsl(0, 0%, 7%);
    margin-right: -8px;
}

.form-avatar:last-child {
    margin-right: 0;
}

.form-avatar-text {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.4);
}

.form-avatar-text strong {
    color: rgba(255, 255, 255, 0.7);
}

/* ── Right Panel ── */
.form-right {
    flex: 1;
    background: #0b0c10;
    padding: 48px 44px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.form-right-inner {
    max-width: 380px;
    width: 100%;
    margin: 0 auto;
}

.form-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.form-desc {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 28px;
    line-height: 1.5;
}

/* Form fields */
.form-field {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
    color: rgba(255, 255, 255, 0.4);
    margin-bottom: 8px;
    text-transform: uppercase;
}

.form-input-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 0 16px;
    height: 48px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-input-wrap:focus-within {
    border-color: rgba(16, 185, 129, 0.4);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.08);
}

.form-input-icon {
    color: rgba(255, 255, 255, 0.25);
    display: flex;
    flex-shrink: 0;
}

.form-input-wrap input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 14px;
    font-family: inherit;
    color: var(--text-primary);
    outline: none;
    height: 100%;
    padding: 0;
}

.form-input-wrap input::placeholder {
    color: rgba(255, 255, 255, 0.2);
}

/* Override autofill */
.form-input-wrap input:-webkit-autofill,
.form-input-wrap input:-webkit-autofill:hover,
.form-input-wrap input:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0 1000px #0b0c10 inset !important;
    -webkit-text-fill-color: #f7f8f8 !important;
    background-color: transparent !important;
    transition: background-color 5000s ease-in-out 0s;
}

/* Submit button */
.form-submit-btn {
    display: block;
    width: 100%;
    padding: 14px;
    margin-top: 8px;
    background: #10b981;
    color: #ffffff;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.2);
    letter-spacing: 0.3px;
}

.form-submit-btn:hover {
    background: #0ea572;
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.3);
    transform: translateY(-1px);
}

.form-submit-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.15);
}

.form-submit-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Bottom tip */
.form-bottom-tip {
    margin-top: 24px;
    padding: 14px 16px;
    background: rgba(239, 68, 68, 0.06);
    border: 1px solid rgba(239, 68, 68, 0.12);
    border-radius: 12px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.4);
    line-height: 1.6;
}

.form-tip-icon {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
}

/* ── Login page extras (password toggle + divider) ── */
.login-password-wrap {
    position: relative;
}

.login-password-wrap input {
    padding-right: 44px !important;
}

.login-eye-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.3);
    padding: 4px;
    border-radius: 6px;
    transition: color 0.2s;
}

.login-eye-toggle:hover {
    color: var(--text-secondary);
}

.form-login-divider {
    display: flex;
    align-items: center;
    margin-top: 28px;
    gap: 12px;
}

.form-login-divider::before,
.form-login-divider::after {
    content: '';
    flex: 1;
    height: 0;
    border-top: 1px dashed rgba(255, 255, 255, 0.08);
}

.form-login-divider span {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
    letter-spacing: 0.3px;
}

.form-hint-link {
    margin-top: 16px;
    text-align: center;
}

.form-hint-link a {
    color: var(--text-muted);
    font-size: 13px;
    text-decoration: none;
    transition: color 0.2s;
}

.form-hint-link a:hover {
    color: var(--text-secondary);
}

/* ── Form Page Responsive ── */
@media (max-width: 768px) {
    .modal-overlay {
        padding: 12px;
        align-items: flex-start !important;
        overflow-y: auto;
    }

    .compliance-modal {
        width: min(100%, 900px);
        max-width: 900px;
        margin: 12px 0;
        border-radius: 18px;
    }

    .compliance-modal-head {
        gap: 10px;
        padding: 18px 18px 14px;
    }

    .compliance-icon {
        width: 34px;
        height: 34px;
        flex-basis: 34px;
        border-radius: 10px;
    }

    .compliance-modal-head h3 {
        font-size: 18px;
        line-height: 1.35;
    }

    .compliance-modal-head p {
        font-size: 13px;
    }

    .compliance-modal-body {
        max-height: 60vh;
        margin: 14px;
        padding: 20px 18px;
        font-size: 14px;
        line-height: 1.75;
        border-radius: 10px;
    }

    .compliance-modal-body h4 {
        font-size: 15px;
        margin-top: 16px;
    }

    .compliance-modal-actions {
        align-items: stretch;
        flex-direction: column;
        padding: 12px 16px 16px;
    }

    .compliance-confirm-check {
        align-items: flex-start;
        font-size: 13px;
    }

    .compliance-action-buttons {
        width: 100%;
        justify-content: stretch;
    }

    .compliance-action-buttons .btn {
        flex: 1;
        justify-content: center;
    }

    .form-page {
        padding: 0;
    }

    .form-split {
        flex-direction: column;
        border-radius: 0;
        border: none;
        min-height: 100vh;
    }

    .form-left {
        padding: 32px 24px;
    }

    .form-hero-title {
        font-size: 28px;
    }

    .form-right {
        padding: 32px 24px;
    }
}

@media (max-width: 480px) {
    .modal-overlay {
        padding: 8px;
    }

    .compliance-modal-body {
        max-height: 56vh;
    }

    .compliance-action-buttons {
        flex-direction: column-reverse;
    }

    .compliance-action-buttons .btn {
        width: 100%;
    }

    .form-left {
        padding: 24px 20px;
    }

    .form-hero-title {
        font-size: 24px;
    }

    .form-features {
        gap: 12px;
    }

    .form-right {
        padding: 24px 20px;
    }
}
