/* =========================================================
   IT Asset Manager — app.css
   ========================================================= */
@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500&family=IBM+Plex+Sans:wght@300;400;500;600;700&display=swap');

:root {
  --bg:         #f2f1ee;
  --surface:    #ffffff;
  --surface2:   #f8f7f5;
  --border:     #e4e2dc;
  --border2:    #ccc9c2;
  --text:       #1a1917;
  --text-m:     #6b6860;
  --text-s:     #9e9b95;
  --accent:     #1a3a5c;
  --accent2:    #2563a8;
  --ok:         #1a6640;
  --ok-bg:      #e8f5ed;
  --warn-c:     #7a4a00;
  --warn-bg:    #fff3e0;
  --danger-c:   #8b1a1a;
  --danger-bg:  #fdeaea;
  --info-c:     #0f4c7a;
  --info-bg:    #e8f1fa;
  --radius:     6px;
  --radius-lg:  10px;
  --sidebar-w:  220px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; }
body { font-family: 'IBM Plex Sans', sans-serif; font-size: 14px; color: var(--text);
       background: var(--bg); line-height: 1.55; height: 100%; }

/* ── LAYOUT ── */
.shell { display: flex; min-height: 100vh; }
.main  { flex: 1; overflow-x: hidden; display: flex; flex-direction: column;
          min-width: 0; transition: margin-left .25s ease; }

/* ── SIDEBAR ── */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--accent);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 100;
  transition: transform .25s ease, width .25s ease;
}

/* Sidebar collapsed (desktop) — hanya icon */
.shell.sidebar-collapsed .sidebar {
  width: 54px;
  min-width: 54px;
}
.shell.sidebar-collapsed .sidebar .brand-name,
.shell.sidebar-collapsed .sidebar .brand-sub,
.shell.sidebar-collapsed .sidebar .nav-label,
.shell.sidebar-collapsed .sidebar .nav-text,
.shell.sidebar-collapsed .sidebar .sf-info,
.shell.sidebar-collapsed .sidebar .btn-logout-text {
  display: none;
}
.shell.sidebar-collapsed .sidebar .nav-item {
  justify-content: center;
  padding: 10px 0;
}
.shell.sidebar-collapsed .sidebar .nav-ic {
  width: 100%;
  text-align: center;
  font-size: 18px;
}
.shell.sidebar-collapsed .sidebar .sidebar-brand {
  justify-content: center;
  padding: 16px 0;
}
.shell.sidebar-collapsed .sidebar .brand-icon { margin: 0; }
.shell.sidebar-collapsed .sidebar .sidebar-footer {
  padding: 10px 0;
  align-items: center;
}
.shell.sidebar-collapsed .sidebar .sf-user {
  justify-content: center;
  margin-bottom: 8px;
}
.shell.sidebar-collapsed .sidebar .btn-logout {
  padding: 7px 0;
  font-size: 18px;
}

/* Main content offset */
.main { margin-left: var(--sidebar-w); }
.shell.sidebar-collapsed .main { margin-left: 54px; }

/* Overlay (mobile) */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 99;
}
.sidebar-overlay.active { display: block; }

/* ── SIDEBAR INNER ── */
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 20px 16px 16px;
                  border-bottom: 1px solid rgba(255,255,255,.1); flex-shrink: 0; }
