/* =====================================================
   SMARTMOP - LAYOUT (reset, sidebar, topbar, halaman)
   ===================================================== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }

body {
    min-height: 100vh;
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.55;
    color: var(--text);
    background: var(--background);
}
button, input, select { font: inherit; color: inherit; }
h1, h2, h3 { font-weight: 600; }
button { cursor: pointer; }
a { color: inherit; }
:focus-visible { outline: 3px solid #a8c9ff; outline-offset: 2px; }

.ico {
    width: 1.25em; height: 1.25em; flex: none;
    fill: none; stroke: currentColor; stroke-width: 1.6;
    stroke-linecap: round; stroke-linejoin: round;
}

/* ---------- Kerangka aplikasi ---------- */
.app {
    display: grid;
    grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
    min-height: 100vh;
}
.main { min-width: 0; }

/* ---------- Sidebar ---------- */
.sidebar {
    position: sticky; top: 0;
    height: 100vh;
    display: flex; flex-direction: column; gap: 24px;
    padding: 20px 12px;
    color: #fff;
    background: var(--navy);
    z-index: 30;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px; }
.brand-mark {
    width: 40px; height: 40px; display: grid; place-items: center;
    border-radius: 10px; background: rgba(255, 255, 255, 0.08);
}
.brand-mark .ico { width: 24px; height: 24px; }
.brand strong { display: block; font-size: 18px; font-weight: 600; line-height: 1.2; }
.brand small { font-size: 12px; color: #9fb0c8; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
    display: flex; align-items: center; gap: 12px;
    min-height: 40px; padding: 0 12px;
    border-radius: 8px;
    color: #c3d0e3;
    font-weight: 500; text-decoration: none;
    transition: background var(--transition), color var(--transition);
}
.nav a .ico { width: 18px; height: 18px; }
.nav a:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }
.nav a[aria-current="page"] { background: rgba(255, 255, 255, 0.1); color: #fff; box-shadow: inset 2px 0 0 #6ea8ff; }

.scrim { display: none; }

/* ---------- Topbar ---------- */
.topbar {
    display: flex; align-items: center; justify-content: space-between;
    flex-wrap: wrap; gap: 16px;
    padding: 24px 28px 8px;
}
.topbar-title { display: flex; align-items: center; gap: 12px; min-width: 0; }
.topbar h1 { font-size: 24px; line-height: 1.25; color: var(--navy); }
.topbar p { color: var(--text-secondary); }
.menu-btn {
    display: none; width: 42px; height: 42px; place-items: center;
    border: 1px solid var(--border-strong); border-radius: 10px; background: var(--surface);
}
.top-actions { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }

.bell { position: relative; }
.bell > button {
    position: relative; width: 44px; height: 44px; display: grid; place-items: center;
    border: 0; border-radius: 50%; background: transparent; color: var(--text-secondary);
}
.bell > button:hover { background: #e9edf3; color: var(--navy); }
.bell > button .ico { width: 22px; height: 22px; }
.bell-count {
    position: absolute; top: 2px; right: 2px;
    min-width: 20px; height: 20px; padding: 0 5px;
    display: grid; place-items: center;
    border-radius: 10px; background: var(--danger); color: #fff;
    font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums;
}
.bell-menu {
    position: absolute; right: 0; top: 52px; z-index: 40;
    width: 320px; padding: 8px;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: 0 12px 32px rgba(20, 38, 63, 0.16);
}
.bell-menu li { list-style: none; padding: 10px 12px; border-radius: 8px; }
.bell-menu li + li { border-top: 1px solid var(--border); }
.bell-menu strong { display: block; font-size: 13px; }
.bell-menu small { color: var(--text-secondary); }
.bell-menu button {
    width: 100%; margin-top: 6px; padding: 9px; border: 0; border-radius: 8px;
    background: var(--primary-light); color: var(--primary); font-weight: 600;
}

.clock { padding-left: 20px; border-left: 1px solid var(--border-strong); line-height: 1.3; }
.clock small { display: block; color: var(--text-secondary); font-size: 12.5px; }
.clock strong { font-size: 20px; font-weight: 600; color: var(--navy); font-variant-numeric: tabular-nums; }

.online { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.online .dot { width: 8px; height: 8px; border-radius: 50%; background: #16a34a; }
.online.off .dot { background: var(--danger); }

.btn-emergency {
    display: inline-flex; align-items: center; gap: 10px;
    min-height: 44px; padding: 0 18px; border: 0; border-radius: 8px;
    background: var(--danger); color: #fff; font-weight: 600;
    transition: background var(--transition);
}
.btn-emergency:hover { background: #b42318; }
.btn-emergency:active, .btn:active { transform: scale(0.98); }
.btn-emergency .ico { width: 18px; height: 18px; stroke-width: 2; }

/* ---------- Isi halaman ---------- */
.page { display: grid; gap: 20px; padding: 16px 28px 40px; max-width: 1600px; }
/* grid items default to min-width:auto; let wide children (tabs, tables) scroll instead of widening the page */
.page > * { min-width: 0; }
