/* â”€â”€ Settings Page (Phase 6.1) â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
#page-settings .page-header {
    margin-bottom: 24px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(135deg, var(--accent-glow) 0%, transparent 60%);
    border-radius: 14px;
    padding: 22px 26px;
    border: 1px solid var(--border);
}
#page-settings .page-header h1 {
    font-size: 24px;
    margin: 0 0 6px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 700;
    letter-spacing: -0.01em;
}
#page-settings .page-header h1 i {
    color: var(--accent);
    background: var(--accent-glow);
    width: 42px;
    height: 42px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}
#page-settings .page-subtitle {
    color: var(--text-muted);
    font-size: 14px;
    margin-left: 54px;
}

.settings-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 24px;
    align-items: flex-start;
}
.settings-tabs {
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 12px;
    position: sticky;
    top: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.settings-tab {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 14px;
    border: none;
    background: transparent;
    color: var(--text-primary);
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    text-align: left;
    width: 100%;
    transition: all .18s ease;
    position: relative;
}
.settings-tab i {
    width: 36px;
    height: 36px;
    border-radius: 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-soft);
    color: var(--text-muted);
    font-size: 14px;
    transition: all .18s ease;
}
.settings-tab span { flex: 1; }
.settings-tab:hover {
    background: var(--bg-soft);
    transform: translateX(2px);
}
.settings-tab:hover i { color: var(--accent); }
.settings-tab.active {
    background: linear-gradient(135deg, var(--accent) 0%, #818cf8 100%);
    color: #fff;
    font-weight: 600;
    box-shadow: 0 4px 14px rgba(99,102,241,.35);
    transform: translateX(0);
}
.settings-tab.active i {
    background: rgba(255,255,255,.2);
    color: #fff;
}
.settings-tab.active::after {
    content: '';
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(255,255,255,.9);
    box-shadow: 0 0 8px rgba(255,255,255,.6);
}

.settings-content { min-height: 400px; }
.settings-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 28px 30px;
    box-shadow: 0 2px 8px rgba(0,0,0,.04);
    animation: settingsFadeIn .28s ease;
}
@keyframes settingsFadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}
.settings-card-head {
    margin-bottom: 22px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--border-light);
}
.settings-card-head h2 {
    font-size: 19px;
    margin: 0 0 6px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 700;
    letter-spacing: -0.01em;
}
.settings-card-head h2 i {
    color: var(--accent);
    background: var(--accent-glow);
    width: 36px;
    height: 36px;
    border-radius: 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
}
.settings-card-sub {
    color: var(--text-muted);
    font-size: 13px;
    line-height: 1.5;
    margin-left: 48px;
}

.settings-form {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 18px 22px;
}
.settings-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.settings-field label {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.settings-field input,
.settings-field select,
.settings-field textarea {
    width: 100%;
    padding: 11px 14px;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    font-size: 14px;
    background: var(--bg-card);
    color: var(--text-primary);
    transition: all .15s ease;
    font-family: inherit;
}
.settings-field input:hover,
.settings-field select:hover,
.settings-field textarea:hover {
    border-color: var(--text-muted);
}
.settings-field input:focus,
.settings-field select:focus,
.settings-field textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-glow);
    background: var(--bg-card);
}

/* â”€â”€ Exchange Rates: hero cards â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.settings-rates-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
    margin-bottom: 24px;
}
.rate-input-card {
    border: 1.5px solid var(--border);
    border-radius: 14px;
    padding: 20px;
    background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-soft) 100%);
    transition: all .2s ease;
    position: relative;
    overflow: hidden;
}
.rate-input-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent) 0%, #818cf8 100%);
    opacity: 0;
    transition: opacity .2s;
}
.rate-input-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(99,102,241,.12);
}
.rate-input-card:hover::before { opacity: 1; }
.rate-input-card.readonly {
    opacity: .85;
    border-style: dashed;
    background: var(--bg-soft);
}
.rate-input-card.readonly:hover { transform: none; box-shadow: none; }
.rate-input-card.readonly::before { display: none; }

.rate-label {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 10px;
}
.rate-input-row {
    display: flex;
    align-items: center;
    gap: 10px;
}
.rate-input-row input {
    flex: 1;
    font-size: 22px;
    font-weight: 700;
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    background: var(--bg-card);
    color: var(--text-primary);
    transition: all .15s ease;
    letter-spacing: -0.01em;
}
.rate-input-row input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-glow);
}
.rate-input-row input[readonly] {
    background: transparent;
    cursor: default;
    color: var(--text-muted);
}
.rate-cur {
    font-weight: 700;
    color: var(--accent);
    min-width: 42px;
    font-size: 14px;
    background: var(--accent-glow);
    padding: 8px 12px;
    border-radius: 8px;
    text-align: center;
}
.rate-history-btn {
    margin-top: 12px;
    background: transparent;
    border: none;
    color: var(--accent);
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    padding: 6px 0;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: gap .15s;
}
.rate-history-btn:hover { gap: 10px; text-decoration: underline; }
.rate-derived-note {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 8px;
    font-style: italic;
    display: flex;
    align-items: center;
    gap: 6px;
}
.rate-derived-note::before {
    content: '\f0e7'; /* fa-bolt */
    font-family: 'Font Awesome 6 Free', 'Font Awesome 5 Free';
    font-weight: 900;
    color: var(--accent);
}

