/* =============================================
   CryptoCalc — Mobile-first design system
   Palette: bg #ffffff | dark #1a1a2e | teal #00b09b
   ============================================= */

/* ── Reset & Base ─────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background: #f4f6fb;
    color: #1a1a2e;
    line-height: 1.5;
    min-height: 100vh;
}
a { color: #00b09b; text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; }
button { cursor: pointer; font: inherit; }

/* ── CSS Variables ─────────────────────────── */
:root {
    --color-bg:       #ffffff;
    --color-surface:  #f4f6fb;
    --color-dark:     #1a1a2e;
    --color-teal:     #00b09b;
    --color-teal-dk:  #008c7a;
    --color-red:      #e53e3e;
    --color-green:    #38a169;
    --color-yellow:   #d69e2e;
    --color-gray-100: #f7fafc;
    --color-gray-200: #edf2f7;
    --color-gray-300: #e2e8f0;
    --color-gray-400: #cbd5e0;
    --color-gray-500: #a0aec0;
    --color-gray-600: #718096;
    --color-gray-700: #4a5568;
    --color-gray-800: #2d3748;
    --shadow-sm: 0 1px 3px rgba(0,0,0,.08);
    --shadow:    0 2px 8px rgba(0,0,0,.10);
    --shadow-lg: 0 4px 20px rgba(0,0,0,.12);
    --radius-sm: 6px;
    --radius:    10px;
    --radius-lg: 16px;
    --sidebar-w: 240px;
    --header-h:  56px;
    --bottom-nav-h: 60px;
    --transition: 200ms ease;
}

/* ── Guest Layout ──────────────────────────── */
.layout-guest {
    background: var(--color-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 16px;
}
.guest-container { width: 100%; max-width: 420px; }
.guest-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: center;
    margin-bottom: 24px;
}
.brand-logo { font-size: 28px; }
.brand-name { font-size: 22px; font-weight: 700; color: var(--color-teal); letter-spacing: -0.5px; }
.guest-card {
    background: var(--color-bg);
    border-radius: var(--radius-lg);
    padding: 32px 28px;
    box-shadow: var(--shadow-lg);
}
.auth-title { font-size: 22px; font-weight: 700; margin-bottom: 4px; }
.auth-subtitle { color: var(--color-gray-600); font-size: 14px; margin-bottom: 24px; }
.auth-form { margin-top: 20px; }
.auth-footer { text-align: center; margin-top: 20px; font-size: 14px; color: var(--color-gray-600); }

/* ── App Layout ────────────────────────────── */
.layout-app { background: var(--color-surface); }

/* Sidebar */
.app-sidebar {
    position: fixed;
    top: 0; left: 0;
    width: var(--sidebar-w);
    height: 100vh;
    background: var(--color-dark);
    overflow-y: auto;
    z-index: 200;
    transform: translateX(-100%);
    transition: transform var(--transition);
    display: flex;
    flex-direction: column;
}
.app-sidebar.is-open { transform: translateX(0); }
.sidebar-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 199;
}
.sidebar-overlay.is-visible { display: block; }
.sidebar-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px;
    border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-header .brand-name { font-size: 17px; }
