/* =============================================
   AriHom - Profesyonel Akıllı Ev Sistemi
   Ana Stil Dosyası v2.0
   ============================================= */

/* ---- Değişkenler ---- */
:root {
    --sidebar-w: 260px;
    --navbar-h: 58px;

    --bg-main: #f0f2f8;
    --bg-card: #ffffff;
    --bg-sidebar: #111827;
    --bg-sidebar-hover: rgba(255,255,255,.08);
    --bg-sidebar-active: #2563eb;

    --text-primary: #111827;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    --text-sidebar: rgba(255,255,255,.72);
    --text-sidebar-active: #fff;

    --border: #e5e7eb;
    --border-focus: #2563eb;

    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --success: #16a34a;
    --danger: #dc2626;
    --warning: #d97706;
    --info: #0891b2;

    --shadow-sm: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
    --shadow-md: 0 4px 12px rgba(0,0,0,.08);
    --shadow-lg: 0 10px 30px rgba(0,0,0,.12);

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;

    --transition: .2s ease;
}

/* ---- Dark Mode ---- */
[data-theme="dark"] {
    --bg-main: #0f172a;
    --bg-card: #1e293b;
    --bg-sidebar: #0a101e;
    --border: #334155;

    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #94a3b8;
}

/* ---- Temel ---- */
*, *::before, *::after { box-sizing: border-box; }

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--bg-main);
    color: var(--text-primary);
    min-height: 100vh;
    transition: background var(--transition), color var(--transition);
}

/* ---- Mobil sabitleme: yakınlaştırma / taşma yok (tüm sayfalar) ----
   • text-size-adjust: yatay çevirince iOS/Android yazıları kendiliğinden büyütmesin
   • touch-action: manipulation → çift dokunma yakınlaştırması kapalı, tıklama gecikmesi yok
   • overflow-x: clip → hiçbir öğe sayfayı yana kaydıramaz (sticky navbar'ı bozmaz)
   • 16px form alanı → iOS Safari odaklanınca sayfayı büyütmez */
html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    touch-action: manipulation;
    overflow-x: clip;
}
body { overflow-x: clip; max-width: 100%; -webkit-tap-highlight-color: transparent; }
.main-content, .page-content { min-width: 0; max-width: 100%; }
img, svg, video, canvas { max-width: 100%; }
@media (max-width: 991.98px) {
    input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=color]),
    select, textarea, .form-control, .form-select, .form-control-sm, .form-select-sm,
    .input-group-text, .swal2-input, .swal2-select, .swal2-textarea { font-size: 16px !important; }
}

/* ---- Sidebar ---- */
.sidebar {
    position: fixed;
    top: 0; left: 0;
    width: var(--sidebar-w);
    height: 100vh;
    background: var(--bg-sidebar);
    display: flex;
    flex-direction: column;
    z-index: 1040;
    transition: transform var(--transition);
    overflow: hidden;
}

.sidebar-header {
    padding: 20px 20px 16px;
    border-bottom: 1px solid rgba(255,255,255,.06);
    flex-shrink: 0;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: #fff;
}

.sidebar-brand .brand-icon {
    width: 36px; height: 36px;
    background: var(--primary);
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.sidebar-brand .brand-name {
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -.3px;
}

.sidebar-body {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,.1) transparent;
}

.sidebar-section-label {
    font-size: .68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .8px;
    color: rgba(255,255,255,.3);
    padding: 8px 8px 4px;
    margin-top: 8px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-sidebar);
    text-decoration: none;
    font-size: .875rem;
    font-weight: 500;
    transition: all var(--transition);
    margin-bottom: 2px;
}

.sidebar-link:hover {
    background: var(--bg-sidebar-hover);
    color: var(--text-sidebar-active);
}

.sidebar-link.active {
    background: var(--bg-sidebar-active);
    color: var(--text-sidebar-active);
    box-shadow: 0 2px 8px rgba(37,99,235,.4);
}

.sidebar-link .icon {
    width: 20px;
    text-align: center;
    font-size: .9rem;
    flex-shrink: 0;
}

.sidebar-link .badge-count {
    margin-left: auto;
    background: var(--danger);
    color: #fff;
    font-size: .65rem;
    padding: 1px 6px;
    border-radius: 10px;
    font-weight: 600;
}

.sidebar-footer {
    padding: 12px;
    border-top: 1px solid rgba(255,255,255,.06);
    flex-shrink: 0;
}

/* ---- Ana İçerik ---- */
.main-content {
    margin-left: var(--sidebar-w);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ---- Üst Navbar ---- */
.top-navbar {
    height: var(--navbar-h);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 12px;
    position: sticky;
    top: 0;
    z-index: 100;
    flex-shrink: 0;
    box-shadow: var(--shadow-sm);
}

.top-navbar .page-title {
    font-size: .95rem;
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
}

.btn-icon {
    width: 36px; height: 36px;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-secondary);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    transition: all var(--transition);
    position: relative;
}

.btn-icon:hover {
    background: var(--bg-main);
    color: var(--text-primary);
}

.btn-icon .badge-dot {
    position: absolute;
    top: 6px; right: 6px;
    width: 8px; height: 8px;
    background: var(--danger);
    border-radius: 50%;
    border: 2px solid var(--bg-card);
}

.user-avatar {
    width: 34px; height: 34px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: .8rem;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    flex-shrink: 0;
}

/* ---- Sayfa İçeriği ---- */
.page-content {
    padding: 24px;
    flex: 1;
}

/* ---- Kartlar ---- */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition), transform var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-md);
}

/* ---- İstatistik Kartları ---- */
.stat-card {
    position: relative;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow-sm);
    transition: transform .22s cubic-bezier(.4,0,.2,1), box-shadow .22s ease;
    will-change: transform;
    overflow: hidden;
}
.stat-card::before {
    content: '';
    position: absolute; top: 0; left: 0; right: 0; height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,.5), transparent);
    opacity: .5; pointer-events: none;
}
[data-theme="dark"] .stat-card::before { background: linear-gradient(90deg, transparent, rgba(255,255,255,.08), transparent); }
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

.stat-icon {
    width: 48px; height: 48px;
    border-radius: 13px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}
@media (prefers-reduced-motion: reduce) {
    .stat-card { transition: none; }
    .stat-card:hover { transform: none; }
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1;
    color: var(--text-primary);
}

.stat-label {
    font-size: .8rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ---- Kanal Kartları (Dashboard) ---- */
.channel-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
}

.channel-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 3px; height: 100%;
    background: var(--ch-color, var(--primary));
    border-radius: 3px 0 0 3px;
}

.channel-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.channel-card.offline {
    opacity: .7;
}

.ch-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 12px;
}

