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

:root {
  --bg-dark: #0a0a0a;
  --bg-card: #141414;
  --bg-input: #1e1e1e;
  --border: #2a2a2a;
  --text: #e0e0e0;
  --text-muted: #888;
  --accent: #c5a047;
  --accent-hover: #d4b05a;
  --danger: #e74c3c;
  --success: #2ecc71;
}

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg-dark);
  color: var(--text);
  min-height: 100vh;
}

/* ============ LOGIN ============ */
.login-page {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #0a0a0a 0%, #1a1a1a 100%);
}

.login-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 48px 40px;
  width: 400px;
  text-align: center;
}

.login-logo-img {
  width: 220px;
  margin-bottom: 16px;
}

.login-logo {
  font-size: 28px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 8px;
  letter-spacing: 2px;
}

.login-subtitle {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 32px;
}

.form-group {
  margin-bottom: 16px;
  text-align: left;
}

.form-group label {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.form-group input, .form-group select {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

.form-group input:focus, .form-group select:focus {
  border-color: var(--accent);
}

.btn {
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-primary {
  background: var(--accent);
  color: #000;
  width: 100%;
}

.btn-primary:hover { background: var(--accent-hover); }

.btn-sm {
  padding: 6px 14px;
  font-size: 12px;
}

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #c0392b; }

.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #27ae60; }

.btn-outline {
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
}

.btn-outline:hover {
  background: var(--accent);
  color: #000;
}

.login-error {
  color: var(--danger);
  font-size: 13px;
  margin-top: 12px;
  min-height: 20px;
}

/* ============ APP LAYOUT ============ */
.app-container { display: none; }

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar-logo {
  height: 32px;
}

.topbar-brand {
  font-size: 20px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 2px;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.topbar-user {
  color: var(--text-muted);
  font-size: 13px;
}

.topbar-role {
  background: var(--accent);
  color: #000;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  margin-left: 6px;
}

/* ============ TABS ============ */
.tabs {
  display: flex;
  gap: 0;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
}

.tab {
  padding: 12px 24px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
}

.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ============ CONTENT ============ */
.content {
  padding: 24px;
  max-width: 1600px;
  margin: 0 auto;
}

.tab-content { display: none; }
.tab-content.active { display: block; }

/* ============ TOOLBAR ============ */
.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  gap: 12px;
  flex-wrap: wrap;
}

.search-box {
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
  width: 300px;
  outline: none;
}

.search-box:focus { border-color: var(--accent); }

.toolbar-right {
  display: flex;
  gap: 8px;
  align-items: center;
}

.selected-count {
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
}

.filter-select {
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 13px;
  outline: none;
}

/* ============ TABLE ============ */
.table-wrapper {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

thead th {
  background: #1a1a1a;
  padding: 12px 10px;
  text-align: left;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  position: sticky;
  top: 0;
}

tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}

tbody tr:hover { background: #1a1a1a; }
tbody tr.selected { background: rgba(197, 160, 71, 0.08); }

td {
  padding: 10px;
  white-space: nowrap;
}

.category-row td {
  background: #1e1e1e;
  font-weight: 700;
  color: var(--accent);
  padding: 8px 10px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.price-cell {
  font-family: 'Courier New', monospace;
  text-align: right;
  font-size: 12px;
}

.price-na { color: var(--text-muted); }

input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}

/* ============ MODAL ============ */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.7);
  z-index: 1000;
  justify-content: center;
  align-items: flex-start;
  padding-top: 60px;
}

.modal-overlay.active { display: flex; }

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 32px;
  width: 500px;
  max-height: 80vh;
  overflow-y: auto;
}

.modal h2 {
  margin-bottom: 24px;
  font-size: 18px;
  color: var(--accent);
}

.modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 24px;
}

/* ============ ADMIN USERS TABLE ============ */
.admin-section {
  margin-bottom: 32px;
}

.admin-section h3 {
  font-size: 16px;
  color: var(--accent);
  margin-bottom: 16px;
}

.action-btns {
  display: flex;
  gap: 6px;
}

