/* ============================================================
   Kristal IT Helpdesk — tema "crystal night"
   Sidebar biru-malam pekat, konten terang, aksen biru-es.
   ============================================================ */
:root {
  --night:   #0e1b2c;   /* sidebar */
  --night-2: #16283f;
  --ice:     #4fc3e8;   /* aksen utama */
  --ice-dim: #2a7fa3;
  --paper:   #f5f8fa;   /* latar konten */
  --card:    #ffffff;
  --ink:     #1c2733;
  --muted:   #6b7a89;
  --line:    #e2e9ef;
  --danger:  #d64545;
  --warn:    #e09f3e;
  --good:    #3d9970;
  --radius:  10px;
  --font:    "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono:    "Cascadia Code", "Consolas", monospace;
}

* { box-sizing: border-box; margin: 0; }
body {
  font-family: var(--font);
  background: var(--paper);
  color: var(--ink);
  display: flex;
  min-height: 100vh;
  font-size: 15px;
}

/* ---------- Sidebar ---------- */
.sidebar {
  width: 230px;
  background: linear-gradient(175deg, var(--night) 0%, var(--night-2) 100%);
  color: #cfe3ef;
  display: flex;
  flex-direction: column;
  padding: 22px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
  flex-shrink: 0;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 22px; }
