/* Stellerbit — App shell (CRM/HRMS demo + admin) */
@import url('https://fonts.googleapis.com/css2?family=Unbounded:wght@400;500;700&family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --ink: #000;
  --paper: #F4F1EC;
  --panel: #FFFFFF;
  --panel-alt: #FAF8F4;
  --ink-soft: #1A1A1A;
  --grey-700: #3E3E3A;
  --grey-500: #6B6B66;
  --grey-300: #B8B5AC;
  --hairline: #E5E2D9;
  --hairline-strong: #C9C6BC;
  --danger: #000;
  --display: 'Unbounded', system-ui, sans-serif;
  --body: 'Inter', system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { font: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select, textarea { font: inherit; }

/* ---------- APP SHELL ---------- */
.app {
  display: grid;
  grid-template-columns: 260px 1fr;
  height: 100vh;
}

.sidebar {
  background: var(--ink);
  color: var(--paper);
  padding: 24px 0;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--ink);
  overflow-y: auto;
}
.sb-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 24px 24px;
  border-bottom: 1px solid rgba(244,241,236,0.12);
}
.sb-brand svg { width: 28px; height: 28px; fill: var(--paper); }
.sb-brand .sb-name {
  font-family: var(--display);
  font-weight: 700;
  font-size: 13px;
  line-height: 1;
}
.sb-brand .sb-name small {
  display: block;
  font-family: var(--mono);
  font-weight: 400;
  font-size: 9px;
  letter-spacing: 0.25em;
  color: var(--grey-300);
  margin-top: 4px;
}

.sb-context {
  padding: 20px 24px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.15em;
  color: var(--grey-300);
  border-bottom: 1px solid rgba(244,241,236,0.12);
}
.sb-context strong {
  display: block;
  font-family: var(--display);
  font-weight: 500;
  font-size: 14px;
  color: var(--paper);
  letter-spacing: 0;
  margin-top: 6px;
}

.sb-nav {
  padding: 16px 0;
  flex: 1;
}
.sb-nav .sb-label {
  padding: 16px 24px 8px;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.2em;
  color: var(--grey-500);
}
.sb-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 24px;
  font-size: 13px;
  color: var(--grey-300);
  border-left: 2px solid transparent;
  transition: all 0.2s;
}
.sb-nav a:hover { color: var(--paper); background: rgba(244,241,236,0.04); }
.sb-nav a.active {
  color: var(--paper);
  background: rgba(244,241,236,0.06);
  border-left-color: var(--paper);
}
.sb-nav a svg { width: 16px; height: 16px; flex-shrink: 0; }
.sb-nav a .count {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--grey-500);
  background: rgba(244,241,236,0.06);
  padding: 2px 8px;
  border-radius: 2px;
}

.sb-footer {
  padding: 20px 24px;
  border-top: 1px solid rgba(244,241,236,0.12);
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
}
.sb-avatar {
  width: 32px; height: 32px;
  background: var(--paper);
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--display);
  font-weight: 500;
  font-size: 12px;
}
.sb-user { flex: 1; line-height: 1.2; }
.sb-user strong { color: var(--paper); font-weight: 500; font-size: 12px; display: block; }
.sb-user small { font-family: var(--mono); font-size: 9px; letter-spacing: 0.15em; color: var(--grey-500); }
.sb-footer a { color: var(--grey-300); }
.sb-footer a:hover { color: var(--paper); }

.main-area {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--paper);
}

/* ---------- TOP BAR ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 16px 32px;
  border-bottom: 1px solid var(--hairline);
  background: var(--paper);
}
.topbar h1 {
  font-family: var(--display);
  font-weight: 500;
  font-size: 22px;
  letter-spacing: -0.015em;
  line-height: 1;
}
.topbar h1 small {
  display: block;
  font-family: var(--mono);
  font-weight: 400;
  font-size: 10px;
  letter-spacing: 0.2em;
  color: var(--grey-500);
  margin-top: 6px;
}
.topbar .search {
  flex: 1;
  max-width: 480px;
  position: relative;
  margin-left: auto;
}
.topbar .search input {
  width: 100%;
  padding: 10px 14px 10px 36px;
  border: 1px solid var(--hairline);
  background: var(--panel);
  font-size: 13px;
  color: var(--ink);
  outline: none;
}
.topbar .search input:focus { border-color: var(--ink); }
.topbar .search svg {
  position: absolute;
  left: 12px; top: 50%;
  transform: translateY(-50%);
  width: 14px; height: 14px;
  color: var(--grey-500);
}
.topbar .tb-actions {
  display: flex;
  gap: 8px;
}
.topbar .tb-btn {
  padding: 9px 16px;
  border: 1px solid var(--ink);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.topbar .tb-btn:hover { background: var(--ink); color: var(--paper); }
.topbar .tb-btn.primary { background: var(--ink); color: var(--paper); }
.topbar .tb-btn.primary:hover { background: var(--paper); color: var(--ink); }
.topbar .tb-icon {
  width: 36px; height: 36px;
  border: 1px solid var(--hairline);
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
}
.topbar .tb-icon:hover { border-color: var(--ink); }
.topbar .tb-icon svg { width: 14px; height: 14px; }

/* ---------- CONTENT ---------- */
.content {
  flex: 1;
  overflow-y: auto;
  padding: 24px 32px 40px;
}
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.section-head h2 {
  font-family: var(--display);
  font-weight: 500;
  font-size: 16px;
  letter-spacing: -0.01em;
}
.section-head .sh-sub {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.15em;
  color: var(--grey-500);
}