/* â”€â”€ Actions row â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.settings-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px solid var(--border-light);
}
.settings-actions .btn-primary {
    background: linear-gradient(135deg, var(--accent) 0%, #818cf8 100%);
    border: none;
    box-shadow: 0 4px 12px rgba(99,102,241,.25);
    padding: 10px 22px;
    font-weight: 600;
}
.settings-actions .btn-primary:hover {
    box-shadow: 0 6px 18px rgba(99,102,241,.4);
    transform: translateY(-1px);
}

/* â”€â”€ Rate history panel â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.rate-history-panel {
    margin-top: 20px;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 18px 20px;
    background: var(--bg-soft);
    animation: settingsFadeIn .25s ease;
}
.rate-history-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
    font-size: 14px;
}
.rate-history-head strong { display: inline-flex; align-items: center; gap: 8px; }
.rate-history-head i { color: var(--accent); }
.settings-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.settings-table th,
.settings-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-light);
}
.settings-table th {
    color: var(--text-muted);
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.settings-table tbody tr { transition: background .12s; }
.settings-table tbody tr:hover { background: var(--bg-card); }
.settings-table tbody tr:last-child td { border-bottom: none; }
.empty-row, .loading-row {
    padding: 22px;
    color: var(--text-muted);
    text-align: center;
    font-size: 13px;
}
.empty-row.error { color: #ef4444; }

/* â”€â”€ Responsive â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
@media (max-width: 900px) {
    .settings-layout { grid-template-columns: 1fr; gap: 16px; }
    .settings-tabs {
        flex-direction: row;
        overflow-x: auto;
        position: static;
        padding: 8px;
        gap: 6px;
    }
    .settings-tabs::-webkit-scrollbar { height: 4px; }
    .settings-tab { white-space: nowrap; flex: 0 0 auto; padding: 10px 14px; }
    .settings-tab.active::after { display: none; }
    .settings-tab i { width: 30px; height: 30px; font-size: 13px; }
    .settings-form { grid-template-columns: 1fr; gap: 14px; }
    .settings-rates-grid { grid-template-columns: 1fr; }
    .settings-card { padding: 20px; }
    #page-settings .page-header { padding: 18px 20px; }
}

/* Logo preview */
.settings-logo-preview { padding: 16px 20px; border-bottom: 1px solid var(--border-light); background: var(--bg-soft); display: flex; align-items: center; justify-content: center; }
.settings-logo-preview img { max-height: 90px; max-width: 280px; object-fit: contain; }

/* â”€â”€ Phase 6.4 â€” My Profile tab â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.profile-avatar-row {
    display: flex; align-items: center; gap: 22px;
    padding: 22px 24px;
    border-bottom: 1px solid var(--border-light);
    background: linear-gradient(135deg, var(--accent-glow) 0%, transparent 70%);
}
.profile-avatar {
    width: 96px; height: 96px; border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accent-2, #8b5cf6));
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 38px; font-weight: 700;
    overflow: hidden; flex: 0 0 auto;
    box-shadow: 0 6px 20px var(--accent-glow);
    border: 3px solid var(--bg-card);
}
.profile-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.profile-avatar-initials { line-height: 1; }
.profile-avatar-actions { display: flex; flex-direction: column; gap: 8px; }
.profile-avatar-hint { font-size: 12px; color: var(--text-muted); }

/* Topbar avatar replacement */
.topbar-avatar {
    width: 22px; height: 22px; border-radius: 50%;
    object-fit: cover; vertical-align: middle;
    border: 1px solid var(--border-light);
}