.sidebar-close {
    margin-left: auto;
    background: none;
    border: none;
    color: var(--color-gray-400);
    font-size: 18px;
    line-height: 1;
    padding: 4px;
}
.sidebar-nav { padding: 12px 0; flex: 1; }
.sidebar-section-label {
    padding: 12px 16px 4px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .8px;
    color: var(--color-gray-500);
    font-weight: 600;
}
.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    color: var(--color-gray-300);
    font-size: 14px;
    border-radius: 0;
    transition: background var(--transition), color var(--transition);
    min-height: 44px;
    text-decoration: none;
}
.sidebar-link:hover  { background: rgba(255,255,255,.06); color: #fff; text-decoration: none; }
.sidebar-link.active { background: var(--color-teal); color: #fff; }
.nav-icon { font-size: 16px; width: 20px; text-align: center; }

/* App main area */
.app-main {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding-bottom: var(--bottom-nav-h);
}

/* Header */
.app-header {
    height: var(--header-h);
    background: var(--color-bg);
    border-bottom: 1px solid var(--color-gray-200);
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 16px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}
.sidebar-toggle {
    background: none;
    border: none;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    color: var(--color-gray-700);
}
.sidebar-toggle:hover { background: var(--color-gray-100); }
.hamburger, .hamburger::before, .hamburger::after {
    display: block;
    width: 20px;
    height: 2px;
    background: currentColor;
    border-radius: 2px;
    position: relative;
}
.hamburger::before, .hamburger::after {
    content: '';
    position: absolute;
    left: 0;
}
.hamburger::before { top: -6px; }
.hamburger::after  { top:  6px; }
.header-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }

/* App content */
.app-content {
    flex: 1;
    padding: 20px 16px;
    max-width: 1280px;
    width: 100%;
    margin: 0 auto;
}

/* Bottom nav — mobile only */
.bottom-nav {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: var(--bottom-nav-h);
    background: var(--color-bg);
    border-top: 1px solid var(--color-gray-200);
    display: flex;
    z-index: 150;
    box-shadow: 0 -2px 8px rgba(0,0,0,.06);
}
.bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    text-decoration: none;
    color: var(--color-gray-500);
    font-size: 11px;
    font-weight: 500;
    min-height: 44px;
    transition: color var(--transition);
}
.bottom-nav-item .nav-icon { font-size: 18px; line-height: 1; }
.bottom-nav-item.active { color: var(--color-teal); }
.bottom-nav-item:hover  { color: var(--color-teal); text-decoration: none; }

/* ── Admin Layout ──────────────────────────── */
.layout-admin { display: flex; min-height: 100vh; }
.admin-sidebar {
    width: 220px;
    flex-shrink: 0;
    background: var(--color-dark);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}
.admin-brand {
    padding: 20px 16px;
    font-size: 16px;
    font-weight: 700;
    color: var(--color-teal);
    border-bottom: 1px solid rgba(255,255,255,.08);
}
.admin-nav { padding: 8px 0; }
.admin-nav-link {
    display: block;
    padding: 10px 16px;
    color: var(--color-gray-300);
    font-size: 14px;
    min-height: 44px;
    line-height: 24px;
    text-decoration: none;
    transition: background var(--transition), color var(--transition);
}
.admin-nav-link:hover  { background: rgba(255,255,255,.06); color: #fff; text-decoration: none; }
.admin-nav-link.active { background: var(--color-teal); color: #fff; }
.admin-nav hr { border: none; border-top: 1px solid rgba(255,255,255,.08); margin: 8px 0; }
.admin-nav-section {
    padding: 12px 16px 4px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .8px;
    color: var(--color-gray-500);
    font-weight: 600;
}
.admin-user {
    padding: 12px 16px;
    border-top: 1px solid rgba(255,255,255,.08);
    font-size: 13px;
    color: var(--color-gray-400);
    margin-top: auto;
}
.admin-main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.admin-header {
    height: 56px;
    background: var(--color-bg);
    border-bottom: 1px solid var(--color-gray-200);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    padding: 0 20px;
}
.admin-content { flex: 1; padding: 24px; overflow-y: auto; }

/* ── Error Layout ──────────────────────────── */
.layout-error {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--color-surface);
}
.error-container { text-align: center; padding: 40px 24px; }
.error-code { font-size: 80px; font-weight: 900; color: var(--color-teal); line-height: 1; }
.error-title { font-size: 24px; font-weight: 700; margin: 12px 0 8px; }
.error-text { color: var(--color-gray-600); margin-bottom: 24px; }

/* ── Page Header ──────────────────────────── */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}
.page-title { font-size: 20px; font-weight: 700; color: var(--color-dark); }
.page-subtitle { font-size: 14px; color: var(--color-gray-600); margin-top: 2px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ── Card ─────────────────────────────────── */
.card {
    background: var(--color-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    margin-bottom: 20px;
    overflow: hidden;
    border: 1px solid var(--color-gray-200);
}
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px 10px;
    border-bottom: 1px solid var(--color-gray-100);
}
.card-title { font-size: 15px; font-weight: 600; }
.card-body { padding: 16px; }
.card-footer {
    padding: 10px 16px;
    background: var(--color-gray-100);
    font-size: 13px;
    color: var(--color-gray-600);
}
.form-card { padding: 20px; }
.confirm-card { padding: 32px 24px; text-align: center; }
.detail-card .detail-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 16px;
    border-bottom: 1px solid var(--color-gray-100);
    font-size: 14px;
}
.detail-row:last-child { border-bottom: none; }
.detail-label { color: var(--color-gray-600); font-size: 13px; }
.card-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    margin-bottom: 20px;
}
.card-row { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }

