/* Satr — minimal dark UI on top of Bootstrap 5. Uses logical properties so RTL works automatically. */

:root,
[data-theme="dark"] {
    --bg: #111318;
    --sidebar: #181B22;
    --surface: #1A1D25;
    --surface-2: #20242E;
    --surface-hover: #242935;
    --border: rgba(255, 255, 255, 0.07);
    --border-strong: rgba(255, 255, 255, 0.12);
    --text: #F5F5F7;
    --text-2: #9CA3AF;
    --text-3: #6B7280;
    --primary: #6C63FF;
    --primary-hover: #7D75FF;
    --primary-soft: rgba(108, 99, 255, 0.14);
    --success: #22C55E;
    --danger: #EF4444;
    --danger-soft: rgba(239, 68, 68, 0.12);
    --warning: #F59E0B;
    --warning-soft: rgba(245, 158, 11, 0.1);
    --star: #FBBF24;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.25);
    --shadow-lg: 0 24px 64px rgba(0, 0, 0, 0.5);
    --radius: 14px;
    --radius-sm: 10px;
    --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans Arabic", "Segoe UI Arabic", Tahoma, sans-serif;
    --mono: ui-monospace, "SF Mono", "Cascadia Code", Consolas, monospace;
    color-scheme: dark;
}

[data-theme="light"] {
    --bg: #F6F7F9;
    --sidebar: #FFFFFF;
    --surface: #FFFFFF;
    --surface-2: #F1F2F6;
    --surface-hover: #EEF0F5;
    --border: rgba(17, 19, 24, 0.08);
    --border-strong: rgba(17, 19, 24, 0.14);
    --text: #111318;
    --text-2: #5B6270;
    --text-3: #8A909C;
    --primary-soft: rgba(108, 99, 255, 0.1);
    --shadow: 0 1px 2px rgba(17, 19, 24, 0.05), 0 8px 24px rgba(17, 19, 24, 0.06);
    --shadow-lg: 0 24px 64px rgba(17, 19, 24, 0.16);
    color-scheme: light;
}

/* ---------- Base ---------- */
html, body { height: 100%; }
body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
    --bs-body-bg: var(--bg);
    --bs-body-color: var(--text);
    --bs-border-color: var(--border-strong);
    --bs-secondary-color: var(--text-2);
}
[hidden] { display: none !important; }
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); }
::selection { background: var(--primary-soft); }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
h1, h2, h3 { letter-spacing: -0.01em; }
code { color: var(--text-2); font-size: 0.8em; }