.ch-icon-wrap {
    width: 40px; height: 40px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.ch-name {
    font-size: .9rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    line-height: 1.3;
}

.ch-meta {
    font-size: .72rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ---- Büyük Toggle Switch ---- */
.toggle-switch {
    position: relative;
    width: 52px; height: 28px;
    flex-shrink: 0;
}

.toggle-switch input {
    opacity: 0;
    width: 0; height: 0;
    position: absolute;
}

.toggle-slider {
    position: absolute;
    inset: 0;
    background: #d1d5db;
    border-radius: 28px;
    cursor: pointer;
    transition: background var(--transition);
}

[data-theme="dark"] .toggle-slider {
    background: #475569;
}

.toggle-slider::after {
    content: '';
    position: absolute;
    left: 3px; top: 3px;
    width: 22px; height: 22px;
    background: #fff;
    border-radius: 50%;
    transition: transform var(--transition);
    box-shadow: 0 1px 3px rgba(0,0,0,.2);
}

[data-theme="dark"] .toggle-slider::after {
    background: #f1f5f9;
}

.toggle-switch input:checked + .toggle-slider {
    background: var(--ch-color, var(--primary));
}

.toggle-switch input:checked + .toggle-slider::after {
    transform: translateX(24px);
}

.toggle-switch input:disabled + .toggle-slider {
    opacity: .5;
    cursor: not-allowed;
}

/* ---- Durum Noktası ---- */
.status-dot {
    width: 9px; height: 9px;
    border-radius: 50%;
    flex-shrink: 0;
}

.status-dot.online {
    background: var(--success);
    box-shadow: 0 0 0 3px rgba(22,163,74,.2);
    animation: pulse-green 2s infinite;
}

.status-dot.offline {
    background: #9ca3af;
}

@keyframes pulse-green {
    0%, 100% { box-shadow: 0 0 0 3px rgba(22,163,74,.2); }
    50% { box-shadow: 0 0 0 6px rgba(22,163,74,.05); }
}

/* ---- Değer Göstergesi ---- */
.ch-value-display {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--ch-color, var(--primary));
    line-height: 1;
}

.ch-value-unit {
    font-size: .8rem;
    color: var(--text-muted);
    margin-left: 3px;
}

/* ---- Güncelleme Zamanı ---- */
.ch-updated {
    font-size: .68rem;
    color: var(--text-muted);
    margin-top: 8px;
}

/* ---- Oda Filtre Butonları ---- */
.room-filters {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.room-filter-btn {
    padding: 6px 14px;
    border-radius: 20px;
    font-size: .82rem;
    font-weight: 500;
    border: 1.5px solid var(--border);
    background: var(--bg-card);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
}

.room-filter-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.room-filter-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    box-shadow: 0 2px 8px rgba(37,99,235,.3);
}

/* ---- Bildirim Paneli ---- */
.notification-panel {
    position: fixed;
    top: var(--navbar-h);
    right: 0;
    width: 360px;
    max-height: calc(100vh - var(--navbar-h));
    background: var(--bg-card);
    border-left: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    z-index: 200;
    transform: translateX(100%);
    transition: transform var(--transition);
    display: flex;
    flex-direction: column;
}

.notification-panel.open {
    transform: translateX(0);
}

.notification-item {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.notification-item:hover {
    background: var(--bg-main);
}

.notification-item.unread {
    background: rgba(37,99,235,.04);
}

/* ---- Toast ---- */
#toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast-msg {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: .875rem;
    min-width: 260px;
    max-width: 360px;
    animation: slideInRight .3s ease;
}

.toast-msg.success { border-left: 3px solid var(--success); }
.toast-msg.error   { border-left: 3px solid var(--danger); }
.toast-msg.warning { border-left: 3px solid var(--warning); }
.toast-msg.info    { border-left: 3px solid var(--info); }

@keyframes slideInRight {
    from { transform: translateX(120%); opacity: 0; }
    to   { transform: translateX(0); opacity: 1; }
}

/* ---- Tablo ---- */
.table { color: var(--text-primary); }

.table th {
    font-size: .75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--text-muted);
    border-color: var(--border);
    white-space: nowrap;
}

.table td {
    border-color: var(--border);
    vertical-align: middle;
    font-size: .875rem;
}

.table-hover tbody tr:hover {
    background: rgba(37,99,235,.03);
}

/* ---- Form ---- */
.form-control, .form-select {
    border-radius: var(--radius-sm);
    border-color: var(--border);
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: .875rem;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,.15);
    background: var(--bg-card);
    color: var(--text-primary);
}

.input-group-text {
    background: var(--bg-main);
    border-color: var(--border);
    color: var(--text-secondary);
    border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}

/* ---- Butonlar ---- */
.btn {
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: .875rem;
    transition: all var(--transition);
}

.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
}

.btn-primary:hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
    box-shadow: 0 4px 12px rgba(37,99,235,.35);
}

/* ---- Badge ---- */
.badge {
    font-weight: 500;
    font-size: .72rem;
    padding: .3em .6em;
    border-radius: 6px;
}

/* ---- Auth Sayfası ---- */
.auth-wrapper {
    min-height: 100vh;
    background: linear-gradient(135deg, #1e3a8a 0%, #1d4ed8 50%, #2563eb 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.auth-card {
    background: #fff;
    border-radius: var(--radius-lg);
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 25px 50px rgba(0,0,0,.25);
}

.auth-logo {
    text-align: center;
    margin-bottom: 32px;
}

.auth-logo .logo-icon {
    width: 60px; height: 60px;
    background: linear-gradient(135deg, #1d4ed8, #2563eb);
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: #fff;
    margin-bottom: 12px;
    box-shadow: 0 8px 20px rgba(37,99,235,.4);
}

/* ---- Oda Kartları ---- */
.room-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition);
    box-shadow: var(--shadow-sm);
}

.room-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
    border-color: var(--primary);
}

.room-icon-wrap {
    width: 56px; height: 56px;
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(37,99,235,.1), rgba(37,99,235,.05));
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    color: var(--primary);
    margin-bottom: 12px;
}

/* ---- Grafik Alanı ---- */
.chart-container {
    position: relative;
    height: 240px;
}

/* ---- Boş Durum ---- */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 16px;
    opacity: .4;
}

.empty-state h5 {
    color: var(--text-secondary);
    margin-bottom: 8px;
}

/* ---- Log Satırları ---- */
.log-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    font-size: .82rem;
}

.log-item:last-child { border-bottom: none; }

.log-badge {
    font-size: .65rem;
    padding: .25em .6em;
    border-radius: 4px;
    flex-shrink: 0;
    margin-top: 2px;
}

/* Log badge ek renkleri */
.bg-purple  { background-color: #7c3aed !important; }
.bg-teal    { background-color: #0d9488 !important; }
.bg-orange  { background-color: #ea580c !important; }

/* ---- Otomasyon ---- */
.automation-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition);
}

.automation-card:hover {
    box-shadow: var(--shadow-md);
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ---- Sidebar Overlay (Mobil) ---- */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 1030;
    backdrop-filter: blur(2px);
}

.sidebar-overlay.show { display: block; }

/* ---- Responsive ---- */
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.show {
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0;
    }
}

@media (max-width: 767.98px) {
    .page-content { padding: 16px; }
    .top-navbar { padding: 0 16px; }
    .stat-card { padding: 16px; }
    .stat-value { font-size: 1.4rem; }
}

/* ---- Yükleniyor ---- */
.loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,.8);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: inherit;
    z-index: 10;
}

[data-theme="dark"] .loading-overlay {
    background: rgba(15,23,42,.82);
}

.spinner {
    width: 32px; height: 32px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin .7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Renk Yardımcıları ---- */
.text-primary-custom { color: var(--primary); }
.bg-primary-soft { background: rgba(37,99,235,.08); }
.bg-success-soft { background: rgba(22,163,74,.08); }
.bg-danger-soft  { background: rgba(220,38,38,.08); }
.bg-warning-soft { background: rgba(217,119,6,.08); }
.bg-info-soft    { background: rgba(8,145,178,.08); }

/* ---- Cihaz Kart (Cihazlar Sayfası) ---- */
.device-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition);
}

.device-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.device-card-header {
    padding: 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 12px;
}

.device-card-body {
    padding: 14px 16px;
}

.device-card-footer {
    padding: 10px 16px;
    border-top: 1px solid var(--border);
    background: var(--bg-main);
}

/* ---- Modal ---- */
.modal-content {
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
}

.modal-header {
    border-bottom: 1px solid var(--border);
    padding: 16px 20px;
}

.modal-footer {
    border-top: 1px solid var(--border);
    padding: 14px 20px;
}

/* ---- İkon Seçici ---- */
.icon-picker-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 6px;
}

.icon-pick-btn {
    aspect-ratio: 1;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    background: var(--bg-card);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: .95rem;
    transition: all var(--transition);
}

.icon-pick-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(37,99,235,.06);
}

.icon-pick-btn.selected {
    border-color: var(--primary);
    background: var(--primary);
    color: #fff;
}

/* ---- Dark Mode Toggle ---- */
.theme-toggle {
    cursor: pointer;
}

/* ============================================================
   DARK MODE — Bootstrap + Custom Kapsamlı Override
   ============================================================ */