/* ── Stat Cards ───────────────────────────── */
.stat-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 20px;
}
.stat-card {
    background: var(--color-bg);
    border-radius: var(--radius);
    padding: 16px;
    border: 1px solid var(--color-gray-200);
    box-shadow: var(--shadow-sm);
}
.stat-card-primary { border-left: 4px solid var(--color-teal); }
.stat-card-success { border-left: 4px solid var(--color-green); }
.stat-card-danger  { border-left: 4px solid var(--color-red);   }
.stat-label  { font-size: 12px; color: var(--color-gray-600); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 4px; }
.stat-value  { font-size: 22px; font-weight: 700; color: var(--color-dark); }
.stat-sub    { font-size: 13px; color: var(--color-gray-500); margin-top: 2px; }

/* ── Buttons ──────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: background var(--transition), opacity var(--transition), box-shadow var(--transition);
    text-decoration: none;
    min-height: 44px;
    white-space: nowrap;
    user-select: none;
}
.btn:hover { text-decoration: none; opacity: .9; }
.btn:active { opacity: .8; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn-primary   { background: var(--color-teal); color: #fff; }
.btn-primary:hover { background: var(--color-teal-dk); opacity: 1; }
.btn-secondary { background: var(--color-gray-200); color: var(--color-dark); }
.btn-secondary:hover { background: var(--color-gray-300); opacity: 1; }
.btn-danger    { background: var(--color-red); color: #fff; }
.btn-ghost     { background: transparent; color: var(--color-gray-600); }
.btn-ghost:hover { background: var(--color-gray-100); opacity: 1; }
.btn-block { width: 100%; }
.btn-sm { padding: 7px 13px; font-size: 13px; min-height: 36px; }
.btn-xs { padding: 4px 10px; font-size: 12px; min-height: 28px; }

/* ── Forms ────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-row { display: flex; gap: 12px; flex-wrap: wrap; }
.form-row .form-group { flex: 1; min-width: 140px; }
.form-row-inline { align-items: flex-end; }
.form-label {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    font-weight: 600;
    color: var(--color-gray-700);
    margin-bottom: 5px;
}
.form-label-link { font-weight: 400; color: var(--color-teal); font-size: 12px; }
.form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1.5px solid var(--color-gray-300);
    border-radius: var(--radius-sm);
    font-size: 14px;
    color: var(--color-dark);
    background: #fff;
    transition: border-color var(--transition), box-shadow var(--transition);
    min-height: 44px;
    appearance: none;
}
.form-control:focus {
    outline: none;
    border-color: var(--color-teal);
    box-shadow: 0 0 0 3px rgba(0,176,155,.15);
}
/* ── Validation states ──────────────────── */
.form-control.is-invalid {
    border-color: var(--color-red);
    background-image: none;
}
.form-control.is-invalid:focus {
    border-color: var(--color-red);
    box-shadow: 0 0 0 3px rgba(229,62,62,.15);
}
.form-control.is-valid {
    border-color: var(--color-green);
}
.form-control.is-valid:focus {
    border-color: var(--color-green);
    box-shadow: 0 0 0 3px rgba(72,187,120,.15);
}
.form-group { position: relative; }
.field-error {
    display: block;
    font-size: 12px;
    color: var(--color-red);
    margin-top: 4px;
    line-height: 1.4;
}
.form-group.has-error .form-label { color: var(--color-red); }
textarea.form-control { min-height: 80px; resize: vertical; }
select.form-control { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23718096'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }
.form-control-sm { min-height: 36px; padding: 6px 10px; font-size: 13px; }
.form-control-xs { min-height: 28px; padding: 4px 8px; font-size: 12px; }
.form-hint { display: block; font-size: 12px; color: var(--color-gray-500); margin-top: 4px; }
.form-check { display: flex; align-items: center; gap: 8px; }
.form-check input[type="checkbox"] { width: 18px; height: 18px; cursor: pointer; accent-color: var(--color-teal); }
.form-check label { font-size: 14px; font-weight: 400; cursor: pointer; margin-bottom: 0; }
.form-actions { display: flex; gap: 10px; margin-top: 20px; flex-wrap: wrap; }
.inline-form { display: inline; }

/* File drop zone */
.file-drop-zone {
    border: 2px dashed var(--color-gray-300);
    border-radius: var(--radius);
    padding: 24px;
    text-align: center;
    cursor: pointer;
    transition: border-color var(--transition);
    position: relative;
}
.file-drop-zone:hover, .file-drop-zone.drag-over { border-color: var(--color-teal); }
.file-input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; }
.file-drop-label { pointer-events: none; display: flex; flex-direction: column; align-items: center; gap: 6px; color: var(--color-gray-600); font-size: 14px; }
.file-drop-icon { font-size: 28px; }
.file-name { font-weight: 600; color: var(--color-teal); }