.brand-icon  { font-size: 24px; flex-shrink: 0; }
.brand-name  { font-size: 13px; font-weight: 700; color: #fff; white-space: nowrap; }
.brand-sub   { font-size: 11px; color: rgba(255,255,255,.45); margin-top: 1px; white-space: nowrap; }
.sidebar-nav { flex: 1; padding: 10px 0; }
.nav-label   { font-size: 10px; text-transform: uppercase; letter-spacing: .08em;
                color: rgba(255,255,255,.3); padding: 14px 16px 4px; white-space: nowrap; overflow: hidden; }
.nav-item    { display: flex; align-items: center; gap: 9px; padding: 9px 16px;
                font-size: 13px; color: rgba(255,255,255,.65); text-decoration: none;
                border-left: 3px solid transparent; transition: all .14s; white-space: nowrap; }
.nav-item:hover  { color: #fff; background: rgba(255,255,255,.08); }
.nav-item.active { color: #fff; background: rgba(255,255,255,.12); border-left-color: #6eb3f7; font-weight: 500; }
.nav-ic { font-size: 16px; width: 20px; text-align: center; flex-shrink: 0; }
.nav-text { overflow: hidden; }
.sidebar-footer { padding: 14px 16px; border-top: 1px solid rgba(255,255,255,.1); flex-shrink: 0; }
.sf-user  { display: flex; align-items: center; gap: 9px; margin-bottom: 10px; overflow: hidden; }
.sf-avatar{ width: 32px; height: 32px; background: rgba(255,255,255,.2); border-radius: 50%;
             display: flex; align-items: center; justify-content: center;
             font-size: 14px; font-weight: 700; color: #fff; flex-shrink: 0; }
.sf-info  { overflow: hidden; min-width: 0; }
.sf-name  { font-size: 13px; font-weight: 500; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sf-role  { font-size: 11px; color: rgba(255,255,255,.45); white-space: nowrap; }
.btn-logout { display: flex; align-items: center; justify-content: center; gap: 7px; width: 100%;
               padding: 7px; background: rgba(255,255,255,.1); color: rgba(255,255,255,.7);
               border-radius: var(--radius); text-decoration: none; font-size: 13px;
               transition: background .14s; }
.btn-logout:hover { background: rgba(255,255,255,.2); }
.btn-logout-icon { font-size: 16px; }

/* ── TOPBAR ── */
.topbar { background: var(--surface); border-bottom: 1px solid var(--border);
           padding: 12px 20px; display: flex; align-items: center;
           justify-content: space-between; position: sticky; top: 0; z-index: 10; gap: 12px; }
.topbar-left { display: flex; align-items: center; gap: 12px; min-width: 0; }

/* Tombol toggle sidebar di topbar */
.btn-toggle-sidebar {
  display: flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: var(--radius);
  background: none; border: 1px solid var(--border); cursor: pointer;
  color: var(--text-m); font-size: 18px; flex-shrink: 0;
  transition: background .12s;
}
.btn-toggle-sidebar:hover { background: var(--surface2); }

.page-title { font-size: 17px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.page-sub   { font-size: 12px; color: var(--text-m); margin-top: 1px; }
.topbar-actions { display: flex; gap: 8px; flex-shrink: 0; }

/* ── CONTENT ── */
.content { padding: 22px 24px; flex: 1; }
.mb-3 { margin-bottom: 14px; }
.mb-4 { margin-bottom: 20px; }
.mt-3 { margin-top: 14px; }
.mt-1 { margin-top: 5px; }

/* ── FLASH ── */
.flash { padding: 10px 24px; font-size: 13px; font-weight: 500; }
.flash-success { background: var(--ok-bg); color: var(--ok); border-bottom: 1px solid #c3e6cc; }
.flash-error   { background: var(--danger-bg); color: var(--danger-c); border-bottom: 1px solid #f5c6c6; }
.flash-warn    { background: var(--warn-bg); color: var(--warn-c); border-bottom: 1px solid #ffe0a0; }

/* ── CARDS ── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 18px 20px; }
.card-title { font-size: 13px; font-weight: 600; color: var(--text-m); text-transform: uppercase;
               letter-spacing: .05em; margin-bottom: 14px; }

/* ── STATS GRID ── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat-card  { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 14px 16px; }
.s-label    { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--text-m); margin-bottom: 5px; }
.s-val      { font-size: 28px; font-weight: 700; font-family: 'IBM Plex Mono', monospace; }
.s-sub      { font-size: 11px; color: var(--text-s); margin-top: 3px; }
.s-ok     { color: var(--ok); }
.s-warn   { color: var(--warn-c); }
.s-danger { color: var(--danger-c); }
.s-info   { color: var(--info-c); }

/* ── MINI STATS ── */
.mini-stat { background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; text-align: center; }
.ms-lbl    { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--text-m); margin-bottom: 5px; }
.ms-val    { font-size: 24px; font-weight: 700; font-family: 'IBM Plex Mono', monospace; }
.ms-sub    { font-size: 11px; color: var(--text-s); margin-top: 3px; }

/* ── TABLE ── */
.table-responsive { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { text-align: left; padding: 9px 12px; font-size: 11px; font-weight: 600; letter-spacing: .05em;
             text-transform: uppercase; color: var(--text-m); background: var(--surface2);
             border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:hover td { background: var(--surface2); }
.table tbody tr:last-child td { border-bottom: none; }
.empty-cell { text-align: center; padding: 32px; color: var(--text-s); font-size: 13px; }

/* ── BADGES ── */
.badge       { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 99px;
                font-size: 11px; font-weight: 500; white-space: nowrap; }
.badge-ok     { background: var(--ok-bg);      color: var(--ok); }
.badge-danger { background: var(--danger-bg);  color: var(--danger-c); }
.badge-warn   { background: var(--warn-bg);    color: var(--warn-c); }
.badge-info   { background: var(--info-bg);    color: var(--info-c); }
.badge-gray   { background: #f1efea;            color: #5a5750; }

/* ── BUTTONS ── */
.btn { display: inline-flex; align-items: center; gap: 5px; padding: 8px 15px;
        border: 1px solid var(--border2); background: var(--surface); color: var(--text);
        border-radius: var(--radius); font-size: 13px; font-weight: 500; font-family: inherit;
        cursor: pointer; text-decoration: none; transition: all .12s; white-space: nowrap; }
.btn:hover         { background: var(--surface2); }
.btn-primary       { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover { background: #1e4570; }
.btn-sm            { padding: 5px 10px; font-size: 12px; }
.btn-danger-sm     { border-color: #f5c6c6; color: var(--danger-c); font-size: 12px; padding: 4px 10px;
                     font-family: inherit; cursor: pointer; border-radius: var(--radius); background: var(--surface); }
.btn-danger-sm:hover { background: var(--danger-bg); }
.btn-reveal { border: none; background: none; cursor: pointer; font-size: 12px; color: var(--accent2);
               padding: 2px 6px; border-radius: 4px; font-family: inherit; }
.btn-reveal:hover { background: var(--info-bg); }

/* ── FORMS ── */
.form-grid       { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.form-grid.cols3 { grid-template-columns: 1fr 1fr 1fr; }
.form-group      { display: flex; flex-direction: column; gap: 4px; }
label            { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--text-m); }
input[type=text], input[type=password], input[type=date], input[type=datetime-local],
input[type=number], input[type=email], select, textarea {
  font-family: 'IBM Plex Sans', sans-serif; font-size: 13px; color: var(--text);
  border: 1.5px solid var(--border); border-radius: var(--radius); padding: 8px 10px;
  background: var(--surface2); outline: none; transition: border-color .12s; width: 100%;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent2); background: #fff; }
textarea { resize: vertical; min-height: 72px; }
.req        { color: var(--danger-c); }
.field-hint { font-size: 11px; color: var(--text-s); margin-top: 2px; }
.section-sep { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em;
                color: var(--text-m); padding: 12px 0 10px; border-top: 1px solid var(--border); margin-top: 10px; }
.pass-wrap { position: relative; }
.pass-wrap input { padding-right: 38px; }
.pass-eye  { position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
              background: none; border: none; cursor: pointer; font-size: 15px; color: var(--text-m); }

/* ── FILTER ROW ── */
.filter-row    { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.filter-input  { flex: 1; min-width: 160px; }
.filter-select { min-width: 130px; width: auto; }

/* ── ALERT ── */
.alert       { padding: 12px 16px; border-radius: var(--radius); margin-bottom: 14px; font-size: 13px; }
.alert-error { background: var(--danger-bg); color: var(--danger-c); border: 1px solid #f5c6c6; }

/* ── HISTORY ITEMS ── */
.history-item { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 8px; }
.history-item:last-child { margin-bottom: 0; }
.hi-top   { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; flex-wrap: wrap; gap: 4px; }
.hi-badges{ display: flex; gap: 5px; flex-wrap: wrap; }
.hi-desc  { font-size: 13px; margin-bottom: 6px; }
.hi-meta  { display: flex; gap: 12px; flex-wrap: wrap; font-size: 11px; color: var(--text-m); align-items: center; }

/* ── DETAIL GRID ── */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.df-lbl { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--text-s); margin-bottom: 2px; }
.df-val { font-size: 13px; }

/* ── CRED ROW ── */
.cred-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }

/* ── PROGRESS ── */
.progress-bar-wrap { background: var(--bg); border-radius: 99px; height: 10px; overflow: hidden; }
.progress-bar-fill { height: 10px; border-radius: 99px; transition: width .4s ease; }

/* ── DURATION PREVIEW ── */
.dur-preview { padding: 9px 14px; border-radius: var(--radius); font-size: 13px; font-weight: 500; margin-top: 8px; }
.dur-ok      { background: var(--ok-bg); color: var(--ok); }
.dur-lewat   { background: var(--danger-bg); color: var(--danger-c); }
.dur-error   { background: var(--warn-bg); color: var(--warn-c); }

/* ── IP BADGE ── */
.ip-badge { font-family: 'IBM Plex Mono', monospace; font-size: 11px; color: var(--info-c);
             background: var(--info-bg); padding: 2px 7px; border-radius: 4px; }
.pass-cell   { font-family: 'IBM Plex Mono', monospace; font-size: 12px; cursor: pointer;
                filter: blur(3px); transition: filter .2s; user-select: none; }
.pass-hidden { font-family: 'IBM Plex Mono', monospace; font-size: 13px; cursor: pointer; }

/* ── UTILITIES ── */
.mono       { font-family: 'IBM Plex Mono', monospace; }
.fw-500     { font-weight: 500; }
.fw-600     { font-weight: 600; }
.text-xs    { font-size: 11px; }
.text-sm    { font-size: 13px; }
.text-muted { color: var(--text-m); }
.text-center{ text-align: center; }

/* ═══════════════════════════════════════════
   GRID CLASSES — default desktop
   ═══════════════════════════════════════════ */

/* Show page — 2 kolom di laptop */
.show-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

/* Mutu stat — 4 kolom di laptop */
.mutu-stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  gap: 14px;
  margin-bottom: 20px;
}

/* Mutu SLA — 2 kolom di laptop */
.mutu-sla-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

/* Mutu mini grid — 3 kolom di laptop */
.mutu-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}

.hi-catatan {
  font-size: 12px;
  color: var(--info-c);
  background: var(--info-bg);
  border-radius: var(--radius);
  padding: 5px 10px;
  margin-bottom: 6px;
}

/* ═══════════════════════════════════════════
   RESPONSIVE — TABLET ≤ 900px
   ═══════════════════════════════════════════ */
@media (max-width: 900px) {
  .shell:not(.sidebar-open) .sidebar {
    transform: translateX(-100%);
  }
  .shell:not(.sidebar-open) .main {
    margin-left: 0;
  }
  .shell.sidebar-open .sidebar {
    transform: translateX(0);
    width: var(--sidebar-w);
  }
  .shell.sidebar-open .main {
    margin-left: 0;
  }
  .shell.sidebar-collapsed .sidebar {
    transform: translateX(-100%);
    width: var(--sidebar-w);
  }
  .shell.sidebar-collapsed .main {
    margin-left: 0;
  }
  .show-grid     { grid-template-columns: 1fr; }
  .mutu-sla-grid { grid-template-columns: 1fr; }
}

/* ═══════════════════════════════════════════
   RESPONSIVE — MOBILE ≤ 600px
   ═══════════════════════════════════════════ */
@media (max-width: 768px) {
  .content    { padding: 14px 12px; }
  .topbar     { padding: 10px 12px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .form-grid  { grid-template-columns: 1fr; }
  .form-grid.cols3 { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  .page-title { font-size: 15px; }
  .topbar-actions .btn:not(.btn-primary) { display: none; }
  .mutu-stat-grid { grid-template-columns: 1fr 1fr; }
  .cred-row   { flex-direction: column; gap: 8px; }

  /* TABLE → CARD */
  .table-responsive { overflow-x: unset; }
  .table { display: block; }
  .table thead { display: none; }
  .table tbody { display: block; }
  .table tbody tr {
    display: block;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    margin-bottom: 10px;
    padding: 10px 14px;
  }
  .table tbody tr:hover td { background: transparent; }
  .table tbody td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    border-bottom: 1px solid var(--border);
    border-right: none;
    font-size: 13px;
    gap: 10px;
    text-align: right;
  }
  .table tbody td:last-child {
    border-bottom: none;
    justify-content: flex-end;
  }
  .table tbody td::before {
    content: attr(data-label);
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--text-s);
    flex-shrink: 0;
    min-width: 90px;
    text-align: left;
  }
  .table tbody td:last-child::before { display: none; }

  /* Tabel mutu — tetap scroll horizontal di HP, tidak jadi card */
  .table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .table-scroll .table {
    display: table;
    min-width: 480px;
  }
  .table-scroll .table thead { display: table-header-group; }
  .table-scroll .table tbody { display: table-row-group; }
  .table-scroll .table tbody tr {
    display: table-row;
    background: transparent;
    border: none;
    border-radius: 0;
    margin-bottom: 0;
    padding: 0;
  }
  .table-scroll .table tbody td {
    display: table-cell;
    text-align: left;
    border-bottom: 1px solid var(--border);
    border-right: none;
    padding: 8px 10px;
  }
  .table-scroll .table tbody td::before { display: none; }
  .table-scroll .table tbody td:last-child { justify-content: unset; }

  .user-form-grid {
    grid-template-columns: 1fr !important;
  }

  /* Fix overflow kanan di HP */
  .shell, .main, .content {
    overflow-x: hidden;
    max-width: 100vw;
  }
  .stats-grid {
    gap: 10px;
  }
  .stat-card {
    min-width: 0;
    word-break: break-word;
  }
}