/* Bootstrap global CSS değişkenlerini dark modda ezeriz */
[data-theme="dark"] {
    --bs-body-bg:                    var(--bg-main);
    --bs-body-color:                 var(--text-primary);
    --bs-card-bg:                    var(--bg-card);
    --bs-card-border-color:          var(--border);
    --bs-border-color:               var(--border);
    --bs-border-color-translucent:   rgba(255,255,255,.1);

    /* Dropdown */
    --bs-dropdown-bg:                var(--bg-card);
    --bs-dropdown-color:             var(--text-primary);
    --bs-dropdown-border-color:      var(--border);
    --bs-dropdown-link-color:        var(--text-primary);
    --bs-dropdown-link-hover-bg:     rgba(255,255,255,.07);
    --bs-dropdown-link-hover-color:  var(--text-primary);
    --bs-dropdown-divider-bg:        var(--border);

    /* Modal */
    --bs-modal-bg:                   var(--bg-card);
    --bs-modal-color:                var(--text-primary);
    --bs-modal-border-color:         var(--border);
    --bs-modal-header-border-color:  var(--border);
    --bs-modal-footer-border-color:  var(--border);

    /* Form */
    --bs-input-bg:                   var(--bg-card);
    --bs-form-control-bg:            var(--bg-card);
    --bs-form-control-color:         var(--text-primary);
    --bs-form-select-bg:             var(--bg-card);
    --bs-form-select-color:          var(--text-primary);
    --bs-input-border-color:         var(--border);
    --bs-input-placeholder-color:    var(--text-muted);
    --bs-input-focus-border-color:   var(--primary);

    /* Table */
    --bs-table-bg:                   transparent;
    --bs-table-color:                var(--text-primary);
    --bs-table-border-color:         var(--border);
    --bs-table-striped-bg:           rgba(255,255,255,.025);
    --bs-table-hover-bg:             rgba(37,99,235,.05);

    /* Nav */
    --bs-nav-link-color:             var(--text-secondary);
    --bs-navbar-color:               var(--text-primary);
    --bs-navbar-bg:                  var(--bg-card);

    /* Breadcrumb */
    --bs-breadcrumb-divider-color:   var(--text-muted);
    --bs-breadcrumb-item-active-color: var(--text-muted);
}

/* ---- body ---- */
[data-theme="dark"] body {
    background-color: var(--bg-main);
    color: var(--text-primary);
}

/* ---- Card ---- */
[data-theme="dark"] .card {
    background: var(--bg-card);
    border-color: var(--border);
}
[data-theme="dark"] .card-header {
    background: rgba(255,255,255,.04);
    border-color: var(--border);
}
[data-theme="dark"] .card-footer {
    background: rgba(255,255,255,.04);
    border-color: var(--border);
}
/* (table-light kapsamlı kurallar aşağıda, tablo bölümünde) */
[data-theme="dark"] .thead-light th {
    background-color: rgba(255,255,255,.05) !important;
    color: var(--text-muted) !important;
    border-color: var(--border) !important;
}
[data-theme="dark"] .bg-light {
    background-color: rgba(255,255,255,.06) !important;
    color: var(--text-primary) !important;
    border-color: var(--border) !important;
}

/* ---- Dropdown ---- */
[data-theme="dark"] .dropdown-menu {
    background: var(--bg-card);
    border-color: var(--border);
    box-shadow: 0 8px 24px rgba(0,0,0,.4);
}
[data-theme="dark"] .dropdown-item {
    color: var(--text-primary);
}
[data-theme="dark"] .dropdown-item:hover,
[data-theme="dark"] .dropdown-item:focus {
    background: rgba(255,255,255,.07);
    color: var(--text-primary);
}
[data-theme="dark"] .dropdown-divider {
    border-color: var(--border);
}

/* ---- Modal ---- */
[data-theme="dark"] .modal-content {
    background: var(--bg-card);
    border-color: var(--border);
}
[data-theme="dark"] .modal-header,
[data-theme="dark"] .modal-footer {
    border-color: var(--border);
}
[data-theme="dark"] .btn-close {
    filter: invert(1) grayscale(1);
}

/* ---- Form Elemanları ---- */
[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select {
    background-color: var(--bg-card);
    color: var(--text-primary);
    border-color: var(--border);
}
[data-theme="dark"] .form-control:focus,
[data-theme="dark"] .form-select:focus {
    background-color: var(--bg-card);
    color: var(--text-primary);
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,.2);
}
[data-theme="dark"] .form-control::placeholder {
    color: var(--text-muted);
}
[data-theme="dark"] .form-control:disabled,
[data-theme="dark"] .form-control[readonly] {
    background-color: rgba(255,255,255,.05);
    color: var(--text-muted);
}
[data-theme="dark"] .input-group-text {
    background: rgba(255,255,255,.06);
    border-color: var(--border);
    color: var(--text-muted);
}
[data-theme="dark"] .form-text {
    color: var(--text-muted);
}
[data-theme="dark"] .form-check-label {
    color: var(--text-primary);
}

/* ---- Alert ---- */
[data-theme="dark"] .alert {
    border-color: transparent;
}
[data-theme="dark"] .alert-danger {
    background: rgba(220,38,38,.15);
    color: #fca5a5;
    border-color: rgba(220,38,38,.25);
}
[data-theme="dark"] .alert-success {
    background: rgba(22,163,74,.15);
    color: #86efac;
    border-color: rgba(22,163,74,.25);
}
[data-theme="dark"] .alert-warning {
    background: rgba(217,119,6,.15);
    color: #fcd34d;
    border-color: rgba(217,119,6,.25);
}
[data-theme="dark"] .alert-info {
    background: rgba(8,145,178,.15);
    color: #67e8f9;
    border-color: rgba(8,145,178,.25);
}

/* ---- Badge ---- */
[data-theme="dark"] .badge.bg-light {
    background-color: rgba(255,255,255,.14) !important;
    color: var(--text-primary) !important;
}
[data-theme="dark"] .text-dark { color: var(--text-primary) !important; }

/* ---- Metin yardımcıları dark ---- */
[data-theme="dark"] .text-muted {
    color: var(--text-muted) !important;
}

/* ---- Pin satırı form etiketleri dark ---- */
[data-theme="dark"] .pin-row .form-label,
[data-theme="dark"] .pin-row small {
    color: var(--text-secondary);
}

/* ---- Breadcrumb ---- */
[data-theme="dark"] .breadcrumb-item a {
    color: var(--primary);
    text-decoration: none;
}
[data-theme="dark"] .breadcrumb-item.active,
[data-theme="dark"] .breadcrumb-item + .breadcrumb-item::before {
    color: var(--text-muted);
}

/* ---- Table ---- */
[data-theme="dark"] .table {
    --bs-table-bg:           transparent;
    --bs-table-color:        var(--text-primary);
    --bs-table-border-color: var(--border);
    color: var(--text-primary);
    border-color: var(--border);
}
/* Tüm hücreler (thead + tbody + tfoot) */
[data-theme="dark"] .table > :not(caption) > * > * {
    background-color: var(--bs-table-bg);
    color: var(--text-primary);
    border-bottom-color: var(--border);
}
/* Tablo başlık satırı — Bootstrap'in table-light ve varsayılan rengi ezer */
[data-theme="dark"] .table thead,
[data-theme="dark"] .table thead tr {
    --bs-table-bg:    rgba(255,255,255,.05);
    --bs-table-color: var(--text-muted);
    background-color: rgba(255,255,255,.05);
}
[data-theme="dark"] .table thead th,
[data-theme="dark"] .table thead td {
    background-color: rgba(255,255,255,.05) !important;
    color:            var(--text-muted)     !important;
    border-color:     var(--border)         !important;
}
/* table-light sınıfı (Bootstrap thead'e eklenince beyaz kalır) */
[data-theme="dark"] .table-light,
[data-theme="dark"] thead.table-light,
[data-theme="dark"] .table thead.table-light th,
[data-theme="dark"] .table thead.table-light td {
    --bs-table-color:      var(--text-muted);
    --bs-table-bg:         rgba(255,255,255,.05);
    --bs-table-border-color: var(--border);
    --bs-table-striped-bg: rgba(255,255,255,.035);
    --bs-table-hover-bg:   rgba(255,255,255,.07);
    background-color: rgba(255,255,255,.05) !important;
    color:            var(--text-muted)     !important;
    border-color:     var(--border)         !important;
}
[data-theme="dark"] .table-hover > tbody > tr:hover > * {
    background-color: rgba(37,99,235,.06);
}

/* ---- Code ---- */
[data-theme="dark"] code {
    background: rgba(37,99,235,.15);
    color: #93c5fd;
    padding: .15em .4em;
    border-radius: 4px;
}
[data-theme="dark"] pre {
    background: rgba(255,255,255,.05);
    color: var(--text-primary);
    border-color: var(--border);
}

/* ---- Nav pills/tabs ---- */
[data-theme="dark"] .nav-link {
    color: var(--text-secondary);
}
[data-theme="dark"] .nav-link:hover {
    color: var(--text-primary);
}

/* ---- HR ---- */
[data-theme="dark"] hr {
    border-color: var(--border);
    opacity: 1;
}

/* ---- Scrollbar dark ---- */
[data-theme="dark"] ::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,.15);
}