/* ── Tables ───────────────────────────────── */
.table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
.table th {
    text-align: left;
    padding: 10px 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--color-gray-600);
    border-bottom: 2px solid var(--color-gray-200);
    white-space: nowrap;
}
.table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--color-gray-100);
    vertical-align: middle;
}
.table tbody tr:hover { background: var(--color-gray-100); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .col-check { width: 36px; }
.table .col-center { text-align: center; }
.table .actions-cell { white-space: nowrap; display: flex; gap: 4px; align-items: center; flex-wrap: nowrap; }
.table-sm th, .table-sm td { padding: 7px 10px; }
.table-selectable tbody tr { cursor: pointer; }
.table-selectable tbody tr.selected { background: rgba(0,176,155,.08); }
.tx-check { width: 16px; height: 16px; accent-color: var(--color-teal); cursor: pointer; }
.row-gain td { color: var(--color-dark); }
.row-loss td { background: rgba(229, 62, 62, .04); }

/* ── Badges ───────────────────────────────── */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    white-space: nowrap;
    background: var(--color-gray-200);
    color: var(--color-gray-700);
}
.badge-buy          { background: #c6f6d5; color: #22543d; }
.badge-sell         { background: #fed7d7; color: #742a2a; }
.badge-trade        { background: #bee3f8; color: #2a4365; }
.badge-transfer_in  { background: #c6f6d5; color: #22543d; }
.badge-transfer_out { background: #fed7d7; color: #742a2a; }
.badge-staking_reward { background: #fefcbf; color: #744210; }
.badge-airdrop      { background: #e9d8fd; color: #44337a; }
.badge-mining       { background: #fefcbf; color: #744210; }
.badge-interest     { background: #c6f6d5; color: #22543d; }
.badge-fee          { background: var(--color-gray-200); color: var(--color-gray-600); }
.badge-active       { background: #c6f6d5; color: #22543d; border-radius: var(--radius-sm); display: inline-flex; align-items: center; justify-content: center; }
.badge-deleted      { background: #fed7d7; color: #742a2a; }
.badge-plan         { background: #bee3f8; color: #2a4365; }
.badge-active-ws    { background: var(--color-teal); color: #fff; }
.badge-admin   { background: #e9d8fd; color: #44337a; }
.badge-method  { background: #bee3f8; color: #2a4365; }
.badge-type    { background: var(--color-gray-200); color: var(--color-gray-700); }
/* Import/job status badges */
.badge-completed   { background: #c6f6d5; color: #22543d; }
.badge-pending     { background: #bee3f8; color: #2a4365; }
.badge-processing  { background: #e9d8fd; color: #44337a; }
.badge-failed      { background: #fed7d7; color: #742a2a; }
.badge-cancelled   { background: var(--color-gray-200); color: var(--color-gray-600); }
.badge-done        { background: #c6f6d5; color: #22543d; } /* legacy job queue */
.coin-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    background: var(--color-gray-200);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .5px;
}

/* ── Alerts ───────────────────────────────── */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    margin-bottom: 16px;
    display: flex;
    align-items: flex-start;
    gap: 8px;
}
.alert-error   { background: #fff5f5; border: 1px solid #fc8181; color: #742a2a; }
.alert-success { background: #f0fff4; border: 1px solid #68d391; color: #22543d; }
.alert-warning { background: #fffbeb; border: 1px solid #f6ad55; color: #744210; }
.alert-info    { background: #ebf8ff; border: 1px solid #90cdf4; color: #2a4365; }
.toast-flash { animation: slideDown .3s ease; }
@keyframes slideDown {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Breadcrumb ──────────────────────────── */
.breadcrumb { display: flex; align-items: center; gap: 4px; font-size: 13px; flex: 1; overflow: hidden; }
/* Breadcrumb placed above a page title gets a small bottom gap */
.page-header > .breadcrumb { margin-bottom: 0.25rem; }
.breadcrumb-item { color: var(--color-gray-600); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.breadcrumb-item.active { color: var(--color-dark); font-weight: 600; }
.breadcrumb-sep { color: var(--color-gray-400); flex-shrink: 0; }

/* ── Pagination ──────────────────────────── */
.pagination { display: flex; gap: 4px; margin-top: 16px; flex-wrap: wrap; }
.pagination-form { display: inline-block; }
.pagination-btn {
    min-width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--color-gray-300);
    border-radius: var(--radius-sm);
    background: var(--color-bg);
    color: var(--color-gray-700);
    font-size: 13px;
    cursor: pointer;
    transition: background var(--transition);
    text-decoration: none;
    padding: 0 8px;
}
.pagination-btn:hover  { background: var(--color-gray-200); text-decoration: none; }
.pagination-btn.active { background: var(--color-teal); color: #fff; border-color: var(--color-teal); }

/* ── Filters ─────────────────────────────── */
.filter-card { padding: 12px 16px; }
.filter-form .filter-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; }
.filter-clear { margin-top: 8px; }

/* ── Bulk bar ────────────────────────────── */
/* Hidden by default; JS overrides with style.display='flex' when rows are selected */
.bulk-bar {
    display: none;
    background: var(--color-teal);
    color: #fff;
    padding: 8px 16px;
    align-items: center;
    gap: 12px;
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    font-size: 13px;
    font-weight: 600;
}

/* ── API-only form fields ───────────────── */
/* Hidden by default; JS adds .api-visible when connection_type === 'api' */
.api-only { display: none; }
.api-only.api-visible { display: block; }

/* ── Dropdown ────────────────────────────── */
[data-dropdown] { position: relative; }
.dropdown-menu {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 4px);
    background: var(--color-bg);
    border: 1px solid var(--color-gray-200);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    min-width: 180px;
    z-index: 300;
    overflow: hidden;
}
.dropdown-menu.is-open { display: block; }
.dropdown-menu-wide { min-width: 240px; }
.dropdown-header {
    padding: 8px 14px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--color-gray-500);
    border-bottom: 1px solid var(--color-gray-100);
}
.dropdown-divider { border: none; border-top: 1px solid var(--color-gray-100); }
.dropdown-item {
    display: block;
    padding: 10px 14px;
    font-size: 14px;
    color: var(--color-dark);
    text-decoration: none;
    transition: background var(--transition);
    min-height: 44px;
    display: flex;
    align-items: center;
}
.dropdown-item:hover { background: var(--color-gray-100); text-decoration: none; }
.dropdown-item.active { background: rgba(0,176,155,.1); color: var(--color-teal); font-weight: 600; }
.dropdown-item-danger { color: var(--color-red); }
.dropdown-item-form { display: block; margin: 0; }
.dropdown-item-button {
    width: 100%;
    background: none;
    border: none;
    text-align: left;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    font: inherit;
    color: inherit;
    padding: 10px 14px;
    min-height: 44px;
    display: flex;
    align-items: center;
    transition: background var(--transition);
    font-size: 14px;
}

/* Avatar */
.avatar-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--color-teal);
    color: #fff;
    border: none;
    font-weight: 700;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.avatar-initials { pointer-events: none; }

/* Notifications bell */
.notif-btn {
    background: none;
    border: none;
    font-size: 20px;
    position: relative;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
}
.notif-btn:hover { background: var(--color-gray-100); }
.notif-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    background: var(--color-red);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    border-radius: 10px;
    min-width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 3px;
}

/* Workspace switcher */
.workspace-btn {
    background: var(--color-gray-100);
    border: 1px solid var(--color-gray-300);
    border-radius: var(--radius-sm);
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    min-height: 36px;
    max-width: 160px;
    cursor: pointer;
}
.workspace-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dropdown-caret { font-size: 10px; color: var(--color-gray-500); flex-shrink: 0; }

/* ── Empty State ─────────────────────────── */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    background: var(--color-bg);
    border-radius: var(--radius);
    border: 1px solid var(--color-gray-200);
    margin-bottom: 20px;
}
.empty-icon { font-size: 40px; margin-bottom: 12px; }
.empty-text { color: var(--color-gray-600); margin-bottom: 20px; font-size: 15px; }
.empty-state-inline { padding: 24px; text-align: center; color: var(--color-gray-500); font-size: 14px; }

/* ── Wallet cards ────────────────────────── */
.wallet-card {
    background: var(--color-bg);
    border: 1px solid var(--color-gray-200);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow-sm);
}
.wallet-card-header { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.wallet-name { font-weight: 700; font-size: 15px; flex: 1; }
.wallet-meta { font-size: 12px; color: var(--color-gray-500); margin-bottom: 12px; display: flex; flex-direction: column; gap: 2px; }
.wallet-synced { font-size: 11px; color: var(--color-gray-400); }
.wallet-synced-never { color: var(--color-orange, #ed8936); }
.wallet-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ── Confirm card ────────────────────────── */
.confirm-icon { font-size: 40px; margin-bottom: 12px; }
.confirm-text { font-size: 16px; margin-bottom: 8px; }
.confirm-note { font-size: 13px; color: var(--color-gray-500); margin-bottom: 24px; }
.confirm-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* ── Plans grid ──────────────────────────── */
.plans-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    margin-bottom: 24px;
}
.plan-card {
    background: var(--color-bg);
    border: 2px solid var(--color-gray-200);
    border-radius: var(--radius-lg);
    padding: 24px;
    position: relative;
}
.plan-card-featured { border-color: var(--color-teal); }
.plan-card-current  { opacity: .7; }
.plan-badge {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--color-teal);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 12px;
    border-radius: 20px;
    white-space: nowrap;
}
.plan-name { font-size: 20px; font-weight: 800; margin-bottom: 8px; }
.plan-price { margin-bottom: 16px; }
.plan-price-amount { font-size: 28px; font-weight: 800; color: var(--color-teal); }
.plan-price-period  { font-size: 14px; color: var(--color-gray-500); }
.plan-features { list-style: none; margin-bottom: 20px; }
.plan-features li { padding: 5px 0; font-size: 14px; }
.plan-features li::before { content: '✓ '; color: var(--color-teal); font-weight: 700; }
.feature-disabled { opacity: .4; }
.feature-disabled::before { content: '✗ '; color: var(--color-gray-400); }
.plan-action { margin-top: auto; }

/* Workspace cards */
.workspace-card {
    background: var(--color-bg);
    border: 2px solid var(--color-gray-200);
    border-radius: var(--radius);
    padding: 16px;
}
.workspace-card-active { border-color: var(--color-teal); }
.workspace-card-name { font-weight: 700; font-size: 15px; margin-bottom: 4px; }
.workspace-card-role { font-size: 12px; color: var(--color-gray-500); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 12px; }
.workspace-card-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* Notifications */
.notification-list { display: flex; flex-direction: column; gap: 1px; }
.notification-item {
    background: var(--color-bg);
    border: 1px solid var(--color-gray-200);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 4px;
}
.notification-unread { border-left: 3px solid var(--color-teal); }
.notification-body { flex: 1; }
.notification-message { font-size: 14px; margin-bottom: 4px; }
.notification-time { font-size: 12px; color: var(--color-gray-500); }

/* Permissions grid */
.permissions-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 20px;
}
.permission-item { display: flex; align-items: center; gap: 8px; }
.permission-item label { font-size: 13px; font-family: monospace; cursor: pointer; margin-bottom: 0; font-weight: 400; }

/* Progress bar */
.progress-bar-mini {
    display: inline-block;
    width: 60px;
    height: 4px;
    background: var(--color-gray-200);
    border-radius: 2px;
    overflow: hidden;
    vertical-align: middle;
    margin-right: 4px;
}
.progress-bar-fill { height: 100%; background: var(--color-teal); border-radius: 2px; }

/* Report row */
.report-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--color-gray-100);
    font-size: 14px;
}
.report-row:last-child { border-bottom: none; }

/* Admin nav cards */
.admin-nav-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 20px; }
.admin-nav-card {
    background: var(--color-bg);
    border: 1px solid var(--color-gray-200);
    border-radius: var(--radius);
    padding: 20px;
    text-align: center;
    text-decoration: none;
    color: var(--color-dark);
    font-weight: 600;
    font-size: 14px;
    transition: box-shadow var(--transition), transform var(--transition);
}
.admin-nav-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); text-decoration: none; }
.admin-nav-icon { display: block; font-size: 28px; margin-bottom: 8px; }

/* Danger zone */
.danger-zone { margin-top: 32px; padding-top: 20px; border-top: 1px solid var(--color-gray-200); }

/* Text utilities */
.text-success { color: var(--color-green); font-weight: 600; }
.text-danger  { color: var(--color-red);   font-weight: 600; }
.hide-mobile  { display: none; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.coin-link { text-decoration: none; }
.coin-link:hover .coin-badge { background: var(--color-teal); color: #fff; }
.coin-input { font-family: monospace; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; }

/* ── Tablet ≥ 768px ──────────────────────── */
@media (min-width: 768px) {
    .app-content { padding: 24px; }
    .card-grid { grid-template-columns: 1fr 1fr; }
    .stat-row  { grid-template-columns: repeat(4, 1fr); }
    .plans-grid { grid-template-columns: repeat(2, 1fr); }
    .hide-mobile { display: table-cell; }
    .permissions-grid { grid-template-columns: repeat(3, 1fr); }
    .admin-nav-cards { grid-template-columns: repeat(4, 1fr); }
}

/* ── Desktop ≥ 1024px ────────────────────── */
@media (min-width: 1024px) {
    .bottom-nav { display: none; }
    .app-main { margin-left: var(--sidebar-w); padding-bottom: 0; }
    .app-sidebar {
        transform: translateX(0);
    }
    .sidebar-close { display: none; }
    .sidebar-toggle { display: none; }
    .sidebar-overlay { display: none !important; }
    .plans-grid { grid-template-columns: repeat(4, 1fr); }
}
