/* RaPay CRM presentation layer. Existing content and permission guards stay intact. */
.crm-theme .order-actions summary { cursor: pointer; list-style: none; display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border: 1px solid #dce4ef; border-radius: 8px; color: #145bea; background: #eef4ff; font-size: 20px; }
.crm-theme .order-actions summary::-webkit-details-marker { display: none; }
.crm-theme .order-actions summary:focus-visible { outline: 2px solid #145bea; outline-offset: 2px; }
.crm-theme .order-actions[open] .refund-button { display: block; margin-top: 5px; }
.crm-theme #hidden-catalog { order: 100; }
.crm-theme .terminal-quick-filters { display: grid; gap: 8px; margin: 12px 0 18px; }
.crm-theme .terminal-quick-filters > div { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.crm-theme .terminal-quick-filters button { width: auto; border-radius: 18px; padding: 5px 10px; background: #eef4ff; color: #145bea; }
.crm-theme .terminal-quick-filters button[aria-pressed="true"] { background: #145bea; color: white; }
.crm-theme .sidebar .account-bar { display: grid; grid-template-columns: minmax(80px, 1fr) auto; grid-template-rows: auto; max-width: none; gap: 10px; padding: 0; }
.crm-theme .sidebar #session-user { grid-area: 1 / 1; width: auto; }
.crm-theme .sidebar #session-role:empty { display: none; }
.crm-theme .sidebar #logout-button { grid-area: 1 / 2; margin: 0; align-self: center; }
.crm-theme .payment-settings-row { align-items: center; }
.crm-theme .payment-settings-row > * { align-self: center; margin-top: 0; margin-bottom: 0; }
.crm-theme .payment-settings-row input, .crm-theme .payment-settings-row select { height: 40px; }
.crm-theme .payment-settings-row .rate-settings-grid { align-items: center; }
.crm-theme .payment-settings-actions:has(.payment-operation-result:empty) .payment-operation-result { display: none; }
.crm-theme .orders-panel td { padding-top: 7px; padding-bottom: 7px; }
.crm-theme .orders-panel .order-usd-rate-control { display: flex; gap: 4px; align-items: center; }
.crm-theme .orders-panel .order-usd-rate-control input, .crm-theme .orders-panel .order-usd-rate-control button { height: 30px; padding: 4px 8px; }
.crm-theme [data-bank-code="raif"],
.crm-theme .panel:has(> #weekly-chart),
.crm-theme .panel:has(> #monthly-chart) { display: none !important; }
.crm-theme #terminals .terminal-filter { margin: 20px 0; }
.crm-theme .terminal-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.crm-theme .terminal-tags span { color: #145bea; background: #eef4ff; border: 1px solid #dce6fa; border-radius: 16px; padding: 3px 9px; font-size: 12px; overflow-wrap: anywhere; }
.crm-theme #terminal-search { width: 100%; max-width: none; min-height: 46px; }
.crm-theme #terminals-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.crm-theme .terminal-group { border: 1px solid #e0e7f1; border-radius: 12px; background: #fff; overflow: hidden; }
.crm-theme .terminal-group > summary { padding: 16px; background: #f5f8fd; display: flex; justify-content: space-between; gap: 16px; align-items: center; cursor: pointer; }
.crm-theme .terminal-group > summary small { display: block; font-size: 12px; font-weight: 400; color: #728099; }
.crm-theme .terminals-grid-group { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; padding: 0; }
.crm-theme .terminal-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 20px; padding: 18px; border: 0; border-bottom: 1px solid #e8edf5; border-radius: 0; background: #fff; box-shadow: none; }
.crm-theme .terminal-card h3 { margin: 5px 0; }
.crm-theme .terminal-card p { margin: 0; color: #65738b; font-size: 12px; }
.crm-theme .terminal-meta { display: flex; flex-direction: column; gap: 10px; align-items: flex-end; }
.crm-theme .terminal-meta a { padding: 8px 12px; border: 1px solid #145bea; border-radius: 8px; background: #145bea; color: #fff; font-size: 12px; }
.crm-theme .terminal-meta a:hover { background: #1048bd; border-color: #1048bd; color: #fff; }
.crm-theme .terminal-meta a:focus-visible { outline: 3px solid #145bea; outline-offset: 3px; }
@media (max-width: 640px) {
    .crm-theme .terminal-group > summary { align-items: flex-start; flex-direction: column; }
    .crm-theme .terminal-card { grid-template-columns: 1fr; gap: 12px; }
    .crm-theme .terminal-meta { flex-direction: row; justify-content: space-between; align-items: center; }
}
.crm-theme {
    --blue: #145bea;
    --blue-deep: #1045b4;
    --red: #e92848;
    --text: #17263e;
    --muted: #728099;
    --line: #dce4ef;
    --line-soft: #e8edf5;
    --panel: #fff;
    --field: #f7f9fc;
}
.crm-theme body {
    margin: 0;
    color: #17263e;
    background: #f3f6fb;
    font-family: 'Segoe UI Variable', 'Segoe UI', system-ui, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}
.crm-theme body::before { display: none; }
.crm-theme .admin-shell {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "sidebar" "workspace";
    max-width: 1800px;
    margin: 0 auto;
    padding: 24px;
    gap: 28px;
    align-items: start;
}
.crm-theme [hidden] { display: none !important; }
.crm-theme .sidebar {
    position: relative;
    top: 0;
    padding: 14px;
    border: 1px solid #e0e7f1;
    border-top: 3px solid #e92848;
    border-radius: 20px;
    background: #fff;
    box-shadow: 0 6px 24px #17263e05;
    min-width: 0;
}
.crm-theme .sidebar .admin-brand { display: grid; grid-template-columns: 84px minmax(0, 1fr) auto; gap: 18px; align-items: center; }
.crm-theme .sidebar .rapay-logo-image { width: 72px; height: auto; margin: 0; }
.crm-theme .side-nav { display: flex; flex-direction: row; gap: 6px; overflow: visible; padding: 0; }
.crm-theme .side-nav a { flex: 1 1 0; justify-content: center; }
.crm-theme .side-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    min-height: 46px;
    padding: 12px 14px;
    border: 1px solid transparent;
    border-radius: 11px;
    background: transparent;
    color: #65738b;
    font-size: 13px;
    font-weight: 600;
    text-transform: none;
    letter-spacing: 0;
    box-shadow: none;
}
.crm-theme .side-nav a::before { content: '◈'; color: #8a9bb6; font-size: 18px; width: 20px; text-align: center; }
.crm-theme .side-nav a[data-admin-route='overview']::before { content: '▥'; }
.crm-theme .side-nav a[data-admin-route='orders']::before { content: '⇄'; }
.crm-theme .side-nav a[data-admin-route='terminals']::before { content: '▣'; }
.crm-theme .side-nav a[data-admin-route='users']::before { content: '◎'; }
.crm-theme .side-nav a:hover { background: #f3f6fc; color: #145bea; }
.crm-theme .side-nav a.is-active { background: #145bea; color: #fff; box-shadow: 0 5px 12px #145bea24; }
.crm-theme .side-nav a.is-active::before { color: #fff; }
.crm-theme .account-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 0; border-top: 0; max-width: 180px; }
.crm-theme #session-user { font-size: 12px; color: #728099; }
.crm-theme #session-user b { font-size: 15px; color: #17263e; font-weight: 650; }
.crm-theme #logout-button { background: #f5f7fb; color: #65738b; border: 1px solid #e0e7f1; box-shadow: none; }
.crm-theme .workspace { min-width: 0; display: grid; gap: 22px; }
.crm-theme .panel, .crm-theme .stat-card, .crm-theme .rates-panel {
    background: #fff;
    border: 1px solid #e0e7f1;
    border-radius: 16px;
    box-shadow: 0 4px 18px #17263e04;
    overflow: hidden;
}
.crm-theme .panel { padding: 24px; }
.crm-theme .panel-head { gap: 16px; margin-bottom: 20px; }
.crm-theme h1, .crm-theme h2, .crm-theme h3 { color: #17263e; letter-spacing: -.025em; text-transform: none; }
.crm-theme h1 { font-size: 32px; font-weight: 650; }
.crm-theme h2 { font-size: 18px; font-weight: 650; }
.crm-theme h3 { font-size: 15px; font-weight: 600; }
.crm-theme .panel-head > span { color: #728099; font-size: 11px; font-weight: 600; letter-spacing: .035em; }
.crm-theme button, .crm-theme input, .crm-theme select { font-family: inherit; border-radius: 9px; font-size: 13px; }
.crm-theme button { background: #145bea; color: #fff; border: 1px solid transparent; box-shadow: none; font-weight: 600; text-transform: none; }
.crm-theme button:hover { filter: brightness(.96); }
.crm-theme input, .crm-theme select { color: #17263e; background: #f7f9fc; border: 1px solid #dce4ef; padding: 10px 12px; font-weight: 400; }
.crm-theme input:focus, .crm-theme select:focus { outline: 2px solid #145bea45; outline-offset: 2px; }
.crm-theme .stats-period-toolbar { padding: 18px 22px; background: #fff; border: 1px solid #e0e7f1; border-radius: 16px; }
.crm-theme .stats-periods button { background: #f2f5fa; color: #65738b; }
.crm-theme .stats-periods button.is-active { background: #145bea; color: #fff; }
.crm-theme .stat-card { padding: 22px; border-top: 3px solid #145bea; }
.crm-theme .stat-card:nth-child(2) { border-top-color: #e92848; }
.crm-theme .stat-card > span { color: #728099; font-size: 11px; letter-spacing: .07em; font-weight: 600; }
.crm-theme .stat-card strong { font-variant-numeric: tabular-nums; letter-spacing: -.035em; }
.crm-theme table { border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.crm-theme th { background: #f5f7fb; color: #728099; font-size: 10px; font-weight: 650; letter-spacing: .06em; padding: 14px 12px; border-bottom: 1px solid #e0e7f1; }
.crm-theme td { padding: 14px 12px; color: #34445e; border-bottom: 1px solid #edf1f7; font-weight: 400; }
.crm-theme tbody tr:hover { background: #f7faff; }
.crm-theme .collapsible-head { padding: 0; min-height: 40px; margin-bottom: 0; }
.crm-theme details[open] > .collapsible-head { margin-bottom: 20px; border-bottom: 1px solid #e8edf5; padding-bottom: 18px; }
.crm-theme .login-screen { background: radial-gradient(ellipse at 20% 20%, #145bea12, transparent 55%), #f3f6fb; }
.crm-theme .login-card { background: white; border: 1px solid #e0e7f1; border-top: 3px solid #e92848; border-radius: 22px; box-shadow: 0 24px 80px #17263e12; }
.crm-theme svg { font-family: inherit; }
@media (max-width: 1050px) {
    .crm-theme .admin-shell { grid-template-columns: 1fr; grid-template-areas: "sidebar" "workspace"; padding: 14px; gap: 18px; }
    .crm-theme .sidebar { position: relative; top: 0; padding: 16px; }
    .crm-theme .sidebar .admin-brand { grid-template-columns: minmax(0, 1fr) auto; gap: 16px; }
    .crm-theme .side-nav { grid-column: 1 / -1; grid-row: 2; }
    .crm-theme .account-bar { grid-column: 2; grid-row: 1; }
    .crm-theme .side-nav { flex-direction: row; flex-wrap: wrap; }
    .crm-theme .side-nav a { flex: 1 1 140px; }
    .crm-theme .account-bar { padding-top: 12px; align-items: center; }
}
@media (max-width: 640px) {
    .crm-theme .admin-shell { padding: 10px; }
    .crm-theme .panel { padding: 16px; }
    .crm-theme .side-nav a { font-size: 12px; flex-basis: 120px; padding: 10px; }
    .crm-theme .stats-period-toolbar { padding: 14px; }
    .crm-theme h2 { font-size: 16px; }
}
