:root {
  --bg: #050505;
  --surface: #111111;
  --card: #161616;
  --card-hover: #1e1e1e;
  --accent: #cc0000;
  --text: #e8e8e8;
  --muted: #777777;
  --border: rgba(255, 255, 255, 0.07);
  --radius: 4px;
  --green: #00ff88;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Rajdhani', 'Segoe UI', sans-serif;
  font-size: 15px;
}

.tabbar {
  display: flex;
  gap: 4px;
  padding: 10px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.tab {
  flex: 1;
  padding: 10px;
  background: transparent;
  border: none;
  color: var(--muted);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: var(--radius);
  cursor: pointer;
}

.tab.active { color: var(--text); background: var(--card); }

.main { padding: 12px; padding-bottom: 40px; }

.section { display: none; }
.section.active { display: block; }

.kpi-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}

.kpi-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
}

.kpi-card__label { color: var(--muted); font-size: 0.75rem; text-transform: uppercase; }
.kpi-card__value { font-size: 1.5rem; font-weight: 700; margin-top: 6px; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 12px;
  overflow: hidden;
}

.card__header {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 0.9rem;
}

.chart-wrap { padding: 16px 14px; }
.chart-bars { display: flex; align-items: flex-end; gap: 4px; height: 100px; }
.chart-bar {
  flex: 1;
  background: var(--accent);
  border-radius: 2px 2px 0 0;
  min-height: 2px;
  opacity: 0.85;
}

.data-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.data-table th {
  text-align: left;
  padding: 8px 10px;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.72rem;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
}
.data-table td { padding: 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr.row-clickable { cursor: pointer; }
.data-table tbody tr.row-clickable:active { background: var(--card-hover); }

.status-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 2px;
  font-size: 0.7rem;
  font-weight: 600;
  white-space: nowrap;
}
.status-new { background: rgba(255,255,255,0.1); color: var(--text); }
.status-work { background: rgba(255,180,0,0.15); color: #ffb400; }
.status-shipped { background: rgba(0,255,136,0.15); color: var(--green); }
.status-cancel { background: rgba(204,0,0,0.15); color: var(--accent); }

.due-hint { font-size: 0.7rem; color: var(--muted); margin-top: 2px; }
.due-overdue { color: var(--accent); }

.toolbar { display: flex; gap: 8px; margin-bottom: 12px; }
.search {
  flex: 1;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 12px;
  border-radius: var(--radius);
  font-family: inherit;
}

.btn {
  border: none;
  border-radius: var(--radius);
  padding: 10px 16px;
  font-family: inherit;
  font-weight: 600;
  font-size: 0.82rem;
  cursor: pointer;
}
.btn--primary { background: var(--accent); color: #fff; }
.btn--ghost { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn--sm { padding: 6px 12px; font-size: 0.75rem; }
.btn--danger { background: transparent; border: 1px solid var(--accent); color: var(--accent); }

.modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 100;
  align-items: flex-end;
}
.modal.open { display: flex; }
.modal__overlay { position: absolute; inset: 0; background: rgba(0,0,0,0.7); }
.modal__content {
  position: relative;
  background: var(--surface);
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 20px;
  border-top: 1px solid var(--border);
}
.modal__close {
  position: absolute;
  top: 12px;
  right: 12px;
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 1.1rem;
  cursor: pointer;
}
.modal h3 { margin-bottom: 14px; }
.modal__actions { display: flex; gap: 10px; margin-top: 16px; }
.modal__actions .btn { flex: 1; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 10px; }

.field { margin-bottom: 10px; }
.field label { display: block; font-size: 0.72rem; color: var(--muted); margin-bottom: 4px; text-transform: uppercase; }
.field input, .field select {
  width: 100%;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px;
  border-radius: var(--radius);
  font-family: inherit;
}

.item-row { display: grid; grid-template-columns: 1fr 80px 60px 30px; gap: 6px; margin-bottom: 6px; }
.item-row input {
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 0.8rem;
}
.item-row button { background: transparent; border: none; color: var(--accent); font-size: 1rem; cursor: pointer; }

.order-total { margin: 10px 0; font-size: 0.9rem; }

.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; font-size: 0.82rem; margin-bottom: 14px; }
.detail-grid div span { color: var(--muted); display: block; font-size: 0.7rem; text-transform: uppercase; }

.note { background: var(--card); border-radius: var(--radius); padding: 8px 10px; margin-bottom: 6px; font-size: 0.8rem; display: flex; justify-content: space-between; gap: 8px; }
.note__date { color: var(--muted); font-size: 0.68rem; }
.note button { background: none; border: none; color: var(--muted); cursor: pointer; }
.note-add { display: flex; gap: 6px; margin-top: 10px; }
.note-add input { flex: 1; }

.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--card);
  border: 1px solid var(--border);
  padding: 10px 18px;
  border-radius: var(--radius);
  font-size: 0.82rem;
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s ease;
  z-index: 200;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