.icon { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.mono { font-family: var(--mono); letter-spacing: 0.02em; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.text-secondary-s { color: var(--text-2); }
.hint { display: block; color: var(--text-3); font-size: 0.8rem; margin-top: 6px; }
.fade-in { animation: fadeIn 0.35s ease both; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- Forms & buttons ---------- */
.form-control, .form-select {
    background-color: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: var(--radius-sm);
    padding: 0.62rem 0.85rem;
    transition: border-color 0.15s, box-shadow 0.15s, background-color 0.15s;
}
.form-control:focus, .form-select:focus {
    background-color: var(--surface-2);
    color: var(--text);
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
}
.form-control::placeholder { color: var(--text-3); }
.form-control[readonly] { background-color: var(--surface-2); }
.form-check-input { background-color: var(--surface-2); border-color: var(--border-strong); }
.form-check-input:checked { background-color: var(--primary); border-color: var(--primary); }
.form-check-input:focus { box-shadow: 0 0 0 3px var(--primary-soft); border-color: var(--primary); }
.form-range::-webkit-slider-thumb { background: var(--primary); }
.form-range::-moz-range-thumb { background: var(--primary); }
.form-range::-webkit-slider-runnable-track { background: var(--surface-2); }
.form-range::-moz-range-track { background: var(--surface-2); }

.field { margin-bottom: 1rem; }
.field > label { display: block; font-size: 0.85rem; font-weight: 500; color: var(--text-2); margin-bottom: 6px; }
.field-error, .field-validation-error { display: block; color: var(--danger); font-size: 0.8rem; margin-top: 4px; }
.input-validation-error { border-color: var(--danger) !important; }
.form-error {
    background: var(--danger-soft); color: #FCA5A5; border: 1px solid rgba(239, 68, 68, 0.25);
    border-radius: var(--radius-sm); padding: 0.6rem 0.8rem; font-size: 0.875rem; margin-bottom: 1rem;
}
[data-theme="light"] .form-error { color: #B91C1C; }
.form-error.is-info { background: var(--primary-soft); color: var(--text); border-color: transparent; }
.form-error.validation-summary-valid { display: none; }
.form-error ul { margin: 0; padding-inline-start: 1.1rem; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 0.875rem; color: var(--text-2); margin-bottom: 1rem; cursor: pointer; }
.check .form-check-input { margin-top: 2px; flex: none; }

.btn { border-radius: var(--radius-sm); font-weight: 500; display: inline-flex; align-items: center; justify-content: center; gap: 8px; transition: all 0.15s ease; }
.btn-primary { --bs-btn-bg: var(--primary); --bs-btn-border-color: var(--primary); --bs-btn-hover-bg: var(--primary-hover); --bs-btn-hover-border-color: var(--primary-hover); --bs-btn-active-bg: #5A50F0; --bs-btn-active-border-color: #5A50F0; --bs-btn-disabled-bg: var(--primary); --bs-btn-disabled-border-color: var(--primary); box-shadow: 0 4px 14px rgba(108, 99, 255, 0.3); }
.btn-primary:hover { transform: translateY(-1px); }
.btn-danger { --bs-btn-bg: var(--danger); --bs-btn-border-color: var(--danger); }
.btn-ghost { background: var(--surface-2); border: 1px solid var(--border); color: var(--text); }
.btn-ghost:hover { background: var(--surface-hover); color: var(--text); border-color: var(--border-strong); }
.btn-link { color: var(--primary); text-decoration: none; }
.btn-lg-s { padding: 0.72rem 1rem; font-size: 1rem; margin-top: 0.25rem; }
.btn-icon {
    display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; flex: none;
    border-radius: 10px; border: 1px solid transparent; background: transparent; color: var(--text-2); transition: all 0.15s ease; padding: 0;
}
.btn-icon:hover { background: var(--surface-hover); color: var(--text); }
.btn-icon-sm { width: 28px; height: 28px; }
.btn-icon-sm .icon { width: 15px; height: 15px; }
.btn-icon-danger:hover { background: var(--danger-soft); color: var(--danger); }
.btn-icon.is-fav { color: var(--star); }
.btn-icon.is-fav .icon { fill: var(--star); }

.spinner { width: 34px; height: 34px; border: 3px solid var(--border-strong); border-top-color: var(--primary); border-radius: 50%; animation: spin 0.8s linear infinite; }
.spinner-sm { width: 15px; height: 15px; border: 2px solid rgba(255, 255, 255, 0.35); border-top-color: #fff; border-radius: 50%; animation: spin 0.7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Password input with trailing buttons */
.pw-input { position: relative; display: flex; align-items: center; }
.pw-input .form-control { padding-inline-end: 84px; }
.pw-input .btn-icon { position: absolute; inset-inline-end: 4px; width: 34px; height: 34px; }
.pw-input .btn-icon + .btn-icon { inset-inline-end: 40px; }
.pw-input:has(.btn-icon:only-of-type) .form-control { padding-inline-end: 44px; }

/* Strength meter */
.strength { margin-top: 8px; }
.strength-bar { height: 4px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.strength-bar span { display: block; height: 100%; width: 0; border-radius: 4px; transition: width 0.25s ease, background 0.25s ease; }
.strength[data-score="1"] .strength-bar span { width: 25%; background: var(--danger); }
.strength[data-score="2"] .strength-bar span { width: 50%; background: var(--warning); }
.strength[data-score="3"] .strength-bar span { width: 75%; background: #84CC16; }
.strength[data-score="4"] .strength-bar span { width: 100%; background: var(--success); }
.strength-label { color: var(--text-3); font-size: 0.75rem; display: block; margin-top: 4px; min-height: 1em; }

/* ---------- Brand ---------- */
.brand { display: flex; align-items: center; gap: 10px; }
.brand-logo { width: 32px; height: 32px; border-radius: 9px; }
.brand-name { font-weight: 700; font-size: 1.15rem; letter-spacing: -0.02em; }
.brand-lg .brand-logo { width: 44px; height: 44px; border-radius: 12px; }
.brand-lg .brand-name { font-size: 1.35rem; line-height: 1.1; }
.brand-tag { color: var(--text-2); font-size: 0.8rem; }

/* ---------- Auth & lock screens ---------- */
.auth-body, .vault-body { background: radial-gradient(1200px 600px at 50% -10%, rgba(108, 99, 255, 0.12), transparent 60%), var(--bg); background-attachment: fixed; }
.auth-wrap { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 64px 16px 32px; position: relative; }
.screen-center { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 32px 16px; }
.auth-card {
    width: 100%; max-width: 420px; background: var(--surface); border: 1px solid var(--border);
    border-radius: 20px; padding: 2rem; box-shadow: var(--shadow-lg);
}
.auth-card-wide { max-width: 500px; }
.auth-card .brand { margin-bottom: 1.75rem; }
.auth-title { font-size: 1.5rem; font-weight: 650; margin-bottom: 0.35rem; }
.auth-card > .text-secondary-s { margin-bottom: 1.5rem; font-size: 0.925rem; }
.auth-switch { text-align: center; margin: 1.25rem 0 0; color: var(--text-2); font-size: 0.9rem; }
.auth-foot { display: flex; align-items: center; gap: 8px; color: var(--text-3); font-size: 0.8rem; margin-top: 1.5rem; text-align: center; }
.prefs { position: absolute; top: 16px; inset-inline-end: 16px; display: flex; gap: 6px; }
.prefs .btn-sm { padding: 0.35rem 0.7rem; font-size: 0.85rem; }
.lock-badge { width: 64px; height: 64px; margin: 0 auto 1.25rem; border-radius: 18px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); }
.lock-badge .icon { width: 28px; height: 28px; }
.user-chip { display: inline-block; margin-top: 6px; padding: 2px 10px; border-radius: 99px; background: var(--surface-2); color: var(--text); font-size: 0.85rem; }
.unlock-links { display: flex; justify-content: space-between; align-items: center; margin-top: 1rem; }
.warn-box, .info-box { display: flex; gap: 12px; padding: 0.85rem 1rem; border-radius: var(--radius-sm); font-size: 0.875rem; margin-bottom: 1.25rem; }
.warn-box { background: var(--warning-soft); border: 1px solid rgba(245, 158, 11, 0.25); color: var(--text); }
.warn-box .icon { color: var(--warning); margin-top: 2px; }
.warn-box p { margin: 4px 0 0; color: var(--text-2); }
.info-box { background: var(--primary-soft); color: var(--text-2); }
.info-box .icon { color: var(--primary); margin-top: 1px; }

/* ---------- Vault shell ---------- */
.vault-shell { display: flex; min-height: 100vh; }
.sidebar {
    width: 260px; flex: none; background: var(--sidebar); border-inline-end: 1px solid var(--border);
    display: flex; flex-direction: column; padding: 18px 12px; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.sidebar .brand { padding: 4px 10px 20px; }
.nav-main, .nav-cats { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
    display: flex; align-items: center; gap: 12px; width: 100%; padding: 9px 12px; border: 0; border-radius: 10px;
    background: transparent; color: var(--text-2); font-size: 0.9rem; font-weight: 500; text-align: start; transition: background 0.15s, color 0.15s;
}
.nav-item:hover { background: var(--surface-hover); color: var(--text); }
.nav-item.active { background: var(--primary-soft); color: var(--text); }
.nav-item.active .icon { color: var(--primary); }
.nav-item > span:not(.count):not(.dot) { flex: 1; min-width: 0; }
.nav-item .count { flex: none; font-size: 0.75rem; color: var(--text-3); font-variant-numeric: tabular-nums; }
.nav-heading { display: flex; align-items: center; justify-content: space-between; padding: 18px 12px 6px; font-size: 0.72rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-3); }
.nav-cat { padding-block: 7px; }
.sidebar-footer { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 2px; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--dot); }
.sidebar-backdrop, .detail-backdrop { display: none; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
    position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 12px; padding: 14px 28px;
    background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(12px); border-bottom: 1px solid var(--border);
}
.search { position: relative; flex: 1; max-width: 620px; }
.search > .icon { position: absolute; inset-inline-start: 13px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.search .form-control { padding-inline-start: 40px; background-color: var(--surface); }
.btn-add { padding: 0.55rem 1rem; }
.dropdown-menu { background: var(--surface); border: 1px solid var(--border-strong); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 6px; --bs-dropdown-link-color: var(--text); --bs-dropdown-link-hover-bg: var(--surface-hover); --bs-dropdown-link-hover-color: var(--text); --bs-dropdown-link-active-bg: var(--primary-soft); --bs-dropdown-link-active-color: var(--text); }
.dropdown-item { display: flex; align-items: center; gap: 10px; border-radius: 8px; padding: 8px 12px; font-size: 0.9rem; }
.dropdown-item .icon { color: var(--text-2); }

.content { flex: 1; padding: 28px; max-width: 1100px; width: 100%; }
.content > section { animation: fadeIn 0.25s ease both; }
.view-header { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 22px; gap: 16px; }
.view-title { font-size: 1.6rem; font-weight: 650; margin: 0 0 4px; }

/* Cards */
.card-s { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.card-s-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.card-s-head h2, .card-s-title { display: flex; align-items: center; gap: 10px; font-size: 0.95rem; font-weight: 600; margin: 0; }
.card-s-head h2 .icon, .card-s-title .icon { color: var(--primary); }
.card-s-title { margin-bottom: 8px; }
.card-s-head .btn-link { padding: 0; font-size: 0.85rem; }

/* Dashboard */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.stat {
    display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: start; padding: 18px; border-radius: var(--radius);
    background: var(--surface); border: 1px solid var(--border); color: var(--text); box-shadow: var(--shadow); transition: transform 0.15s, border-color 0.15s;
}
.stat:hover { transform: translateY(-2px); border-color: var(--border-strong); }
.stat-icon { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); margin-bottom: 10px; }
.stat-value { font-size: 1.75rem; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-label { color: var(--text-2); font-size: 0.85rem; }
.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.dash-cats { grid-column: 1 / -1; }
.cat-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.cat-chip {
    display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 99px; max-width: 240px;
    background: var(--surface-2); border: 1px solid var(--border); color: var(--text); font-size: 0.875rem; transition: background 0.15s;
}
.cat-chip:hover { background: var(--surface-hover); }
.cat-count { color: var(--text-3); font-size: 0.8rem; font-variant-numeric: tabular-nums; }
.empty-inline { color: var(--text-3); font-size: 0.875rem; margin: 8px 4px; }

/* Item list */
.item-list { display: flex; flex-direction: column; gap: 6px; }
.item-row {
    display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-radius: 12px; cursor: pointer;
    background: var(--surface); border: 1px solid var(--border); transition: background 0.15s, border-color 0.15s, transform 0.15s;
}
.item-row:hover { background: var(--surface-hover); }
.item-row.selected { border-color: var(--primary); background: var(--primary-soft); }
.item-list.compact .item-row { background: transparent; border-color: transparent; padding: 8px 6px; }
.item-list.compact .item-row:hover { background: var(--surface-hover); }
.item-main { flex: 1; min-width: 0; }
.item-title { display: flex; align-items: center; gap: 6px; font-weight: 550; font-size: 0.925rem; }
.item-sub { color: var(--text-2); font-size: 0.82rem; margin-top: 1px; }
.icon-star { width: 14px; height: 14px; color: var(--star); fill: var(--star); }
.item-actions { display: flex; gap: 2px; opacity: 0.55; transition: opacity 0.15s; }
.item-row:hover .item-actions, .item-row:focus-within .item-actions { opacity: 1; }
.avatar {
    width: 38px; height: 38px; flex: none; border-radius: 11px; display: grid; place-items: center;
    font-weight: 650; font-size: 0.95rem; color: #fff; background: var(--dot);
}
.avatar-lg { width: 56px; height: 56px; border-radius: 15px; font-size: 1.4rem; }
.avatar-lg .icon { width: 24px; height: 24px; }
.hue-0 { --dot: #6C63FF; } .hue-1 { --dot: #0EA5E9; } .hue-2 { --dot: #10B981; } .hue-3 { --dot: #F59E0B; }
.hue-4 { --dot: #EF4444; } .hue-5 { --dot: #EC4899; } .hue-6 { --dot: #8B5CF6; } .hue-7 { --dot: #14B8A6; }
.empty { text-align: center; padding: 56px 16px; color: var(--text-2); }
.empty-icon { width: 40px; height: 40px; color: var(--text-3); margin-bottom: 10px; }

/* Categories */
.inline-form { display: flex; gap: 10px; margin-bottom: 16px; padding: 14px; }
.cat-list { display: flex; flex-direction: column; gap: 6px; }
.cat-row { display: flex; align-items: center; gap: 12px; padding: 10px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; }
.cat-name { flex: 1; min-width: 0; display: flex; background: none; border: 0; color: var(--text); font-weight: 500; text-align: start; padding: 0; }
.cat-name:hover { color: var(--primary); }
.badge-s { display: inline-flex; align-items: center; padding: 3px 9px; border-radius: 99px; font-size: 0.72rem; font-weight: 500; background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); }
.badge-cat { background: var(--primary-soft); color: var(--text); border-color: transparent; }

/* Generator */
.generator { max-width: 640px; }
.gen-output { display: flex; align-items: center; gap: 6px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 6px; }
.gen-output .form-control { border: 0; background: transparent; font-size: 1.15rem; padding: 0.6rem; box-shadow: none; direction: ltr; text-align: left; }
.switches { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 6px 0 20px; }
.switch { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); cursor: pointer; font-size: 0.9rem; }
.switch .form-check-input { margin: 0; }
.gen-actions { display: flex; gap: 10px; }

/* Settings */
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
.pref-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border); }
.seg { display: inline-flex; background: var(--surface-2); border-radius: 10px; padding: 3px; gap: 2px; }
.seg form { display: contents; }
.seg-btn { display: inline-flex; align-items: center; gap: 6px; border: 0; background: transparent; color: var(--text-2); padding: 6px 12px; border-radius: 8px; font-size: 0.85rem; font-weight: 500; }
.seg-btn .icon { width: 15px; height: 15px; }
.seg-btn.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

/* Detail panel */
.detail-panel {
    width: 380px; flex: none; background: var(--sidebar); border-inline-start: 1px solid var(--border);
    position: sticky; top: 0; height: 100vh; overflow-y: auto; padding: 16px 20px 24px; animation: slideIn 0.22s ease both;
}
@keyframes slideIn { from { opacity: 0; transform: translateX(12px); } to { opacity: 1; transform: none; } }
[dir="rtl"] .detail-panel { animation-name: slideInRtl; }
@keyframes slideInRtl { from { opacity: 0; transform: translateX(-12px); } to { opacity: 1; transform: none; } }
.detail-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.detail-head-actions { display: flex; gap: 2px; }
.detail-hero { display: flex; gap: 14px; align-items: center; margin-bottom: 20px; }
.detail-hero-text { min-width: 0; }
.detail-title { font-size: 1.2rem; font-weight: 650; margin: 0 0 6px; overflow-wrap: anywhere; }
.detail-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.detail-fields { display: flex; flex-direction: column; gap: 10px; }
.detail-field { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; }
.detail-label { font-size: 0.75rem; color: var(--text-3); font-weight: 500; margin-bottom: 2px; }
.detail-value-row { display: flex; align-items: center; gap: 8px; }
.detail-value { flex: 1; min-width: 0; font-size: 0.925rem; }
.detail-value.masked { letter-spacing: 0.15em; color: var(--text-2); }
.detail-value.break { overflow-wrap: anywhere; direction: ltr; text-align: start; unicode-bidi: plaintext; }
.detail-value.pre { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.55; max-height: 50vh; overflow-y: auto; }
.detail-buttons { display: flex; gap: 2px; flex: none; align-self: flex-start; }
.detail-buttons .btn-icon { width: 32px; height: 32px; }
.detail-fields > .strength { margin: -2px 4px 0; }
.detail-meta { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 6px; font-size: 0.8rem; color: var(--text-3); }
.detail-meta > div { display: flex; justify-content: space-between; }

/* Modals */
.modal-content { background: var(--surface); border: 1px solid var(--border-strong); border-radius: 18px; box-shadow: var(--shadow-lg); color: var(--text); }
.modal-header, .modal-footer { border-color: var(--border); }
.modal-header { padding: 16px 20px; }
.modal-body { padding: 20px; }
.modal-title { font-size: 1.1rem; font-weight: 600; margin: 0; }
.modal-backdrop.show { opacity: 0.6; }
.confirm-icon { width: 52px; height: 52px; margin: 6px auto 14px; border-radius: 14px; display: grid; place-items: center; background: var(--danger-soft); color: var(--danger); }
.confirm-icon .icon { width: 24px; height: 24px; }
#confirm-modal .modal-footer { justify-content: center; }

/* Toasts */
.toast-stack { position: fixed; bottom: 20px; inset-inline-end: 20px; z-index: 2000; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast-s {
    display: flex; align-items: center; gap: 10px; min-width: 240px; max-width: 380px; padding: 12px 16px; border-radius: 12px;
    background: var(--surface-2); border: 1px solid var(--border-strong); box-shadow: var(--shadow-lg); color: var(--text); font-size: 0.875rem;
    opacity: 0; transform: translateY(8px); transition: opacity 0.25s, transform 0.25s; pointer-events: auto;
}
.toast-s.show { opacity: 1; transform: none; }
.toast-success .icon { color: var(--success); }
.toast-error .icon { color: var(--danger); }

/* ---------- Responsive ---------- */
@media (max-width: 1199.98px) {
    .detail-panel { position: fixed; inset-block: 0; inset-inline-end: 0; z-index: 1040; width: min(420px, 100%); box-shadow: var(--shadow-lg); }
    .detail-backdrop { display: block; position: fixed; inset: 0; z-index: 1035; background: rgba(0, 0, 0, 0.5); }
    .detail-backdrop[hidden] { display: none !important; }
}
@media (max-width: 991.98px) {
    .sidebar { position: fixed; inset-block: 0; inset-inline-start: 0; z-index: 1050; transform: translateX(-100%); transition: transform 0.25s ease; box-shadow: var(--shadow-lg); }
    [dir="rtl"] .sidebar { transform: translateX(100%); }
    body.sidebar-open .sidebar { transform: none; }
    body.sidebar-open .sidebar-backdrop { display: block; position: fixed; inset: 0; z-index: 1045; background: rgba(0, 0, 0, 0.5); }
    .stats { grid-template-columns: repeat(2, 1fr); }
    .settings-grid, .dash-grid { grid-template-columns: 1fr; }
    .topbar { padding: 12px 16px; }
    .content { padding: 20px 16px; }
}
@media (max-width: 575.98px) {
    .switches { grid-template-columns: 1fr; }
    .auth-card { padding: 1.5rem; }
    .view-title { font-size: 1.35rem; }
    .stat { padding: 14px; }
    .stat-value { font-size: 1.4rem; }
    .item-actions { opacity: 1; }
    .toast-stack { inset-inline: 12px; bottom: 12px; }
    .toast-s { max-width: none; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
