/* ─────────────────────────────────────────────────────────────────
   CORETAX DJP — Design System
   Inspired by: Linear, Stripe, GitHub
   ───────────────────────────────────────────────────────────────── */

/* TOKENS */
:root {
  --c-bg:         #0d1117;
  --c-surface:    #161b22;
  --c-surface-2:  #1c2128;
  --c-border:     #30363d;
  --c-border-sub: #21262d;

  --c-text:       #e6edf3;
  --c-text-sub:   #8b949e;
  --c-text-mute:  #484f58;

  --c-blue:       #2f81f7;
  --c-blue-bg:    rgba(47,129,247,0.1);
  --c-blue-border:rgba(47,129,247,0.3);

  --c-green:      #3fb950;
  --c-green-bg:   rgba(63,185,80,0.1);
  --c-green-border:rgba(63,185,80,0.25);

  --c-red:        #f85149;
  --c-red-bg:     rgba(248,81,73,0.1);
  --c-red-border: rgba(248,81,73,0.25);

  --c-yellow:     #d29922;
  --c-yellow-bg:  rgba(210,153,34,0.1);
  --c-yellow-border:rgba(210,153,34,0.25);

  --c-purple:     #bc8cff;

  --sidebar-w: 220px;
  --r:  6px;
  --r2: 8px;
  --r3: 12px;

  --f-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --f-mono: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
}

/* RESET */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; }
body {
  font-family: var(--f-sans);
  background: var(--c-bg);
  color: var(--c-text);
  font-size: 13px;
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
input, button, select, textarea { font-family: inherit; }
a { color: var(--c-blue); text-decoration: none; }
a:hover { text-decoration: underline; }
.hidden { display: none !important; }


/* ─── AUTH PAGE ───────────────────────────────────────────────── */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.auth-card {
  width: 100%;
  max-width: 380px;
}

.auth-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 2rem;
}

.auth-logo-icon {
  width: 32px;
  height: 32px;
  background: var(--c-blue);
  border-radius: var(--r);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex-shrink: 0;
}

.auth-logo-text { font-size: 15px; font-weight: 700; color: var(--c-text); }
.auth-logo-sub  { font-size: 11px; color: var(--c-text-sub); margin-top: 1px; }

.auth-heading { font-size: 20px; font-weight: 600; color: var(--c-text); margin-bottom: 4px; }
.auth-sub     { font-size: 13px; color: var(--c-text-sub); margin-bottom: 1.75rem; }

.field { margin-bottom: 1rem; }
.field label { display: block; font-size: 12px; font-weight: 500; color: var(--c-text-sub); margin-bottom: 5px; }
.field input {
  width: 100%;
  height: 36px;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r);
  padding: 0 10px;
  font-size: 13px;
  color: var(--c-text);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.field input:focus { border-color: var(--c-blue); box-shadow: 0 0 0 3px var(--c-blue-bg); }
.field input::placeholder { color: var(--c-text-mute); }

.error-msg {
  display: none;
  font-size: 12px;
  color: var(--c-red);
  background: var(--c-red-bg);
  border: 1px solid var(--c-red-border);
  border-radius: var(--r);
  padding: 8px 10px;
  margin-bottom: 12px;
  line-height: 1.5;
}

.auth-divider {
  text-align: center;
  font-size: 12px;
  color: var(--c-text-mute);
  margin: 1.5rem 0 1rem;
  position: relative;
}
.auth-divider::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0; right: 0;
  height: 1px;
  background: var(--c-border-sub);
}
.auth-divider span { background: var(--c-bg); padding: 0 8px; position: relative; }

.auth-switch { font-size: 12px; color: var(--c-text-sub); text-align: center; margin-top: 1.25rem; }
.auth-switch a { color: var(--c-blue); font-weight: 500; }

.auth-footer {
  margin-top: 3rem;
  border-top: 1px solid var(--c-border-sub);
  padding-top: 1.25rem;
  text-align: center;
  font-size: 11px;
  color: var(--c-text-mute);
}