/* SMTP test log */
.smtp-test-log {
    margin: 16px 24px 24px;
    padding: 14px 16px;
    border-radius: 10px;
    font-size: 13px;
    border: 1px solid var(--border-light);
    background: var(--bg-soft);
}
.smtp-test-log.success { background: rgba(34,197,94,0.08); border-color: rgba(34,197,94,0.35); color: #15803d; }
.smtp-test-log.error   { background: rgba(239,68,68,0.08); border-color: rgba(239,68,68,0.35); color: #b91c1c; }
.smtp-test-log i { margin-right: 8px; }
.smtp-log-pre {
    margin-top: 10px;
    padding: 10px 12px;
    background: rgba(0,0,0,0.04);
    border-radius: 6px;
    font-family: 'Cascadia Mono', Consolas, monospace;
    font-size: 11px;
    color: var(--text-primary);
    white-space: pre-wrap;
    max-height: 220px;
    overflow: auto;
}

/* Switch label */
.switch-label {
    display: inline-flex !important; align-items: center; gap: 10px;
    cursor: pointer; user-select: none;
    text-transform: none !important; letter-spacing: 0 !important;
    font-size: 14px !important; color: var(--text-primary) !important;
}
.switch-label input[type=checkbox] {
    width: 18px; height: 18px; cursor: pointer;
    accent-color: var(--accent);
}

/* Phase 6.6 FX auto-fetch */
.settings-divider { border: 0; border-top: 1px solid var(--border-light); margin: 22px 0 8px; }
.fx-last-line { padding: 8px 0; font-size: 13px; color: var(--text-primary); }
.fx-last-line .muted { color: var(--text-soft); }



/* Phase 10.1 — Permission matrix viewer */
.perm-matrix-search { margin-bottom: 12px; }
.perm-matrix-search input {
    width: 320px; max-width: 100%;
    padding: 8px 12px; border-radius: 8px;
    border: 1px solid var(--border); background: var(--bg-surface);
    color: var(--text-primary); font-size: 13px;
}
.perm-matrix-scroll {
    border: 1px solid var(--border); border-radius: 10px;
    overflow: auto; max-height: 70vh;
    background: var(--bg-surface);
}
table.perm-matrix {
    width: 100%; border-collapse: separate; border-spacing: 0;
    font-size: 13px;
}
table.perm-matrix th, table.perm-matrix td {
    padding: 8px 12px; text-align: left;
    border-bottom: 1px solid var(--border-light);
    white-space: nowrap;
}
table.perm-matrix thead th {
    position: sticky; top: 0; z-index: 2;
    background: var(--bg-elevated); color: var(--text-primary);
    font-weight: 600; text-transform: capitalize;
}
table.perm-matrix th.perm-col-role { text-align: center; min-width: 80px; }
table.perm-matrix th.is-me, table.perm-matrix td.is-me { background: rgba(99,102,241,0.08); }
table.perm-matrix tr.perm-group-row td {
    background: var(--bg-base); font-weight: 600;
    color: var(--text-soft); font-size: 12px; text-transform: uppercase;
    letter-spacing: 0.4px; padding: 10px 12px;
}
table.perm-matrix tr.perm-group-row i { margin-right: 6px; color: var(--accent); }
table.perm-matrix td.perm-name code {
    background: transparent; color: var(--text-primary);
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 12px;
}
table.perm-matrix td.perm-cell { text-align: center; }
table.perm-matrix td.perm-cell.on  { color: #16a34a; }
table.perm-matrix td.perm-cell.off { color: var(--text-mute); opacity: 0.4; }
table.perm-matrix tr.perm-row:hover td { background: var(--bg-hover); }

/* Phase 10.1 — friendly label + dim technical key */
table.perm-matrix td.perm-name { white-space: normal; min-width: 240px; }
table.perm-matrix td.perm-name .perm-name-label {
    color: var(--text-primary); font-weight: 500; line-height: 1.35;
}
table.perm-matrix td.perm-name .perm-name-key {
    display: block; margin-top: 2px;
    color: var(--text-mute); font-size: 11px; opacity: 0.7;
    font-family: 'JetBrains Mono', ui-monospace, monospace;
}
