/* ============================================================
   CAKRAWALA CODING & ROBOTICS - GLOBAL APPLICATION STYLES
   Dipakai oleh semua role.
   ============================================================ */
:root {
    --bg: #f4f7fb;
    --surface: #ffffff;
    --surface-2: #f8fafc;
    --text: #172033;
    --muted: #68738a;
    --border: #dde4ee;
    --primary: #3157d5;
    --primary-dark: #2444af;
    --navy: #101a33;
    --navy-2: #172442;
    --success: #138a5b;
    --danger: #bf3e45;
    --warning: #b87812;
    --shadow: 0 24px 70px rgba(24, 36, 65, .12);
    --shadow-sm: 0 8px 30px rgba(24, 36, 65, .08);
    --radius: 18px;
    --radius-sm: 11px;
    --sidebar-width: 264px;
}

* { box-sizing: border-box; }
html { min-height: 100%; }
body {
    min-height: 100vh;
    margin: 0;
    font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
    color: var(--text);
    background: var(--bg);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
code { padding: 2px 6px; border-radius: 6px; background: #eef2f8; font-size: .9em; }

/* ---------- Login ---------- */
.auth-page { background: #eaf0fa; }
.auth-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(390px, 46%) 1fr; }
.auth-brand-panel {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    overflow: hidden;
    padding: clamp(48px, 7vw, 96px);
    color: #fff;
    background:
        radial-gradient(circle at 82% 18%, rgba(88, 130, 255, .32), transparent 26%),
        radial-gradient(circle at 10% 90%, rgba(57, 183, 164, .18), transparent 28%),
        linear-gradient(145deg, #0d1730 0%, #13234a 55%, #163060 100%);
}
.auth-brand-panel::before,
.auth-brand-panel::after {
    content: ""; position: absolute; border: 1px solid rgba(255,255,255,.08); border-radius: 50%; pointer-events: none;
}
.auth-brand-panel::before { width: 520px; height: 520px; right: -260px; bottom: -110px; }
.auth-brand-panel::after { width: 290px; height: 290px; right: -105px; bottom: 5px; }
.brand-lockup { position: relative; z-index: 1; display: flex; align-items: flex-start; gap: 22px; }
.brand-mark {
    width: 70px; height: 70px; flex: 0 0 auto; display: grid; place-items: center;
    border-radius: 20px; background: linear-gradient(135deg, #5e7cf5, #3157d5); color: white;
    font-weight: 800; letter-spacing: -.04em; box-shadow: 0 14px 35px rgba(38, 73, 184, .35);
}
.brand-mark.small { width: 44px; height: 44px; border-radius: 13px; font-size: 14px; }
.eyebrow { display: block; margin-bottom: 10px; font-size: 11px; font-weight: 800; letter-spacing: .15em; text-transform: uppercase; color: #92a8f4; }
.eyebrow.dark { color: #526bba; }
.auth-brand-panel h1 { margin: 0; font-size: clamp(42px, 4.2vw, 68px); line-height: .98; letter-spacing: -.045em; }
.brand-copy { position: relative; z-index: 1; max-width: 590px; margin: 34px 0 28px; color: #c7d2ea; font-size: 17px; line-height: 1.75; }
.feature-chips { position: relative; z-index: 1; display: flex; flex-wrap: wrap; gap: 9px; }
.feature-chips span { padding: 7px 11px; border: 1px solid rgba(255,255,255,.12); border-radius: 999px; color: #dce4f8; background: rgba(255,255,255,.05); font-size: 12px; font-weight: 700; }
.brand-footer { position: absolute; bottom: 36px; left: clamp(48px, 7vw, 96px); color: #7386ac; font-size: 12px; letter-spacing: .05em; }
.auth-form-panel { display: grid; place-items: center; padding: 50px clamp(28px, 7vw, 100px); background: #f7f9fc; }
.login-card { width: min(100%, 455px); }
.mobile-brand { display: none; align-items: center; gap: 12px; margin-bottom: 34px; }
.login-heading { margin-bottom: 30px; }
.login-heading h2 { margin: 0 0 8px; font-size: 32px; letter-spacing: -.035em; }
.login-heading p { margin: 0; color: var(--muted); }
.login-form { display: grid; gap: 19px; }
.field-group { display: grid; gap: 8px; }
.field-group label { font-size: 13px; font-weight: 750; color: #2b354b; }
.label-row { display: flex; align-items: center; justify-content: space-between; }
.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap input {
    width: 100%; height: 51px; padding: 0 48px 0 44px; border: 1px solid #d9e1ed; border-radius: 12px;
    outline: none; background: #fff; color: var(--text); box-shadow: 0 1px 2px rgba(20,35,70,.02); transition: .18s ease;
}
.input-wrap input:focus { border-color: #7791eb; box-shadow: 0 0 0 4px rgba(49,87,213,.09); }
.input-wrap input::placeholder { color: #9aa5b9; }
.input-icon { position: absolute; left: 15px; z-index: 1; color: #7f8ba3; font-size: 14px; pointer-events: none; }
.password-toggle { position: absolute; right: 8px; border: 0; background: transparent; color: #53617c; padding: 7px 8px; border-radius: 7px; font-size: 11px; font-weight: 800; cursor: pointer; }
.password-toggle:hover { background: #eff3f9; }
.btn { min-height: 43px; display: inline-flex; align-items: center; justify-content: center; gap: 9px; border: 0; border-radius: 10px; padding: 0 17px; font-weight: 760; cursor: pointer; transition: .18s ease; }
.btn:disabled { opacity: .7; cursor: wait; }
.btn-primary { color: #fff; background: linear-gradient(135deg, #3f65df, #2d50c4); box-shadow: 0 9px 24px rgba(49,87,213,.20); }
.btn-primary:hover:not(:disabled) { transform: translateY(-1px); background: linear-gradient(135deg, #365bd2, #2648b7); }
.btn-block { width: 100%; min-height: 50px; }
.btn-ghost { color: #42506a; background: #eef2f7; }
.btn-ghost:hover { background: #e4eaf3; }
.btn-small { min-height: 36px; padding: 0 12px; font-size: 12px; }
.spinner { width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.alert { display: flex; align-items: flex-start; gap: 11px; margin: 0 0 22px; padding: 13px 14px; border: 1px solid; border-radius: 11px; font-size: 13px; transition: .25s; }
.alert-error { color: #8c2730; background: #fff3f3; border-color: #f0cdd0; }
.alert-success { color: #0d7049; background: #effaf5; border-color: #c7eadb; }
.alert-info { color: #305298; background: #f0f5ff; border-color: #d0dcf7; }
.alert-icon { display: grid; place-items: center; width: 21px; height: 21px; flex: 0 0 21px; border-radius: 50%; background: currentColor; color: white; font-size: 11px; font-weight: 900; }
.alert.is-hiding { opacity: 0; transform: translateY(-4px); }
.login-meta { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px; margin-top: 24px; color: #8a95a8; font-size: 11px; text-align: center; }
.login-meta .dot { color: #c0c7d3; }

/* ---------- Setup ---------- */
.setup-page { display: grid; place-items: center; padding: 32px; background: #eef3f9; }
.setup-container { width: min(100%, 580px); }
.setup-card { padding: 36px; border: 1px solid var(--border); border-radius: var(--radius); background: #fff; box-shadow: var(--shadow-sm); }
.setup-card .brand-mark { margin-bottom: 24px; }
.setup-card h1 { margin: 0 0 6px; letter-spacing: -.03em; }
.muted { color: var(--muted); }
.setup-card > .muted { margin: 0 0 24px; }

/* ---------- App shell ---------- */
.app-page { background: #f4f7fb; }
.app-layout { min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 40; width: var(--sidebar-width); display: flex; flex-direction: column; padding: 22px 16px; color: #dce5f8; background: linear-gradient(180deg, #111b34, #152545); }
.sidebar-brand { display: flex; align-items: center; gap: 11px; padding: 0 8px 23px; border-bottom: 1px solid rgba(255,255,255,.08); }
.sidebar-brand > div:last-child { display: grid; line-height: 1.2; }
.sidebar-brand strong { color: white; font-size: 15px; }
.sidebar-brand span { margin-top: 4px; color: #8998ba; font-size: 10px; text-transform: uppercase; letter-spacing: .09em; }
.sidebar-nav { display: grid; gap: 5px; margin-top: 22px; }
.nav-item { display: flex; align-items: center; gap: 12px; min-height: 43px; padding: 0 12px; border-radius: 9px; color: #aebbd6; font-size: 13px; font-weight: 670; }
.nav-item > span { width: 23px; color: #8193bd; text-align: center; font-weight: 800; }
.nav-item:hover, .nav-item.active { color: white; background: rgba(255,255,255,.075); }
.nav-item.active > span { color: #91a9ff; }
.nav-item.disabled-link { opacity: .72; cursor: default; }
.sidebar-footer { display: grid; gap: 2px; margin-top: auto; padding: 15px 12px 2px; border-top: 1px solid rgba(255,255,255,.08); }
.sidebar-footer span { color: #c7d3e9; font-size: 11px; font-weight: 700; }
.sidebar-footer small { color: #7182a7; font-size: 10px; }
.app-main { min-height: 100vh; margin-left: var(--sidebar-width); }
.topbar { height: 72px; position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 16px; padding: 0 28px; border-bottom: 1px solid #e1e7ef; background: rgba(255,255,255,.94); backdrop-filter: blur(10px); }
.menu-button { display: none; width: 38px; height: 38px; border: 1px solid var(--border); border-radius: 9px; background: #fff; cursor: pointer; }
.topbar-title { color: #65728a; font-size: 13px; font-weight: 700; }
.user-menu { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.user-avatar { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px; color: white; background: linear-gradient(135deg,#5b78df,#3157d5); font-size: 13px; font-weight: 850; }
.user-meta { display: grid; margin-right: 6px; line-height: 1.2; }
.user-meta strong { font-size: 12px; }
.user-meta span { margin-top: 3px; color: var(--muted); font-size: 10px; }
.content-wrap { padding: 30px; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.page-heading h1 { margin: 2px 0 5px; font-size: 28px; letter-spacing: -.035em; }
.page-heading p { margin: 0; color: var(--muted); font-size: 13px; }
.status-pill { flex: 0 0 auto; display: flex; align-items: center; gap: 7px; padding: 7px 10px; border: 1px solid #dce7e1; border-radius: 999px; color: #40715b; background: #f4fbf7; font-size: 10px; font-weight: 750; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #29a46e; box-shadow: 0 0 0 3px rgba(41,164,110,.12); }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 15px; }
.metric-card { min-width: 0; display: flex; gap: 13px; padding: 19px; border: 1px solid #e0e6ef; border-radius: 14px; background: #fff; box-shadow: 0 5px 22px rgba(26,42,74,.035); }
.metric-icon { width: 42px; height: 42px; flex: 0 0 42px; display: grid; place-items: center; border-radius: 11px; color: #3157d5; background: #edf2ff; font-size: 14px; font-weight: 850; }
.metric-card > div:last-child { min-width: 0; display: grid; }
.metric-card span { overflow: hidden; color: #78849a; font-size: 10px; font-weight: 750; text-overflow: ellipsis; white-space: nowrap; }
.metric-card strong { margin: 4px 0 2px; font-size: 18px; letter-spacing: -.025em; }
.metric-card small { overflow: hidden; color: #a0a9b9; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.panel-grid { display: grid; grid-template-columns: 1.2fr .8fr; gap: 16px; margin-top: 17px; }
.panel { padding: 20px; border: 1px solid #e0e6ef; border-radius: 14px; background: #fff; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-bottom: 15px; border-bottom: 1px solid #edf0f5; }
.panel-heading h2 { margin: 0 0 4px; font-size: 15px; }
.panel-heading p { margin: 0; color: var(--muted); font-size: 11px; }
.badge { display: inline-flex; align-items: center; min-height: 22px; padding: 0 8px; border-radius: 999px; color: #3157d5; background: #eef2ff; font-size: 9px; font-weight: 800; }
.badge.neutral { color: #7a8497; background: #f1f3f6; }
.check-list { display: grid; gap: 0; }
.check-list > div { display: flex; gap: 12px; padding: 15px 2px; border-bottom: 1px solid #f0f2f6; }
.check-list > div:last-child { border-bottom: 0; }
.check { width: 25px; height: 25px; flex: 0 0 25px; display: grid; place-items: center; border-radius: 50%; color: #16784f; background: #ecf9f3; font-size: 11px; font-weight: 900; }
.check-list strong { font-size: 12px; }
.check-list p { margin: 3px 0 0; color: var(--muted); font-size: 10px; }
.module-list { display: grid; }
.module-row { display: grid; grid-template-columns: 30px 1fr auto; align-items: center; gap: 9px; min-height: 50px; border-bottom: 1px solid #f0f2f6; font-size: 11px; font-weight: 680; }
.module-row:last-child { border-bottom: 0; }
.module-icon { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 8px; color: #4a61a9; background: #f0f3fa; font-size: 9px; font-weight: 850; }
.sidebar-overlay { display: none; }

@media (max-width: 1100px) {
    .metric-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 880px) {
    .auth-shell { grid-template-columns: 1fr; }
    .auth-brand-panel { display: none; }
    .auth-form-panel { min-height: 100vh; }
    .mobile-brand { display: flex; }
    .sidebar { transform: translateX(-100%); transition: transform .22s ease; box-shadow: 22px 0 50px rgba(15,26,50,.22); }
    .sidebar-open .sidebar { transform: translateX(0); }
    .app-main { margin-left: 0; }
    .menu-button { display: grid; place-items: center; }
    .sidebar-overlay { position: fixed; inset: 0; z-index: 35; background: rgba(14,23,42,.42); }
    .sidebar-open .sidebar-overlay { display: block; }
    .panel-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
    .auth-form-panel { padding: 30px 22px; }
    .login-heading h2 { font-size: 28px; }
    .topbar { padding: 0 16px; }
    .topbar-title { display: none; }
    .user-meta { display: none; }
    .content-wrap { padding: 22px 16px; }
    .page-heading { align-items: flex-start; flex-direction: column; }
    .metric-grid { grid-template-columns: 1fr; }
    .setup-page { padding: 15px; }
    .setup-card { padding: 24px; }
}