/* ---- Pin satırları (admin) ---- */
[data-theme="dark"] .pin-row {
    background: rgba(255,255,255,.04) !important;
    border-color: var(--border) !important;
}

/* ---- SweetAlert2 dark ---- */
[data-theme="dark"] .swal2-popup {
    background: var(--bg-card) !important;
    color: var(--text-primary) !important;
}
[data-theme="dark"] .swal2-title { color: var(--text-primary) !important; }
[data-theme="dark"] .swal2-html-container { color: var(--text-secondary) !important; }
[data-theme="dark"] .swal2-input,
[data-theme="dark"] .swal2-select,
[data-theme="dark"] .swal2-textarea {
    background: var(--bg-main) !important;
    color: var(--text-primary) !important;
    border-color: var(--border) !important;
}

/* ---- Auth kart (login/register) ---- */
[data-theme="dark"] .auth-card {
    background: var(--bg-card);
    box-shadow: 0 25px 50px rgba(0,0,0,.5);
}
[data-theme="dark"] .auth-card h4,
[data-theme="dark"] .auth-card p {
    color: var(--text-primary) !important;
}

/* ============================================================
   KART BOYUTU SEÇİCİ
   ============================================================ */
.size-picker {
    display: flex;
    gap: 10px;
}

.size-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 12px 8px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    cursor: pointer;
    transition: all var(--transition);
    color: var(--text-secondary);
    font-size: .75rem;
    font-weight: 500;
}

.size-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(37,99,235,.04);
}

.size-btn.active {
    border-color: var(--primary);
    background: rgba(37,99,235,.08);
    color: var(--primary);
}

.size-preview {
    border-radius: 5px;
    background: var(--bg-main);
    border: 1.5px solid currentColor;
    transition: all var(--transition);
    height: 28px;
}

.size-preview-sm  { width: 28px; }
.size-preview-md  { width: 48px; }
.size-preview-lg  { width: 72px; }

.size-btn.active .size-preview {
    background: rgba(37,99,235,.2);
}

/* ---- Dark mode size-picker ---- */
[data-theme="dark"] .size-btn {
    background: var(--bg-card);
}
[data-theme="dark"] .size-preview {
    background: rgba(255,255,255,.06);
}
[data-theme="dark"] .size-btn.active .size-preview {
    background: rgba(37,99,235,.25);
}

/* ---- Renk Seçici Swatch ---- */
.color-swatch-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.color-swatch {
    width: 30px; height: 30px;
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid transparent;
    transition: all var(--transition);
    flex-shrink: 0;
}

.color-swatch:hover { transform: scale(1.15); }
.color-swatch.active { border-color: var(--text-primary); transform: scale(1.15); }

/* ---- Setup / Sihirbaz sayfası ---- */
.wizard-step {
    display: none;
}
.wizard-step.active {
    display: block;
    animation: fadeIn .3s ease;
}

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

/* ---- Drag & Drop Sıralama (Sortable.js) ---- */
.sortable-ghost { opacity: .4; background: rgba(37,99,235,.1); border-radius: 12px; }
.drag-handle:active { cursor: grabbing; }

/* ---- Bildirim Paneli ---- */
.notif-panel {
    position: fixed;
    top: 0; right: -380px;
    width: 360px;
    height: 100vh;
    background: var(--bg-card);
    border-left: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    z-index: 1050;
    display: flex;
    flex-direction: column;
    transition: right .28s cubic-bezier(.4,0,.2,1);
}

.notif-panel.open { right: 0; }

.notif-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.notif-list {
    flex: 1;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

.notif-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background var(--transition);
    position: relative;
}

.notif-item:hover { background: var(--bg-main); }

.notif-item.unread { background: rgba(37,99,235,.04); }
.notif-item.unread::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 3px;
    background: var(--primary);
    border-radius: 0 2px 2px 0;
}

.notif-icon {
    width: 36px; height: 36px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: .9rem;
    flex-shrink: 0;
}

.notif-icon.info    { background: rgba(8,145,178,.12);  color: #0891b2; }
.notif-icon.success { background: rgba(22,163,74,.12);  color: #16a34a; }
.notif-icon.warning { background: rgba(217,119,6,.12);  color: #d97706; }
.notif-icon.danger  { background: rgba(220,38,38,.12);  color: #dc2626; }

.notif-title {
    font-size: .84rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.3;
    margin-bottom: 3px;
}

.notif-body {
    font-size: .78rem;
    color: var(--text-secondary);
    line-height: 1.4;
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.notif-time {
    font-size: .72rem;
    color: var(--text-muted);
}

.notif-delete-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    padding: 2px 4px;
    border-radius: 4px;
    opacity: 0;
    transition: opacity var(--transition), color var(--transition);
    flex-shrink: 0;
    margin-top: -2px;
}

.notif-item:hover .notif-delete-btn { opacity: 1; }
.notif-delete-btn:hover { color: var(--danger); }

.notif-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 200px;
    color: var(--text-muted);
    font-size: .85rem;
    text-align: center;
}

.notif-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.3);
    z-index: 1049;
    backdrop-filter: blur(2px);
}

.notif-overlay.show { display: block; }

.btn-icon-sm {
    width: 28px; height: 28px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text-secondary);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    font-size: .8rem;
    transition: all var(--transition);
}

.btn-icon-sm:hover { background: var(--bg-main); color: var(--text-primary); }
.btn-icon-sm.text-danger-soft:hover { color: var(--danger); }

.badge-count-notif {
    position: absolute;
    top: 4px; right: 4px;
    min-width: 16px; height: 16px;
    background: var(--danger);
    color: #fff;
    font-size: .62rem;
    font-weight: 700;
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    padding: 0 4px;
    border: 2px solid var(--bg-card);
    line-height: 1;
}

@media (max-width: 480px) {
    .notif-panel { width: 100%; right: -100%; }
}

/* ============================================================
   LED / PWM / RGB KANAL KARTLARI
   ============================================================ */

/* ---- Range Slider (PWM, Parlaklık, Hız) ---- */
.led-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 4px;
    border-radius: 4px;
    background: var(--border);
    outline: none;
    cursor: pointer;
    display: block;
}

.led-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--slider-color, var(--primary));
    cursor: pointer;
    box-shadow: 0 1px 4px rgba(0,0,0,.25);
    transition: transform .15s ease;
}

.led-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.led-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border: none;
    border-radius: 50%;
    background: var(--slider-color, var(--primary));
    cursor: pointer;
    box-shadow: 0 1px 4px rgba(0,0,0,.25);
}

.led-slider:disabled {
    opacity: .5;
    cursor: not-allowed;
}

/* Dark mode slider track */
[data-theme="dark"] .led-slider {
    background: rgba(255,255,255,.12);
}

/* ---- Renk Input ---- */
.led-color-input {
    width: 44px;
    height: 44px;
    border: 2px solid var(--border);
    border-radius: 10px;
    padding: 3px;
    cursor: pointer;
    background: none;
    transition: border-color var(--transition), transform var(--transition);
    flex-shrink: 0;
}

.led-color-input:hover {
    border-color: var(--primary);
    transform: scale(1.08);
}

.led-color-input:disabled {
    opacity: .5;
    cursor: not-allowed;
    transform: none;
}

/* ---- LED Strip Panel ---- */
.led-strip-panel {
    margin-top: 12px;
}

/* ---- Efekt Buton Izgarası ---- */
.led-effects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(54px, 1fr));
    gap: 5px;
}

.led-effect-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 7px 3px 6px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    background: var(--bg-card);
    color: var(--text-secondary);
    font-size: .63rem;
    font-weight: 500;
    line-height: 1.2;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.led-effect-btn i {
    font-size: .82rem;
    flex-shrink: 0;
}

.led-effect-btn:hover:not(:disabled) {
    border-color: var(--ef-color, var(--primary));
    color: var(--ef-color, var(--primary));
    background: var(--bg-main);
}

.led-effect-btn.active {
    border-color: var(--ef-color, var(--primary));
    color: var(--ef-color, var(--primary));
    background: var(--bg-main);
    font-weight: 700;
    box-shadow: inset 0 0 0 1px var(--ef-color, var(--primary));
}

.led-effect-btn:disabled {
    opacity: .45;
    cursor: not-allowed;
}

/* Dark mode effect buttons */
[data-theme="dark"] .led-effect-btn {
    background: rgba(255,255,255,.04);
}

[data-theme="dark"] .led-effect-btn:hover:not(:disabled),
[data-theme="dark"] .led-effect-btn.active {
    background: rgba(255,255,255,.08);
}