/* ============ TOAST ============ */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 12px 20px;
  background: var(--success);
  color: #fff;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  z-index: 2000;
  display: none;
  animation: fadeIn 0.3s;
}

.toast.error { background: var(--danger); }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ============ PRODUCT THUMBNAILS ============ */
.product-thumb {
  width: 40px;
  height: 40px;
  object-fit: contain;
  border-radius: 4px;
  background: #1e1e1e;
}

.img-cell { width: 50px; }
.no-img { color: var(--text-muted); font-size: 11px; }
.small-text { font-size: 11px; max-width: 120px; white-space: normal; line-height: 1.3; }

/* ============ QUOTATION ============ */
.quotation-header-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px 24px;
}

.quotation-header-section h3 {
  color: var(--accent);
  font-size: 14px;
  margin-bottom: 16px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.quotation-header-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 20px;
}

.quotation-header-grid.three-col {
  grid-template-columns: 1fr 1fr 1fr;
}

.form-input {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s;
}

.form-input:focus { border-color: var(--accent); }

.quotation-grand-total {
  margin-top: 16px;
  text-align: right;
  font-size: 18px;
  font-weight: 700;
  color: var(--accent);
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.q-select {
  padding: 4px 6px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  font-size: 11px;
  max-width: 110px;
  outline: none;
}

.q-select:focus { border-color: var(--accent); }

.q-select.flash-red {
  border-color: var(--danger);
  animation: flashRed 0.6s ease-in-out 3;
}

@keyframes flashRed {
  0%, 100% { border-color: var(--danger); background: var(--bg-input); }
  50% { border-color: #ff6b6b; background: rgba(231, 76, 60, 0.15); }
}

.q-input {
  padding: 4px 6px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  font-size: 12px;
  outline: none;
  text-align: center;
}

.q-input:focus { border-color: var(--accent); }
.qty-input { width: 50px; }
.disc-input { width: 55px; }

/* Responsive */
@media (max-width: 768px) {
  /* Login */
  .login-box { width: 92%; padding: 28px 20px; }
  .login-logo-img { width: 160px; }

  /* Topbar */
  .topbar { padding: 12px 16px; gap: 8px; }
  .topbar-logo { height: 24px; }
  .topbar-right { gap: 8px; }
  .topbar-user { font-size: 11px; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

  /* Tabs */
  .tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; padding: 0 8px; }
  .tab { padding: 10px 14px; font-size: 12px; white-space: nowrap; }

  /* Content */
  .content { padding: 12px; }

  /* Toolbar */
  .toolbar { flex-direction: column; align-items: stretch; gap: 8px; }
  .search-box { width: 100%; }
  .filter-select { width: 100%; }
  .toolbar > div:first-child { flex-direction: column; }
  .toolbar-right { justify-content: space-between; }

  /* Table */
  .table-wrapper { border-radius: 4px; font-size: 12px; }
  table { font-size: 11px; }
  thead th { padding: 8px 6px; font-size: 10px; }
  td { padding: 8px 6px; }
  .price-cell { font-size: 11px; }
  .category-row td { font-size: 11px; padding: 6px; }

  /* Modal */
  .modal-overlay { padding-top: 20px; padding-left: 8px; padding-right: 8px; }
  .modal { width: 100%; padding: 20px; }

  /* Buttons */
  .btn { padding: 10px 16px; font-size: 13px; }
  .btn-sm { padding: 6px 10px; font-size: 11px; }
  .action-btns { flex-wrap: wrap; }

  /* Quotation */
  .quotation-header-grid, .quotation-header-grid.three-col { grid-template-columns: 1fr; }
  .quotation-grand-total { font-size: 15px; }
  .q-select { max-width: 90px; font-size: 10px; }
  .product-thumb { width: 30px; height: 30px; }

  /* Toast */
  .toast { left: 16px; right: 16px; bottom: 16px; text-align: center; }
}

@media (max-width: 400px) {
  .login-logo-img { width: 140px; }
  .login-box { padding: 24px 16px; }
  .topbar-user { display: none; }
  .tab { padding: 8px 10px; font-size: 11px; }
}