/* ---------- KPI CARDS ---------- */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--hairline);
  border: 1px solid var(--hairline);
  margin-bottom: 32px;
}
.kpi {
  background: var(--panel);
  padding: 20px 22px;
  position: relative;
}
.kpi:hover { background: var(--panel-alt); }
.kpi .kpi-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.15em;
  color: var(--grey-500);
  margin-bottom: 10px;
}
.kpi .kpi-value {
  font-family: var(--display);
  font-weight: 500;
  font-size: 32px;
  line-height: 1;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}
.kpi .kpi-delta {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--grey-500);
}
.kpi .kpi-delta.up::before { content: '↑ '; color: var(--ink); }
.kpi .kpi-delta.down::before { content: '↓ '; color: var(--ink); }
.kpi .kpi-spark {
  position: absolute;
  right: 16px;
  bottom: 16px;
  width: 80px; height: 28px;
  color: var(--grey-300);
}
@media (max-width: 900px) {
  .kpi-row { grid-template-columns: repeat(2, 1fr); }
}

/* ---------- SPLIT LAYOUT ---------- */
.split {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 1px;
  background: var(--hairline);
  border: 1px solid var(--hairline);
  margin-bottom: 32px;
}
.panel {
  background: var(--panel);
  padding: 20px 22px;
}
@media (max-width: 1000px) { .split { grid-template-columns: 1fr; } }

/* ---------- TABLE ---------- */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.table thead th {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.15em;
  color: var(--grey-500);
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--hairline);
  font-weight: 400;
}
.table tbody td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--hairline);
  vertical-align: middle;
}
.table tbody tr { transition: background 0.15s; }
.table tbody tr:hover { background: var(--panel-alt); }
.table .row-id {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--grey-500);
}
.table .row-name { font-weight: 500; }
.table .row-name small {
  display: block;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--grey-500);
  margin-top: 2px;
  font-weight: 400;
}
.table .row-actions {
  text-align: right;
  white-space: nowrap;
}
.row-actions button {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  padding: 4px 10px;
  border: 1px solid var(--hairline);
  margin-left: 4px;
  transition: all 0.15s;
}
.row-actions button:hover { border-color: var(--ink); background: var(--ink); color: var(--paper); }

/* Stage / status pills */
.pill {
  display: inline-block;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  padding: 3px 8px;
  border: 1px solid var(--ink);
}
.pill.filled { background: var(--ink); color: var(--paper); }
.pill.ghost { border-color: var(--hairline-strong); color: var(--grey-500); }

/* ---------- KANBAN ---------- */
.kanban {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1px;
  background: var(--hairline);
  border: 1px solid var(--hairline);
  margin-bottom: 32px;
}
.k-col {
  background: var(--panel);
  padding: 16px 14px;
  min-height: 240px;
}
.k-col-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--hairline);
}
.k-col-head .kh-name {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.15em;
}
.k-col-head .kh-count {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--grey-500);
}
.k-card {
  background: var(--panel-alt);
  border: 1px solid var(--hairline);
  padding: 10px 12px;
  margin-bottom: 8px;
  transition: all 0.2s;
  cursor: grab;
}
.k-card:hover { border-color: var(--ink); }
.k-card .kc-name { font-weight: 500; font-size: 13px; }
.k-card .kc-meta {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--grey-500);
  margin-top: 6px;
  display: flex;
  justify-content: space-between;
}
@media (max-width: 900px) {
  .kanban { grid-template-columns: repeat(2, 1fr); }
}