/* Efekt grup başlıkları (Temel / Animasyon / Müzik / Bölge Boyama) */
.led-effect-group-title {
    grid-column: 1 / -1;
    font-size: .64rem;
    font-weight: 700;
    letter-spacing: .5px;
    text-transform: uppercase;
    color: var(--text-muted);
    margin: 6px 0 0;
}
.led-effect-group-title:first-child { margin-top: 0; }

/* ---- Müzik modu bilgi kutusu ---- */
.led-audio-hint {
    font-size: .72rem;
    line-height: 1.45;
    color: var(--text-secondary);
    background: var(--bg-main);
    border: 1px dashed var(--border);
    border-radius: 8px;
    padding: 8px 10px;
}
.led-audio-hint code { font-size: .7rem; }

/* ---- Bölge boyama editörü ---- */
.led-seg-list { display: flex; flex-direction: column; gap: 6px; }
.led-seg-row {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    padding: 6px 8px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-card);
}
.led-seg-row input[type="number"] {
    width: 62px;
    padding: 3px 6px;
    font-size: .78rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-main);
    color: var(--text-primary);
}
.led-seg-row input[type="color"] {
    width: 34px;
    height: 28px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: none;
    cursor: pointer;
}
.led-seg-row .led-seg-sep { font-size: .72rem; color: var(--text-muted); }
.led-seg-row .led-seg-grad { font-size: .7rem; color: var(--text-secondary); display: flex; align-items: center; gap: 3px; }
.led-seg-row .led-seg-del {
    margin-left: auto;
    border: none;
    background: none;
    color: var(--danger, #ef4444);
    padding: 2px 6px;
    cursor: pointer;
}
.led-seg-bar {
    display: flex;
    height: 10px;
    border-radius: 5px;
    overflow: hidden;
    border: 1px solid var(--border);
    background: #000;
}

/* ---- Sahneler Bölümü ---- */
.led-scenes-section {
    border-top: 1px solid var(--border);
    padding-top: 10px;
}

/* ---- RGB önizleme dairesi hover efekti ---- */
[id^="rgb-preview-"] {
    transition: box-shadow var(--transition), transform var(--transition);
}

[id^="rgb-preview-"]:hover {
    box-shadow: 0 0 0 4px var(--border);
    transform: scale(1.05);
}

/* ============================================================
   DASHBOARD v4 — Cihaz Gruplu Kompakt Kartlar
   ============================================================ */

/* ---- Cihaz Grubu Başlığı ---- */
.device-group {
    margin-bottom: 20px;
}

.device-group-header {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-bottom: 8px;
    padding: 7px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
}

.device-group-header a {
    font-size: .85rem;
    font-weight: 600;
    color: var(--text-primary);
    text-decoration: none;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color var(--transition);
}

.device-group-header a:hover {
    color: var(--primary);
}

.device-group-header .dg-room {
    font-size: .7rem;
    color: var(--text-muted);
    white-space: nowrap;
    flex-shrink: 0;
}

/* ---- Kompakt Kanal Kartı ---- */
/* ═══ Modern Smart-Home Kanal Kartları ═══ */
.ch-card {
    position: relative;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    min-height: 66px;
    box-shadow: var(--shadow-sm);
    transition: transform .22s cubic-bezier(.4,0,.2,1),
                box-shadow .22s ease, border-color .2s ease;
    overflow: hidden;
    will-change: transform;
}
/* Üstte ince ışık çizgisi — premium doku */
.ch-card::before {
    content: '';
    position: absolute; top: 0; left: 0; right: 0; height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,.55), transparent);
    opacity: .55; pointer-events: none;
}
[data-theme="dark"] .ch-card::before {
    background: linear-gradient(90deg, transparent, rgba(255,255,255,.09), transparent);
}

.ch-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

/* AÇIK durum — kanal rengiyle yumuşak glow (ışık/priz/RGB/LED) */
.ch-card.is-on {
    border-color: color-mix(in srgb, var(--glow, var(--primary)) 45%, var(--border));
    box-shadow: var(--shadow-md);
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--glow, var(--primary)) 28%, transparent),
                0 8px 24px -8px color-mix(in srgb, var(--glow, var(--primary)) 60%, transparent);
}
.ch-card.is-on .ch-card-icon {
    background: var(--glow, var(--primary));
    color: #fff;
    box-shadow: 0 0 16px -3px color-mix(in srgb, var(--glow, var(--primary)) 75%, transparent);
}

/* Çevrimdışı — soluk, sakin, animasyonsuz */
.ch-card.offline {
    opacity: .6;
    filter: saturate(.55);
}
.ch-card.offline:hover { transform: none; box-shadow: var(--shadow-sm); }

/* Sol renk şeridi — yuvarlak aksan */
.ch-card-strip {
    width: 4px;
    align-self: stretch;
    flex-shrink: 0;
    border-radius: 4px 0 0 4px;
    margin-right: 12px;
    transition: width .2s ease;
}
.ch-card.is-on .ch-card-strip { width: 5px; }

/* İkon kutusu */
.ch-card-icon {
    width: 38px;
    height: 38px;
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .95rem;
    flex-shrink: 0;
    margin-right: 11px;
    transition: background .25s ease, color .25s ease, box-shadow .25s ease;
}

/* Orta: isim */
.ch-card-body {
    flex: 1;
    min-width: 0;
    padding: 8px 0;
}

.ch-card-name {
    font-size: .86rem;
    font-weight: 650;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
    margin: 0;
    letter-spacing: -.01em;
}
/* Kart altında küçük durum satırı (oda / online) — opsiyonel */
.ch-card-sub {
    font-size: .68rem;
    color: var(--text-muted);
    margin: 2px 0 0;
    display: flex; align-items: center; gap: 5px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ch-online-dot {
    width: 7px; height: 7px; border-radius: 50%;
    background: var(--success); flex-shrink: 0;
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--success) 60%, transparent);
    animation: chPulse 2.2s ease-in-out infinite;
}
.ch-online-dot.off { background: var(--text-muted); animation: none; }
@keyframes chPulse {
    0%   { box-shadow: 0 0 0 0 color-mix(in srgb, var(--success) 55%, transparent); }
    70%  { box-shadow: 0 0 0 6px color-mix(in srgb, var(--success) 0%, transparent); }
    100% { box-shadow: 0 0 0 0 transparent; }
}

/* Sağ: kontrol alanı */
.ch-card-ctrl {
    display: flex;
    align-items: center;
    gap: 7px;
    flex-shrink: 0;
    padding: 0 10px 0 6px;
}

/* Durum metni (AÇIK/KAPALI vb.) */
.ch-card-value {
    font-size: .74rem;
    font-weight: 700;
    color: var(--text-muted);
    white-space: nowrap;
}

/* Renk önizleme noktası — gerçek rengi yansıtır + hafif glow */
.ch-color-dot {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,.7);
    box-shadow: 0 0 0 1px var(--border), 0 0 10px -2px currentColor;
    flex-shrink: 0;
}
[data-theme="dark"] .ch-color-dot { border-color: rgba(255,255,255,.18); }

/* Efekt chip */
.ch-effect-chip {
    font-size: .63rem;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 10px;
    background: var(--bg-main);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    white-space: nowrap;
}

/* Düzenle butonu */
.ch-edit-btn {
    width: 28px;
    height: 28px;
    border-radius: 7px;
    border: 1px solid var(--border);
    background: var(--bg-main);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: .75rem;
    transition: all var(--transition);
    flex-shrink: 0;
}

