:root {
    --fke-red: #d62020;
    --fke-red-hover: #b51b1b;
    --fke-red-light: rgba(214, 32, 32, 0.08);
    --bg-body: #f4f7f8;
    --surface: #ffffff;
    --text-dark: #1a202c;
    --text-muted: #718096;
    --border: #e2e8f0;
    --radius-md: 12px;
    --radius-lg: 16px;
    --shadow-soft: 0 4px 20px rgba(0,0,0,0.03);
    --bottom-nav-height: 70px;
}

body {
    background-color: var(--bg-body);
    font-family: 'Inter', sans-serif;
    color: var(--text-dark);
    -webkit-font-smoothing: antialiased;
}

/* KÜLJEPANEEL (Desktop) */
.desktop-sidebar {
    width: 260px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    position: fixed; top: 0; left: 0; bottom: 0;
    display: flex; flex-direction: column; z-index: 1000;
}
.sidebar-logo { padding: 24px; font-size: 22px; font-weight: 800; }
.sidebar-logo span { color: var(--fke-red); }
.nav-link-custom {
    display: flex; align-items: center; gap: 12px; padding: 12px 24px;
    color: var(--text-muted); font-weight: 500; text-decoration: none; transition: 0.2s;
}
.nav-link-custom:hover, .nav-link-custom.active { background: var(--fke-red-light); color: var(--fke-red); border-right: 3px solid var(--fke-red); }
.nav-link-custom i { font-size: 20px; }

/* PEAMINE KORPUS */
.main-wrapper { margin-left: 260px; padding: 30px 40px; min-height: 100vh; display: flex; flex-direction: column; }
.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 30px; }
.search-box { background: var(--surface); border-radius: 30px; padding: 10px 20px; box-shadow: var(--shadow-soft); display: flex; align-items: center; width: 350px; }
.search-box input { border: none; outline: none; margin-left: 10px; width: 100%; font-size: 14px; }

/* WIDGETID (Statistika) */
.widget-card { background: var(--surface); border-radius: var(--radius-lg); padding: 20px; box-shadow: var(--shadow-soft); display: flex; align-items: center; gap: 15px; border: 1px solid transparent; transition: 0.2s; cursor: default; }
.widget-card:hover { transform: translateY(-3px); border-color: var(--fke-red-light); }
.widget-icon { width: 50px; height: 50px; border-radius: 14px; display: flex; align-items: center; justify-content: center; font-size: 24px; }
.widget-icon.red { background: var(--fke-red-light); color: var(--fke-red); }
.widget-icon.yellow { background: rgba(214, 158, 46, 0.1); color: #d69e2e; }

/* TABEL JA KAARDID */
.data-container { background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-soft); overflow: hidden; }
.table-custom th { text-transform: uppercase; font-size: 12px; font-weight: 600; color: var(--text-muted); padding: 20px; border-bottom: 1px solid var(--border); background: #fdfefe; }
.table-custom td { padding: 18px 20px; vertical-align: middle; border-bottom: 1px solid var(--border); font-size: 14px; }
.table-custom tr:hover td { background-color: #fbfcfd; }

/* TAIMER (SLA) */
.sla-timer { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 30px; font-family: monospace; font-size: 13px; font-weight: 600; background: #f8fafc; border: 1px solid var(--border); }
.sla-timer.safe .pulse { width: 8px; height: 8px; border-radius: 50%; background: #38a169; animation: pulse-green 1.5s infinite; }
.sla-timer.warning { background: #fffff0; border-color: #fef08a; color: #b45309; }
.sla-timer.warning .pulse { width: 8px; height: 8px; border-radius: 50%; background: #d97706; animation: pulse-yellow 1.5s infinite; }
.sla-timer.danger { background: #fef2f2; border-color: #fecaca; color: #b91c1c; }
.sla-timer.danger .pulse { width: 8px; height: 8px; border-radius: 50%; background: #dc2626; animation: pulse-red 1.5s infinite; }
.sla-timer.stopped { background: transparent; border-color: transparent; font-family: 'Inter'; font-weight: 500; color: #38a169; padding: 0; }

@keyframes pulse-green { 0% { box-shadow: 0 0 0 0 rgba(56, 161, 105, 0.4); } 70% { box-shadow: 0 0 0 6px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
@keyframes pulse-yellow { 0% { box-shadow: 0 0 0 0 rgba(217, 119, 6, 0.4); } 70% { box-shadow: 0 0 0 6px transparent; } }
@keyframes pulse-red { 0% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.4); } 70% { box-shadow: 0 0 0 6px transparent; } }

/* MOBIILI ÄPI LOOGIKA */
.mobile-bottom-nav { display: none; position: fixed; bottom: 0; left: 0; width: 100%; background: var(--surface); box-shadow: 0 -4px 20px rgba(0,0,0,0.05); z-index: 1000; padding-bottom: env(safe-area-inset-bottom); }

@media (max-width: 991px) {
    .desktop-sidebar { display: none; } /* Peida vasak menüü */
    .mobile-bottom-nav { display: flex; justify-content: space-around; } /* Näita all-navigeerimist */
    .main-wrapper { margin-left: 0; padding: 20px 15px 100px; } /* Ruumi alla navi jaoks */
    .topbar { flex-direction: column; gap: 15px; align-items: stretch; margin-bottom: 20px; }
    .search-box { width: 100%; }
    
    /* Muudame tabeli kaartideks (App-view) */
    .table-custom thead { display: none; }
    .table-custom, .table-custom tbody, .table-custom tr, .table-custom td { display: block; width: 100%; }
    .table-custom tr { margin-bottom: 15px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 15px; box-shadow: var(--shadow-soft); }
    .table-custom td { padding: 8px 0; border: none; display: flex; justify-content: space-between; align-items: center; }
    .table-custom td::before { content: attr(data-label); font-size: 11px; text-transform: uppercase; color: var(--text-muted); font-weight: 600; flex-basis: 40%; }
}

.nav-item-mobile { display: flex; flex-direction: column; align-items: center; padding: 12px 0; color: var(--text-muted); font-size: 11px; font-weight: 500; text-decoration: none; flex: 1; transition: 0.2s; }
.nav-item-mobile i { font-size: 24px; margin-bottom: 4px; }
.nav-item-mobile.active, .nav-item-mobile:hover { color: var(--fke-red); }

/* Vormide ilustamine */
.form-control, .form-select { border-radius: 10px; padding: 12px 15px; border-color: var(--border); box-shadow: none !important; transition: 0.2s; }
.form-control:focus, .form-select:focus { border-color: var(--fke-red); background-color: #fffafb; }
.btn-fke { background-color: var(--fke-red); color: white; border-radius: 30px; padding: 10px 24px; font-weight: 600; transition: 0.2s; border: none; }
.btn-fke:hover { background-color: var(--fke-red-hover); color: white; transform: translateY(-2px); box-shadow: 0 4px 15px rgba(214, 32, 32, 0.3); }