/* ---------- ATTENDANCE GRID ---------- */
.attendance {
  overflow-x: auto;
  border: 1px solid var(--hairline);
  background: var(--panel);
}
.att-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  min-width: 900px;
}
.att-table th, .att-table td {
  padding: 8px 6px;
  text-align: center;
  border-right: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
}
.att-table th:first-child, .att-table td:first-child {
  text-align: left;
  padding-left: 16px;
  min-width: 180px;
  position: sticky;
  left: 0;
  background: var(--panel);
  z-index: 1;
}
.att-table th {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--grey-500);
  background: var(--panel-alt);
  font-weight: 400;
}
.att-cell {
  display: inline-block;
  width: 20px; height: 20px;
  line-height: 20px;
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 500;
}
.att-cell.P { background: var(--ink); color: var(--paper); }
.att-cell.L { background: var(--hairline-strong); color: var(--ink); }
.att-cell.W { background: var(--hairline); color: var(--grey-500); }
.att-cell.A { background: var(--panel); border: 1px solid var(--ink); color: var(--ink); }

/* ---------- BAR CHART ---------- */
.chart-wrap { position: relative; }
.chart-legend {
  display: flex;
  gap: 16px;
  margin-top: 12px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--grey-500);
}
.chart-legend span { display: flex; align-items: center; gap: 6px; }
.chart-legend span::before {
  content: '';
  width: 10px; height: 10px;
  background: var(--ink);
  display: inline-block;
}
.chart-legend span.alt::before { background: var(--hairline-strong); }

/* ---------- FORM (admin) ---------- */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
@media (max-width: 780px) { .form-grid { grid-template-columns: 1fr; } }

.field { display: block; }
.field label {
  display: block;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.15em;
  color: var(--grey-500);
  margin-bottom: 6px;
}
.field input, .field select, .field textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--hairline-strong);
  background: var(--panel);
  color: var(--ink);
  font-size: 13px;
  outline: none;
  transition: border 0.15s;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--ink); }
.field textarea { resize: vertical; min-height: 90px; }
.field.span-2 { grid-column: 1 / -1; }

.form-actions-row {
  display: flex;
  gap: 8px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--hairline);
}
.btn-admin {
  padding: 10px 18px;
  border: 1px solid var(--ink);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  transition: all 0.2s;
}
.btn-admin:hover { background: var(--ink); color: var(--paper); }
.btn-admin.primary { background: var(--ink); color: var(--paper); }
.btn-admin.primary:hover { background: var(--paper); color: var(--ink); }
.btn-admin.ghost { border-color: var(--hairline-strong); color: var(--grey-500); }

/* Editable list items in admin */
.list-editor { border: 1px solid var(--hairline); background: var(--panel); }
.list-editor .le-item {
  display: grid;
  grid-template-columns: 30px 1fr 2fr 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--hairline);
}
.list-editor .le-item:last-child { border-bottom: none; }
.list-editor .le-num {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--grey-500);
}
.le-item input {
  padding: 6px 10px;
  border: 1px solid transparent;
  background: transparent;
  font-size: 13px;
  outline: none;
}
.le-item input:hover { border-color: var(--hairline); }
.le-item input:focus { border-color: var(--ink); background: var(--panel-alt); }
.le-remove {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  padding: 4px 10px;
  border: 1px solid var(--hairline);
}
.le-remove:hover { border-color: var(--ink); background: var(--ink); color: var(--paper); }

/* ---------- TOAST ---------- */
.toast {
  position: fixed;
  bottom: 24px; right: 24px;
  background: var(--ink);
  color: var(--paper);
  padding: 12px 18px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.15em;
  z-index: 1000;
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.3s;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translateY(0); }

/* ---------- MODAL ---------- */
.modal-back {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 500;
  padding: 20px;
}
.modal-back.open { display: flex; }
.modal {
  background: var(--paper);
  border: 1px solid var(--ink);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
}
.modal-head {
  padding: 20px 24px;
  border-bottom: 1px solid var(--hairline);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.modal-head h3 {
  font-family: var(--display);
  font-weight: 500;
  font-size: 18px;
  letter-spacing: -0.01em;
}
.modal-head button {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--grey-500);
}
.modal-body { padding: 24px; }

/* ---------- MOBILE ---------- */
.sb-mobile-trigger {
  display: none;
  padding: 8px;
  border: 1px solid var(--hairline);
  background: var(--panel);
}
.sb-mobile-trigger span {
  display: block;
  width: 20px; height: 1.5px;
  background: var(--ink);
  margin: 4px 0;
}

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: 260px;
    transform: translateX(-100%);
    transition: transform 0.3s;
    z-index: 200;
  }
  .sidebar.open { transform: translateX(0); }
  .sb-mobile-trigger { display: block; }
  .topbar { padding: 12px 20px; gap: 12px; flex-wrap: wrap; }
  .topbar h1 { font-size: 18px; }
  .topbar .search { max-width: none; order: 3; flex-basis: 100%; }
  .content { padding: 20px; }
}
/* PHP studio shell compatibility */
body{font-family:Inter,system-ui,sans-serif}