/* ─── BUTTONS ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 32px;
  padding: 0 14px;
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--r);
  border: 1px solid transparent;
  cursor: pointer;
  transition: opacity 0.15s, background 0.15s;
  white-space: nowrap;
  font-family: inherit;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-full { width: 100%; height: 36px; }

.btn-primary { background: var(--c-blue); color: #fff; border-color: rgba(255,255,255,0.1); }
.btn-primary:hover:not(:disabled) { background: #388bfd; }

.btn-secondary { background: var(--c-surface-2); color: var(--c-text); border-color: var(--c-border); }
.btn-secondary:hover:not(:disabled) { background: var(--c-surface); }

.btn-ghost { background: transparent; color: var(--c-text-sub); border-color: var(--c-border); }
.btn-ghost:hover:not(:disabled) { background: var(--c-surface-2); color: var(--c-text); }

.btn-danger { background: var(--c-red-bg); color: var(--c-red); border-color: var(--c-red-border); }
.btn-danger:hover:not(:disabled) { background: rgba(248,81,73,0.18); }

.btn-success { background: var(--c-green-bg); color: var(--c-green); border-color: var(--c-green-border); }
.btn-success:hover:not(:disabled) { background: rgba(63,185,80,0.18); }

.btn-sm { height: 26px; padding: 0 10px; font-size: 12px; }


/* ─── SPINNER ─────────────────────────────────────────────────── */
.spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,0.25);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
  display: inline-block;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }


/* ─── NOTIFICATION TOAST ──────────────────────────────────────── */
.notif {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 300;
  min-width: 260px;
  max-width: 380px;
  padding: 12px 16px;
  border-radius: var(--r2);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.5;
  background: var(--c-surface-2);
  border: 1px solid var(--c-border);
  color: var(--c-text);
  box-shadow: 0 8px 24px rgba(1,4,9,0.5), 0 1px 3px rgba(1,4,9,0.3);
  display: flex;
  align-items: flex-start;
  gap: 10px;
  animation: toastIn 0.22s cubic-bezier(0.21,1.02,0.73,1) forwards;
}
.notif::before {
  content: '';
  width: 4px;
  min-height: 16px;
  border-radius: 4px;
  flex-shrink: 0;
  margin-top: 1px;
}
.notif.success::before { background: var(--c-green); }
.notif.error::before   { background: var(--c-red); }
@keyframes toastIn {
  from { opacity: 0; transform: translateY(12px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0)    scale(1); }
}


/* ─── MODAL ───────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(1,4,9,0.7);
  z-index: 200;
  display: flex; align-items: center; justify-content: center;
}
.modal-box {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r3);
  padding: 20px 24px;
  max-width: 400px;
  width: 90%;
  box-shadow: 0 16px 48px rgba(1,4,9,0.5);
}
.modal-title { font-size: 14px; font-weight: 600; margin-bottom: 6px; }
#modalMessage { font-size: 13px; color: var(--c-text-sub); line-height: 1.6; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 20px; }


/* ─── APP SHELL (Dashboard + Admin) ──────────────────────────── */
.app {
  display: flex;
  min-height: 100vh;
}


/* TOPBAR */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 48px;
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 16px;
  z-index: 100;
}

.topbar-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 700;
  color: var(--c-text);
  text-decoration: none;
  flex-shrink: 0;
}

.topbar-logo-icon {
  width: 26px;
  height: 26px;
  background: var(--c-blue);
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.topbar-divider {
  width: 1px;
  height: 20px;
  background: var(--c-border);
}

.topbar-section {
  font-size: 13px;
  color: var(--c-text-sub);
}

.topbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  border-radius: var(--r);
  background: var(--c-surface-2);
  border: 1px solid var(--c-border);
}

.user-dot {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--c-blue);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
.user-dot.admin { background: #6e40c9; }

.user-name-text { font-size: 12px; font-weight: 500; color: var(--c-text); }
.user-role-text { font-size: 11px; color: var(--c-text-sub); }


/* SIDEBAR */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--c-surface);
  border-right: 1px solid var(--c-border);
  position: fixed;
  top: 48px;
  bottom: 0;
  left: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.sidebar-nav-top { padding: 12px 8px; }
.sidebar-nav-bottom {
  padding: 8px;
  border-top: 1px solid var(--c-border);
}

.nav-logout {
  color: var(--c-text-sub) !important;
  border: none;
  background: none;
  cursor: pointer;
  width: 100%;
  text-align: left;
}
.nav-logout:hover { background: var(--c-red-bg) !important; color: var(--c-red) !important; }
.nav-logout:hover svg { stroke: var(--c-red); }

/* ─── PROFILE PAGE ────────────────────────────────────────────── */
.profile-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.profile-info-card,
.profile-pass-card {
  background: var(--c-surface-2);
  border: 1px solid var(--c-border);
  border-radius: var(--r2);
  padding: 20px;
}

.profile-group-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--c-text-mute);
  margin-bottom: 14px;
}

.profile-field {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 9px 0;
  border-bottom: 1px solid var(--c-border-sub);
}
.profile-field:last-of-type { border-bottom: none; margin-bottom: 12px; }

.profile-field-label {
  font-size: 12px;
  color: var(--c-text-sub);
  font-weight: 500;
}