.brand-mark {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--ice), #7fd8f5 60%, #b9ecff);
  color: var(--night);
  font-size: 18px;
  border-radius: 9px;
  box-shadow: 0 0 18px rgba(79,195,232,.35);
}
.brand-name { font-weight: 700; letter-spacing: .18em; font-size: 14px; color: #fff; }
.brand-sub  { font-size: 11px; color: #86a7bd; letter-spacing: .06em; }

.sidebar nav { display: flex; flex-direction: column; gap: 4px; }
.sidebar nav a {
  color: #a9c4d6;
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 8px;
  border-left: 3px solid transparent;
  transition: background .15s, color .15s;
}
.sidebar nav a:hover  { background: rgba(255,255,255,.06); color: #fff; }
.sidebar nav a.active { background: rgba(79,195,232,.14); color: #fff; border-left-color: var(--ice); }

.sidebar-foot { margin-top: auto; padding: 12px 8px 0; border-top: 1px solid rgba(255,255,255,.08); }
.user-chip { display: flex; flex-direction: column; margin-bottom: 8px; }
.user-name { color: #fff; font-weight: 600; font-size: 14px; }
.user-role { font-size: 11px; color: #86a7bd; text-transform: uppercase; letter-spacing: .08em; }
.logout { color: #a9c4d6; font-size: 13px; text-decoration: none; }
.logout:hover { color: var(--ice); }

/* ---------- Konten ---------- */
.content { flex: 1; padding: 28px 34px 60px; max-width: 1200px; }
.page-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 16px; margin-bottom: 22px;
}
h1 { font-size: 24px; font-weight: 700; }
h2 { font-size: 16px; font-weight: 650; }
.sub-head { font-size: 14px; margin: 14px 0 8px; color: var(--ink); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono  { font-family: var(--mono); font-size: 13px; }
.link  { color: var(--ice-dim); text-decoration: none; font-weight: 600; }
.link:hover { color: var(--ice); }
.prose { line-height: 1.6; }

/* ---------- Panel & grid ---------- */
.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
}
.panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.two-col { display: grid; grid-template-columns: 1.4fr 1fr; gap: 20px; align-items: start; }

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 22px; }
.stat {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  border-top: 3px solid var(--ice);
}
.stat-warn { border-top-color: var(--warn); }
.stat-good { border-top-color: var(--good); }
.stat-num   { font-size: 30px; font-weight: 700; display: block; }
.stat-label { font-size: 13px; color: var(--muted); }

/* ---------- Tabel ---------- */
.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left; font-size: 12px; text-transform: uppercase;
  letter-spacing: .06em; color: var(--muted);
  padding: 8px 10px; border-bottom: 2px solid var(--line);
}
.table td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr:hover td { background: #f0f6fa; }

/* ---------- Badge ---------- */
.badge {
  display: inline-block; padding: 3px 9px; border-radius: 20px;
  font-size: 12px; font-weight: 600; background: #eef2f6; color: var(--muted);
}
.pr-low      { background: #eef2f6; color: #5a6b7a; }
.pr-medium   { background: #e3f2fb; color: #1e6a94; }
.pr-high     { background: #fdf1dd; color: #a86d15; }
.pr-critical { background: #fbe4e4; color: #b03030; }
.st-open       { background: #e3f2fb; color: #1e6a94; }
.st-inprogress { background: #fdf1dd; color: #a86d15; }
.st-pending    { background: #efeafa; color: #6a4fb3; }
.st-resolved   { background: #e2f3ea; color: #2c7a54; }
.st-closed     { background: #eef2f6; color: #5a6b7a; }
.dl-late  { background: #fbe4e4; color: #b03030; }
.dl-today { background: #fdf1dd; color: #a86d15; }
.dl-soon  { background: #fff8e0; color: #8a7415; }
.dl-ok    { background: #e2f3ea; color: #2c7a54; }

/* ---------- Form ---------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-stack { display: flex; flex-direction: column; gap: 12px; }
.span-2 { grid-column: span 2; }
label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; font-weight: 600; color: #3c4a58; }
input, select, textarea {
  font: inherit; font-weight: 400;
  padding: 9px 11px;
  border: 1px solid #cdd8e1;
  border-radius: 7px;
  background: #fff; color: var(--ink);
  width: 100%;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--ice);
  outline-offset: 0;
  border-color: var(--ice);
}
.filter-bar { display: flex; gap: 10px; margin-bottom: 16px; }
.filter-bar input[type=search] { flex: 1; }
.filter-bar select { width: auto; }
.inline-form select { padding: 5px 8px; font-size: 13px; width: auto; }

.ai-row { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 8px; margin-bottom: 8px; }

/* ---------- Tombol ---------- */
.btn {
  font: inherit; font-weight: 600;
  padding: 9px 16px;
  border: 1px solid #cdd8e1;
  border-radius: 7px;
  background: #fff; color: var(--ink);
  cursor: pointer; text-decoration: none;
  display: inline-block;
}
.btn:hover { border-color: var(--ice-dim); color: var(--ice-dim); }
.btn-primary {
  background: linear-gradient(135deg, var(--ice-dim), var(--ice));
  border: none; color: #fff;
}
.btn-primary:hover { filter: brightness(1.08); color: #fff; }
.btn-small { padding: 6px 12px; font-size: 13px; }
.btn-block { width: 100%; }

/* ---------- List ---------- */
.reminder-list { list-style: none; }
.reminder-list li {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 11px 0; border-bottom: 1px solid var(--line);
}
.reminder-list li:last-child { border-bottom: none; }

.comment-list { list-style: none; margin-bottom: 14px; }
.comment-list li { padding: 10px 0; border-bottom: 1px solid var(--line); }
.comment-meta { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.comment-form { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.comment-form textarea { width: 100%; }

.meta-list { margin-top: 18px; font-size: 13px; }
.meta-list dt { color: var(--muted); margin-top: 10px; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; }
.meta-list dd { font-weight: 600; }

.tab-bar { display: flex; gap: 6px; margin-bottom: 16px; }
.tab-bar a {
  padding: 7px 14px; border-radius: 20px;
  text-decoration: none; color: var(--muted); font-weight: 600; font-size: 13px;
}
.tab-bar a.active { background: var(--night); color: #fff; }
.tab-bar a:hover:not(.active) { background: #e8eef3; }

.flash {
  background: #e2f3ea; color: #2c7a54;
  border: 1px solid #bfe3d0;
  padding: 10px 14px; border-radius: 8px; margin-bottom: 16px;
}
.flash-error { background: #fbe4e4; color: #b03030; border-color: #f0c4c4; }
.empty { color: var(--muted); padding: 18px 0; text-align: center; }

/* ---------- Login ---------- */
.login-body {
  display: grid; place-items: center;
  background:
    radial-gradient(700px 400px at 20% 10%, rgba(79,195,232,.18), transparent),
    linear-gradient(160deg, var(--night), var(--night-2));
}
.login-card {
  background: var(--card);
  border-radius: 14px;
  padding: 34px 32px;
  width: min(400px, 92vw);
  display: flex; flex-direction: column; gap: 14px;
  box-shadow: 0 24px 60px rgba(0,0,0,.35);
}
.login-brand .brand-name { color: var(--night); }
.login-lead { color: var(--muted); font-size: 14px; }
.login-hint { text-align: center; font-size: 12px; color: var(--muted); }

/* ---------- Responsif ---------- */
@media (max-width: 900px) {
  body { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; flex-direction: row; align-items: center; flex-wrap: wrap; gap: 10px; }
  .sidebar nav { flex-direction: row; flex-wrap: wrap; }
  .sidebar-foot { margin: 0 0 0 auto; border: none; padding: 0; display: flex; gap: 12px; align-items: center; }
  .two-col, .stat-grid, .form-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: span 1; }
  .content { padding: 18px; }
  .ai-row { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