.ch-edit-btn:hover:not(:disabled) {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.ch-edit-btn:disabled {
    opacity: .45;
    cursor: not-allowed;
}
/* Dokunmatik hedef: mobilde en az ~40px */
@media (max-width: 575.98px) {
    .ch-card { min-height: 68px; }
    .ch-edit-btn { width: 40px; height: 40px; font-size: .85rem; }
    .ch-card-icon { width: 40px; height: 40px; }
    .ch-card-name { font-size: .9rem; }
}
/* Hareketi azalt tercihi — tüm kart animasyonlarını sadeleştir */
@media (prefers-reduced-motion: reduce) {
    .ch-card, .ch-card-icon, .ch-card-strip { transition: none !important; }
    .ch-card:hover { transform: none; }
    .ch-online-dot { animation: none; }
}

/* PWM mini slider */
.ch-pwm-mini {
    width: 80px;
    flex-shrink: 0;
}

@media (max-width: 575.98px) {
    .ch-pwm-mini { width: 60px; }
}

/* ---- Offcanvas (RGB / LED Strip tam kontrol) ---- */
[data-theme="dark"] .offcanvas {
    background: var(--bg-card);
    border-color: var(--border);
    color: var(--text-primary);
}

[data-theme="dark"] .offcanvas-header {
    border-color: var(--border);
}

[data-theme="dark"] .offcanvas-title {
    color: var(--text-primary);
}

/* Dark mode: yeni kanal kartları */
[data-theme="dark"] .device-group-header {
    background: var(--bg-card);
    border-color: var(--border);
}

[data-theme="dark"] .ch-card {
    background: var(--bg-card);
    border-color: var(--border);
}

[data-theme="dark"] .ch-edit-btn {
    background: rgba(255,255,255,.06);
    border-color: var(--border);
}

[data-theme="dark"] .ch-effect-chip {
    background: rgba(255,255,255,.06);
    border-color: var(--border);
    color: var(--text-secondary);
}

/* ============================================================
   ANA SAYFA v5 — karşılama, özet, hızlı işlemler, karo kartlar
   ============================================================ */

/* ---- Karşılama başlığı ---- */
.home-hero {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 14px 24px;
    margin: 4px 0 18px;
}
.home-greet {
    font-size: 1.55rem;
    font-weight: 750;
    letter-spacing: -.02em;
    color: var(--text-primary);
    margin: 0;
    line-height: 1.2;
}
.home-date {
    font-size: .85rem;
    color: var(--text-secondary);
    margin-top: 4px;
    text-transform: capitalize;
}
.home-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.home-pill {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 13px;
    border-radius: 999px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    font-size: .8rem;
    color: var(--text-secondary);
    text-decoration: none;
    white-space: nowrap;
    transition: border-color var(--transition), color var(--transition);
}
.home-pill b { color: var(--text-primary); font-weight: 700; }
.home-pill i { font-size: .8rem; color: var(--text-muted); }
.home-pill.lit i  { color: #f59e0b; }
.home-pill.ok i   { color: var(--success); }
.home-pill.warn   { border-color: color-mix(in srgb, var(--warning) 45%, var(--border)); }
.home-pill.warn i { color: var(--warning); }
a.home-pill:hover { border-color: var(--primary); color: var(--primary); }
a.home-pill i     { color: #eab308; }

/* ---- Hızlı işlemler şeridi ---- */
.quick-bar {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 2px 2px 10px;
    margin: 0 -2px 10px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}
.quick-bar::-webkit-scrollbar { display: none; }
.quick-chip {
    --chip: var(--primary);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    padding: 9px 15px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: .84rem;
    font-weight: 600;
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    text-decoration: none;
    transition: transform .15s ease, border-color .2s ease, box-shadow .2s ease, background .2s ease;
}
.quick-chip i {
    width: 26px; height: 26px;
    border-radius: 8px;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: .78rem;
    background: color-mix(in srgb, var(--chip) 14%, transparent);
    color: var(--chip);
}
.quick-chip:hover:not(:disabled) {
    border-color: color-mix(in srgb, var(--chip) 55%, var(--border));
    box-shadow: 0 6px 18px -8px color-mix(in srgb, var(--chip) 70%, transparent);
    color: var(--text-primary);
}
.quick-chip:active:not(:disabled) { transform: scale(.97); }
.quick-chip:disabled { opacity: .5; cursor: default; }
.quick-chip.quick-off { --chip: #dc2626; }
.quick-chip.scene-add { --chip: var(--text-muted); border-style: dashed; box-shadow: none; color: var(--text-secondary); }
.quick-chip.busy i   { animation: chipSpin .8s linear infinite; }
.quick-chip.done     { border-color: var(--success); }
.quick-chip.done i   { background: var(--success); color: #fff; }
@keyframes chipSpin { to { transform: rotate(360deg); } }

/* Oda filtreleri: mobilde tek satır kaydırılabilir */
@media (max-width: 575.98px) {
    .room-filters { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-bottom: 14px; }
    .room-filters::-webkit-scrollbar { display: none; }
    .room-filter-btn { flex-shrink: 0; }
    .home-greet { font-size: 1.3rem; }
    .home-hero { margin-bottom: 14px; }
}

/* ---- Cihaz grubu başlığı ekleri ---- */
.device-group-header .dg-title { font-size: .85rem; font-weight: 650; flex: 1; color: var(--text-primary); }
.device-group-header .dg-offline {
    font-size: .66rem; font-weight: 600;
    padding: 2px 8px; border-radius: 999px;
    background: color-mix(in srgb, var(--text-muted) 16%, transparent);
    color: var(--text-secondary);
}
.fav-group .device-group-header {
    background: linear-gradient(90deg, color-mix(in srgb, #f59e0b 10%, var(--bg-card)), var(--bg-card));
}

/* ---- Karo ızgarası: kart boyutu (sm/md/lg) gerçekten yer kaplar ---- */
.tile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(158px, 1fr));
    grid-auto-rows: 40px;
    grid-auto-flow: dense;
    gap: 10px;
}
.tile-cell            { grid-row: span 3; min-width: 0; }        /* md: standart karo   */
.tile-cell.tile-sm    { grid-row: span 2; }                      /* sm: kompakt satır   */
.tile-cell.tile-lg    { grid-column: span 2; grid-row: span 6; } /* lg: 2×2 büyük kart  */
@media (max-width: 359.98px) { .tile-grid { grid-template-columns: 1fr 1fr; } }

/* ---- Karo kartın iskeleti ---- */
.ch-card.ch-tile {
    height: 100%;
    flex-direction: column;
    align-items: stretch;
    min-height: 0;
    padding: 12px 12px 10px;
    border-radius: 18px;
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    transition: transform .2s cubic-bezier(.4,0,.2,1), box-shadow .25s ease,
                background .35s ease, border-color .25s ease, color .25s ease;
}
.ch-card.ch-tile[data-kind="none"] { cursor: default; }
.ch-card.ch-tile:active:not(.offline) { transform: scale(.98); }
.ch-tile .ch-card-strip { display: none; }

.ch-tile-top {
    display: grid;
    grid-template-columns: auto 1fr auto;
    grid-template-areas: "icon tools tools" "body body body";
    align-items: start;
    gap: 8px 10px;
}
.ch-tile .ch-card-icon  { grid-area: icon; width: 42px; height: 42px; border-radius: 14px; margin: 0; font-size: 1.05rem; }
.ch-tile .ch-card-body  { grid-area: body; padding: 0; min-width: 0; }
.ch-tile-tools          { grid-area: tools; justify-self: end; display: flex; gap: 2px; margin: -4px -4px 0 0; }
.ch-tile .ch-card-name  { font-size: .92rem; font-weight: 700; }
.ch-tile .ch-card-sub   { font-size: .74rem; margin-top: 3px; gap: 4px; }
.ch-card-sub [id*="ch-pulse-cd-"] { margin-left: 4px; font-variant-numeric: tabular-nums; }
.ch-sub-off  { color: var(--text-muted); }
.ch-sub-room { color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; }

.ch-tile-ctrl {
    margin-top: auto;
    display: flex; align-items: center; justify-content: flex-end; gap: 8px;
    min-height: 30px;
}
.ch-tile-ctrl .ch-pwm-slider { width: 100%; }
.ch-tile .ch-pulse-btn {
    background: color-mix(in srgb, var(--ch-color) 12%, transparent);
    color: var(--ch-color);
    border: 1px solid color-mix(in srgb, var(--ch-color) 40%, transparent);
    border-radius: 9px; padding: 5px 12px; font-size: .76rem; font-weight: 650;
    cursor: pointer; white-space: nowrap;
}
.ch-tile .ch-pulse-btn:disabled { opacity: .5; cursor: not-allowed; }
.ch-tile-value { font-size: 1.4rem; font-weight: 800; line-height: 1; letter-spacing: -.02em; margin-right: auto; }
.ch-tile-unit  { font-size: .75rem; color: var(--text-muted); margin-right: auto; margin-left: -4px; }
.ch-tile-badge {
    font-size: .68rem; font-weight: 700; letter-spacing: .03em;
    padding: 3px 9px; border-radius: 999px;
    background: color-mix(in srgb, var(--text-muted) 16%, transparent); color: var(--text-secondary);
}
.ch-tile-badge.on { background: color-mix(in srgb, var(--success) 16%, transparent); color: var(--success); }

/* Araç düğmeleri (zamanlayıcı / favori) */
.ch-tool {
    width: 30px; height: 30px; border: none; background: transparent; border-radius: 9px;
    color: var(--text-muted); font-size: .8rem;
    display: inline-flex; align-items: center; justify-content: center;
    cursor: pointer; opacity: .55;
    transition: opacity .15s ease, background .15s ease, color .15s ease;
}
.ch-tile:hover .ch-tool, .ch-tool.active, .ch-tool:focus-visible { opacity: 1; }
.ch-tool:hover { background: color-mix(in srgb, var(--text-muted) 16%, transparent); color: var(--text-primary); }
.ch-fav-btn.active   { color: #f59e0b; }
.ch-timer-btn.active { color: #8b5cf6; }
@media (hover: none) { .ch-tool { opacity: .85; } }

/* ---- Küçük (sm): kısa karo — üstte ikon+ad, altta anahtar; araçlar üstte küçük ---- */
.tile-sm .ch-card.ch-tile { padding: 9px 10px 8px; }
.tile-sm .ch-tile-top {
    grid-template-columns: auto 1fr;
    grid-template-areas: "icon body";
    align-items: center;
    gap: 0 9px;
    padding-right: 22px;                       /* araçlar için yer */
}
.tile-sm .ch-card-icon { width: 32px; height: 32px; border-radius: 10px; font-size: .85rem; }
.tile-sm .ch-card-name { font-size: .84rem; }
.tile-sm .ch-card-sub  { font-size: .7rem; margin-top: 1px; }
.tile-sm .ch-tile-tools {
    position: absolute; top: 6px; right: 6px; margin: 0;
    flex-direction: column; gap: 0;
}
.tile-sm .ch-tool { width: 22px; height: 20px; font-size: .64rem; }
.tile-sm .ch-tile-ctrl { min-height: 26px; }
.tile-sm .ch-tile-ctrl .toggle-switch { transform: scale(.88); transform-origin: right center; }
.tile-sm .ch-edit-btn { width: 28px !important; height: 28px !important; }
.tile-sm .ch-color-dot { width: 20px; height: 20px; }
.tile-sm .ch-timer-chip { display: none; }
/* ---- Büyük (lg): 2×2 zengin kart ---- */
.tile-lg .ch-card.ch-tile { padding: 16px 16px 14px; border-radius: 22px; }
.tile-lg .ch-tile-top { grid-template-areas: "icon body tools"; align-items: center; }
.tile-lg .ch-card-icon { width: 52px; height: 52px; border-radius: 17px; font-size: 1.3rem; }
.tile-lg .ch-card-name { font-size: 1.05rem; }
.tile-lg .ch-card-sub  { font-size: .8rem; }
.tile-extra { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; min-height: 0; }
.tile-big-num { font-size: 2.6rem; font-weight: 800; line-height: 1; letter-spacing: -.04em; }
.tile-big-num small { font-size: 1rem; font-weight: 600; margin-left: 3px; opacity: .7; letter-spacing: 0; }
.tile-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; }
.tile-stat {
    display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 8px;
    padding: 8px 10px; border-radius: 12px;
    background: color-mix(in srgb, var(--text-muted) 10%, transparent);
}
.tile-stat i    { grid-row: span 2; align-self: center; font-size: .85rem; color: var(--ch-color); }
.tile-stat span { font-size: .68rem; color: var(--text-muted); }
.tile-stat b    { font-size: .88rem; font-weight: 700; color: var(--text-primary); }
.tile-quick { display: flex; flex-wrap: wrap; gap: 6px; }
.tile-q {
    flex: 1 1 auto; min-width: 44px;
    padding: 7px 8px; border-radius: 10px;
    border: 1px solid var(--border); background: var(--bg-card); color: var(--text-primary);
    font-size: .74rem; font-weight: 650; cursor: pointer;
    transition: border-color .15s ease, transform .1s ease;
}
.tile-q:hover:not(:disabled) { border-color: var(--ch-color); }
.tile-q:active:not(:disabled) { transform: scale(.95); }
.tile-q:disabled { opacity: .5; cursor: not-allowed; }
.tile-q.swatch { flex: 0 0 34px; min-width: 34px; height: 34px; padding: 0; border-radius: 50%; background: var(--sw);
                 box-shadow: inset 0 0 0 2px rgba(255,255,255,.55); }
.tile-swatch-big { height: 46px; border-radius: 14px; box-shadow: inset 0 0 0 2px rgba(255,255,255,.55), 0 8px 22px -10px rgba(0,0,0,.45); }
.tile-strip-bar  { height: 16px; border-radius: 999px; box-shadow: inset 0 0 0 2px rgba(255,255,255,.55), 0 6px 18px -8px rgba(0,0,0,.45); }
.tile-spark      { height: 84px; position: relative; }
.tile-spark svg  { width: 100%; height: 70px; display: block; }
.tile-spark-scale { display: flex; justify-content: space-between; font-size: .64rem; color: var(--text-muted); margin-top: 2px; }
.tile-spark-empty { font-size: .74rem; color: var(--text-muted); padding-top: 26px; text-align: center; }

/* ═══ Kart stilleri ═══ */
/* Canlı (varsayılan): açıkken kanal rengiyle dolu degrade, beyaz yazı */
.ch-tile.st-vivid.is-on {
    background: linear-gradient(150deg,
                color-mix(in srgb, var(--glow) 88%, #fff) 0%,
                var(--glow) 45%,
                color-mix(in srgb, var(--glow) 62%, #000) 100%);
    border-color: transparent;
    color: #fff;
    box-shadow: 0 14px 30px -14px color-mix(in srgb, var(--glow) 85%, transparent),
                inset 0 1px 0 rgba(255,255,255,.25);
}
/* Açık renk (beyaz / açık sarı LED): beyaz yazı okunsun diye renk koyu tona çekilir */
.ch-tile.st-vivid.is-on.glow-light {
    background: linear-gradient(150deg,
                color-mix(in srgb, var(--glow) 45%, #64748b) 0%,
                color-mix(in srgb, var(--glow) 32%, #334155) 55%,
                color-mix(in srgb, var(--glow) 20%, #1e293b) 100%);
    box-shadow: 0 14px 30px -14px rgba(15, 23, 42, .55), inset 0 1px 0 rgba(255,255,255,.18);
}
.ch-tile.st-vivid.is-on .ch-card-name,
.ch-tile.st-vivid.is-on .ch-card-sub,
.ch-tile.st-vivid.is-on .ch-card-sub span,
.ch-tile.st-vivid.is-on .tile-stat b,
.ch-tile.st-vivid.is-on .tile-big-num,
.ch-tile.st-vivid.is-on .ch-tile-value { color: #fff !important; }
.ch-tile.st-vivid.is-on .ch-sub-off,
.ch-tile.st-vivid.is-on .tile-stat span,
.ch-tile.st-vivid.is-on .tile-spark-scale { color: rgba(255,255,255,.75); }
.ch-tile.st-vivid.is-on .ch-card-icon { background: rgba(255,255,255,.22); color: #fff; box-shadow: none; }
.ch-tile.st-vivid.is-on .ch-tool { color: rgba(255,255,255,.85); }
.ch-tile.st-vivid.is-on .ch-tool:hover { background: rgba(255,255,255,.18); color: #fff; }
.ch-tile.st-vivid.is-on .ch-fav-btn.active { color: #fde68a; }
.ch-tile.st-vivid.is-on .tile-stat { background: rgba(255,255,255,.16); }
.ch-tile.st-vivid.is-on .tile-stat i { color: #fff; }
.ch-tile.st-vivid.is-on .tile-q { background: rgba(255,255,255,.16); border-color: rgba(255,255,255,.28); color: #fff; }
.ch-tile.st-vivid.is-on .tile-q.swatch { background: var(--sw); }
.ch-tile.st-vivid.is-on .toggle-switch input:checked + .toggle-slider { background: rgba(255,255,255,.35); }
.ch-tile.st-vivid.is-on .ch-edit-btn { background: rgba(255,255,255,.18); border-color: rgba(255,255,255,.3); color: #fff; }
.ch-tile.st-vivid.is-on .ch-pulse-btn { background: rgba(255,255,255,.2); border-color: rgba(255,255,255,.35); color: #fff; }
.ch-tile.st-vivid.is-on .ch-timer-chip { background: rgba(255,255,255,.2); color: #fff; }
.ch-tile.st-vivid.is-on .ch-color-dot { border-color: rgba(255,255,255,.9); }
.ch-tile.st-vivid.is-on .led-slider { --slider-color: #fff; }

/* Yumuşak: ince renkli çerçeve + parıltı (önceki görünüm) */
.ch-tile.st-soft.is-on .ch-card-sub > span:first-child { color: var(--glow); font-weight: 650; }

/* Sade: parıltı yok, sadece ikon renkli */
.ch-tile.st-minimal.is-on { box-shadow: var(--shadow-sm); border-color: var(--border); }
.ch-tile.st-minimal.is-on .ch-card-icon { background: color-mix(in srgb, var(--glow) 16%, transparent); color: var(--glow); box-shadow: none; }
.ch-tile.st-minimal.is-on .ch-card-sub > span:first-child { color: var(--text-primary); font-weight: 650; }

/* Çevrimdışı karolar: okunur kalsın, sadece sakinleşsin */
.ch-card.ch-tile.offline { opacity: .72; filter: saturate(.35); }

/* Koyu tema: kapalı karolar cam etkili koyu yüzey */
[data-theme="dark"] .ch-tile:not(.is-on) {
    background: linear-gradient(160deg, rgba(255,255,255,.055), rgba(255,255,255,.015));
    border-color: rgba(255,255,255,.07);
}
[data-theme="dark"] .tile-q { background: rgba(255,255,255,.05); }

/* Zamanlayıcı geri sayım çipi */
.ch-timer-chip {
    display: inline-flex; align-items: center; gap: 5px; align-self: flex-start;
    margin: 8px 0 0; padding: 2px 8px; border-radius: 999px;
    background: color-mix(in srgb, #8b5cf6 13%, transparent); color: #7c3aed;
    font-size: .7rem; font-weight: 650; font-variant-numeric: tabular-nums;
    max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
[data-theme="dark"] .ch-timer-chip { color: #c4b5fd; }
.ch-timer-chip.soon { animation: timerSoon 1s ease-in-out infinite; }
@keyframes timerSoon { 50% { opacity: .55; } }

@media (max-width: 575.98px) {
    .tile-grid { gap: 8px; }
    .ch-card.ch-tile { padding: 11px 10px 9px; }
    .ch-tile .ch-card-icon { width: 38px; height: 38px; font-size: .95rem; }
    .ch-tile .ch-card-name { font-size: .86rem; }
    .ch-tile .ch-edit-btn { width: 34px; height: 34px; }
    .tile-lg .ch-card.ch-tile { padding: 14px; }
    .tile-big-num { font-size: 2.2rem; }
}
@media (prefers-reduced-motion: reduce) {
    .ch-card.ch-tile, .ch-card.ch-tile:active { transition: none; transform: none; }
    .ch-timer-chip.soon, .quick-chip.busy i { animation: none; }
}

/* ---- Zamanlayıcı penceresi ---- */
.timer-hint { font-size: .82rem; color: var(--text-secondary); margin-bottom: 12px; }
.timer-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.timer-opt {
    padding: 10px 4px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--bg-main);
    color: var(--text-primary);
    font-size: .85rem; font-weight: 600;
    cursor: pointer;
    transition: border-color .15s ease, background .15s ease, color .15s ease;
}
.timer-opt:hover { border-color: #8b5cf6; color: #7c3aed; background: color-mix(in srgb, #8b5cf6 8%, var(--bg-card)); }
[data-theme="dark"] .timer-opt:hover { color: #c4b5fd; }

/* ---- Son hareketler ---- */
.activity-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    padding: 14px 16px 6px;
}
.activity-head {
    display: flex; justify-content: space-between; align-items: center;
    font-size: .85rem; font-weight: 650; color: var(--text-primary);
    margin-bottom: 6px;
}
.activity-head a { font-size: .78rem; font-weight: 600; text-decoration: none; }
.activity-list { list-style: none; margin: 0; padding: 0; }
.activity-list li {
    display: flex; gap: 12px; align-items: center;
    padding: 9px 0;
    border-top: 1px solid var(--border);
}
.activity-list li:first-child { border-top: none; }
.act-icon {
    --act: var(--primary);
    width: 32px; height: 32px; flex-shrink: 0;
    border-radius: 10px;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: .78rem;
    background: color-mix(in srgb, var(--act) 13%, transparent);
    color: var(--act);
}
.act-body { min-width: 0; }
.act-msg  { font-size: .84rem; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.act-meta { font-size: .72rem; color: var(--text-muted); margin-top: 1px; }
/* ---- Kanal ayarları: kart stili seçici + canlı önizleme sahnesi ---- */
.style-picker { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.style-btn {
    display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
    padding: 10px; border-radius: 12px; text-align: left;
    border: 1.5px solid var(--border); background: var(--bg-card); color: var(--text-primary);
    cursor: pointer; transition: border-color .15s ease, box-shadow .15s ease;
}
.style-btn b     { font-size: .82rem; }
.style-btn small { font-size: .68rem; color: var(--text-muted); line-height: 1.3; }
.style-btn.active { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent); }
.style-sample { width: 100%; height: 26px; border-radius: 8px; margin-bottom: 6px; }
.style-sample.s-vivid   { background: linear-gradient(150deg, #fb923c, #f97316 45%, #9a3412); }
.style-sample.s-soft    { background: var(--bg-card); border: 1.5px solid #f97316; box-shadow: 0 6px 14px -6px #f97316; }
.style-sample.s-minimal { background: var(--bg-main); border: 1px solid var(--border);
                          background-image: radial-gradient(circle at 16px 13px, #f97316 6px, transparent 7px); }
.tile-preview-stage {
    padding: 16px; border-radius: 16px;
    background: var(--bg-main); border: 1px dashed var(--border);
}
.tile-preview-stage .tile-grid { max-width: 360px; }
@media (max-width: 420px) { .style-picker { grid-template-columns: 1fr; } }
/* =====================================================================
   SAYFA TUTARLILIĞI (tüm sayfalar aynı başlık/boşluk ritmi) + MOBİL
   ===================================================================== */
/* Ortak sayfa başlığı: <div class="d-flex … mb-4"> <div><h5/>alt yazı</div> [buton] </div> */
.page-content > div.d-flex.mb-4:first-of-type { gap: 10px 12px; flex-wrap: wrap; }
.page-content > div.d-flex.mb-4:first-of-type h5,
.page-content > div.d-flex.mb-4:first-of-type > div > h5 { font-size: 1.2rem; font-weight: 700; letter-spacing: -.01em; line-height: 1.25; }
.page-content > div.d-flex.mb-4:first-of-type > div:first-child { min-width: 0; flex: 1 1 auto; }
.page-content > div.d-flex.mb-4:first-of-type > div:first-child > div { font-size: .8rem !important; color: var(--text-muted); margin-top: 2px; }
/* Kendi kabını açan sayfalar (Siri, Ev Üyeleri) çift boşluk almasın */
.page-content > .container-fluid { padding: 0; }
.page-content > .container-fluid.py-4 { padding-top: 0 !important; padding-bottom: 0 !important; }
.page-content h4.fw-bold, .page-content > .container-fluid h4 { font-size: 1.2rem; font-weight: 700; }

@media (max-width: 575.98px) {
    .page-content { padding: 14px 14px 88px; }            /* altta sesli asistan düğmesine yer */
    .page-content .card-body.p-4, .page-content .card-body.p-5 { padding: 18px !important; }
    .page-content > div.d-flex.mb-4:first-of-type { margin-bottom: 16px !important; }
    .page-content > div.d-flex.mb-4:first-of-type .btn { white-space: nowrap; }
    .top-navbar .page-title { font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
    /* Modallar: kenara yapışmasın, tam ekran yüksekliğinde kaydırılsın */
    .modal-dialog { margin: 10px; }
    .modal-dialog-scrollable { height: calc(100% - 20px); }
    .modal-body { padding: 16px; }
    .modal-footer { flex-wrap: nowrap; }
    /* Tablolar: satır içi taşma yerine kendi içinde kaydır */
    .table-responsive { -webkit-overflow-scrolling: touch; }
    .table-responsive .table td, .table-responsive .table th { white-space: nowrap; }
    .btn-group { flex-wrap: wrap; }
    /* Dokunma hedefleri */
    .btn-sm, .btn-icon { min-height: 34px; }
}