.profile-field-value {
  font-size: 13px;
  color: var(--c-text);
  font-weight: 500;
}

.profile-field-value.mono {
  font-family: var(--f-mono);
  font-size: 12px;
  letter-spacing: 0.05em;
  color: var(--c-text-sub);
}

.profile-note {
  font-size: 11px;
  color: var(--c-text-mute);
  line-height: 1.5;
  margin-top: 4px;
}

@media (max-width: 768px) {
  .profile-grid { grid-template-columns: 1fr; }
}

.nav-section-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--c-text-mute);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 6px 8px 4px;
  margin-top: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: var(--r);
  font-size: 13px;
  font-weight: 500;
  color: var(--c-text-sub);
  text-decoration: none;
  cursor: pointer;
  transition: background 0.1s, color 0.1s;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}
.nav-item:hover { background: var(--c-surface-2); color: var(--c-text); text-decoration: none; }
.nav-item.active { background: var(--c-blue-bg); color: var(--c-blue); }
.nav-item svg { flex-shrink: 0; opacity: 0.75; }
.nav-item.active svg { opacity: 1; }

.nav-spacer { flex: 1; }

.nav-bottom { padding-top: 8px; border-top: 1px solid var(--c-border-sub); }


/* MAIN */
.main {
  flex: 1;
  margin-left: var(--sidebar-w);
  margin-top: 48px;
  min-width: 0;
  padding: 24px 28px;
}


/* PAGE HEADER */
.page-hd {
  margin-bottom: 20px;
}
.page-hd h1 {
  font-size: 16px;
  font-weight: 600;
  color: var(--c-text);
  line-height: 1.3;
}
.page-hd p { font-size: 13px; color: var(--c-text-sub); margin-top: 2px; }


/* STAT GRID */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.stat-item {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r2);
  padding: 16px;
}

.stat-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--c-text-sub);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

.stat-val {
  font-size: 22px;
  font-weight: 700;
  line-height: 1.2;
  color: var(--c-text);
  word-break: break-word;
}

.stat-val.blue   { color: var(--c-blue); }
.stat-val.green  { color: var(--c-green); }
.stat-val.yellow { color: var(--c-yellow); }

.stat-note { font-size: 11px; color: var(--c-text-mute); margin-top: 4px; }


/* SECTION CARD */
.section {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r2);
  margin-bottom: 16px;
  overflow: hidden;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--c-border);
}

.section-title { font-size: 13px; font-weight: 600; color: var(--c-text); }
.section-desc  { font-size: 12px; color: var(--c-text-sub); margin-top: 1px; }

.section-body { padding: 16px; }


/* FORM INLINE */
.form-inline {
  display: grid;
  grid-template-columns: 140px 1fr auto;
  gap: 10px;
  align-items: end;
}
.form-inline .field { margin-bottom: 0; }

.field-full { grid-column: 1 / -1; }


/* TABLE */
.tbl-wrap { overflow-x: auto; }

.tbl {
  width: 100%;
  border-collapse: collapse;
}

.tbl th {
  text-align: left;
  padding: 8px 12px;
  font-size: 11px;
  font-weight: 600;
  color: var(--c-text-sub);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--c-border);
  white-space: nowrap;
}

.tbl td {
  padding: 10px 12px;
  font-size: 13px;
  color: var(--c-text);
  border-bottom: 1px solid var(--c-border-sub);
  vertical-align: middle;
}

.tbl tbody tr:last-child td { border-bottom: none; }
.tbl tbody tr:hover td { background: rgba(177,186,196,0.04); }

.tbl-empty {
  text-align: center;
  color: var(--c-text-mute);
  padding: 32px 16px !important;
  font-size: 13px;
}

.cell-name { font-weight: 500; color: var(--c-text); }
.cell-nik  { font-family: var(--f-mono); font-size: 11px; color: var(--c-text-sub); margin-top: 1px; letter-spacing: 0.04em; }
.cell-actions { display: flex; gap: 6px; align-items: center; }


/* BADGES */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  border: 1px solid;
}
.badge-red    { color: var(--c-red);    background: var(--c-red-bg);    border-color: var(--c-red-border); }
.badge-yellow { color: var(--c-yellow); background: var(--c-yellow-bg); border-color: var(--c-yellow-border); }
.badge-green  { color: var(--c-green);  background: var(--c-green-bg);  border-color: var(--c-green-border); }


/* ─── RESPONSIVE ──────────────────────────────────────────────── */
.section, .stat-grid { scroll-margin-top: 64px; }
@media (max-width: 768px) {
  .stat-grid { grid-template-columns: 1fr; }
  .form-inline { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .main { margin-left: 0; padding: 16px; }
}
