/* ══════════════════════════════════════════════
   ENOVO GLOBAL Dashboard — main.css
   ══════════════════════════════════════════════ */

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

:root {
  --bg:          #0D0E13;
  --surface:     #16181F;
  --surface2:    #1E2028;
  --surface3:    #12141A;
  --border:      #2A2D3A;
  --border2:     #363A4F;
  --text:        #E8EAF0;
  --muted:       #8890A8;
  --faint:       #4A5068;

  /* Enovo brand */
  --accent:      #21AB71;
  --accent-2:    #14b8a6;
  --accent-glow: #21AB7128;
  --accent-soft: #21AB7110;

  --cyan:        #14b8a6;
  --cyan-glow:   #14b8a618;

  --danger:      #F87166;
  --success:     #34D399;
  --gradient:    linear-gradient(135deg, #21AB71, #14b8a6);

  --sidebar-w:   240px;
  --radius:      12px;
  --radius-sm:   8px;
}

html { font-size: 16px; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  min-height: 100vh;
  display: flex;
}

a { color: inherit; text-decoration: none; }

/* ══════════════════════════════════════════════
   SIDEBAR
   ══════════════════════════════════════════════ */

.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--surface3);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  z-index: 100;
}

.sidebar-top { flex: 1; padding: 0 0 16px; }

.sidebar-brand {
  padding: 24px 20px 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}

/* Brand mark — text-based, replaces logo image */
.brand-mark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.28em;
  color: var(--text);
}

.brand-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent);
  flex-shrink: 0;
}

.nav-label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--faint);
  padding: 0 20px 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  border-radius: 0;
  transition: color 0.15s, background 0.15s;
  margin: 1px 0;
  position: relative;
}

.nav-item svg { width: 16px; height: 16px; flex-shrink: 0; }

.nav-item:hover {
  color: var(--text);
  background: var(--surface2);
}

.nav-item.active {
  color: var(--text);
  background: var(--accent-glow);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--gradient);
  border-radius: 0 2px 2px 0;
}

/* ── Sidebar bottom ── */
.sidebar-bottom {
  padding: 16px 20px 24px;
  border-top: 1px solid var(--border);
}

.session-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
}

.session-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 6px var(--success);
  flex-shrink: 0;
}

.session-dot.warning { background: #FBBF24; box-shadow: 0 0 6px #FBBF24; }
.session-dot.danger  { background: var(--danger); box-shadow: 0 0 6px var(--danger); }

.session-label {
  font-size: 11px;
  color: var(--faint);
  line-height: 1.3;
}

#session-timer {
  font-family: 'DM Mono', monospace;
  color: var(--muted);
  font-size: 11px;
}

.btn-logout {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 9px 14px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  text-align: left;
}

.btn-logout:hover {
  background: #F8716614;
  border-color: var(--danger);
  color: var(--danger);
}

/* ══════════════════════════════════════════════
   MAIN CONTENT
   ══════════════════════════════════════════════ */

.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  padding: 40px 48px;
  max-width: calc(100vw - var(--sidebar-w));
}

/* ── Page header ── */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 32px;
}

.page-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

.page-sub {
  font-size: 13px;
  color: var(--faint);
}

.page-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid #21AB7130;
  padding: 6px 14px;
  border-radius: 20px;
}

.dot-live {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 6px var(--accent);
}

/* ══════════════════════════════════════════════
   FORM CARD
   ══════════════════════════════════════════════ */

.form-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  max-width: 920px;
}

.form-section {
  padding: 28px 32px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

.section-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.section-title svg { flex-shrink: 0; }

/* ── Grid ── */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* ── Fields ── */
.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.field label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.field label.mobile-only { display: none; }

.req { color: var(--accent); }
.opt { font-weight: 400; color: var(--faint); font-style: italic; }

.field input,
.field textarea,
.field select {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  color: var(--text);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  width: 100%;
}

.field input::placeholder,
.field textarea::placeholder { color: var(--faint); }

.field input:focus,
.field textarea:focus,
.field select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.field textarea {
  resize: vertical;
  min-height: 80px;
  line-height: 1.6;
}

.field select {
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238890A8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

/* ══════════════════════════════════════════════
   LINE ITEMS
   ══════════════════════════════════════════════ */

.items-header {
  display: grid;
  grid-template-columns: minmax(0,1fr) 80px 130px 130px 36px;
  gap: 10px;
  padding: 0 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--faint);
}
.items-header .ih-qty,
.items-header .ih-price,
.items-header .ih-total { text-align: right; }

#items-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.item-row {
  display: grid;
  grid-template-columns: minmax(0,1fr) 80px 130px 130px 36px;
  gap: 10px;
  align-items: start;
  padding: 10px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color 0.15s;
}

.item-row:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.item-row .field { gap: 0; }

.item-qty input,
.item-price input {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.line-total {
  padding: 11px 14px;
  font-size: 14px;
  font-weight: 700;
  color: var(--accent);
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-family: 'DM Mono', monospace;
}

.item-action {
  display: flex;
  align-items: center;
  justify-content: center;
  padding-top: 4px;
}

.btn-remove {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--faint);
  cursor: pointer;
  transition: all 0.15s;
}

.btn-remove:hover {
  background: #F8716614;
  border-color: var(--danger);
  color: var(--danger);
}

.btn-remove:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-family: 'DM Sans', sans-serif;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s;
}

.btn-ghost:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

/* ── Totals summary ── */
.totals-summary {
  margin-top: 6px;
  padding: 16px 18px;
  background: var(--surface3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.totals-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
}

.totals-value {
  font-variant-numeric: tabular-nums;
  font-family: 'DM Mono', monospace;
  color: var(--text);
}

.totals-row-grand {
  border-top: 1px solid var(--border);
  padding-top: 10px;
  margin-top: 4px;
  font-size: 16px;
}

.totals-row-grand .totals-label {
  color: var(--text);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 12px;
}

.totals-row-grand .totals-value {
  color: var(--accent);
  font-size: 22px;
  font-weight: 800;
}

/* ── Form footer ── */
.form-footer {
  padding: 20px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: var(--surface3);
  flex-wrap: wrap;
}

.form-hint {
  font-size: 12px;
  color: var(--faint);
}

.form-hint strong { color: var(--muted); }

.form-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

/* ── Buttons ── */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--gradient);
  color: #fff;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  font-weight: 600;
  padding: 12px 26px;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: opacity 0.2s, transform 0.15s;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.btn-primary:hover { opacity: 0.88; transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); opacity: 1; }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn-full { width: 100%; justify-content: center; }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  font-weight: 600;
  padding: 12px 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.btn-secondary:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.btn-secondary:disabled { opacity: 0.5; cursor: not-allowed; }

/* Spinner animation */
@keyframes spin { to { transform: rotate(360deg); } }
.spinning { animation: spin 0.8s linear infinite; }

/* ══════════════════════════════════════════════
   ALERTS
   ══════════════════════════════════════════════ */

.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  margin-bottom: 24px;
  border: 1px solid;
}

.alert-success, .alert.success {
  background: #34D39910;
  border-color: #34D39940;
  color: var(--success);
}

.alert-error, .alert.error {
  background: #F8716610;
  border-color: #F8716640;
  color: var(--danger);
}

.alert-warning {
  background: #FBBF2410;
  border-color: #FBBF2440;
  color: #FBBF24;
}

/* ══════════════════════════════════════════════
   LOGIN PAGE
   ══════════════════════════════════════════════ */

.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 40px 16px;
  background: var(--bg);
  flex-direction: column;
}

.login-glow {
  position: fixed;
  top: -200px; left: 50%;
  transform: translateX(-50%);
  width: 700px; height: 400px;
  background: radial-gradient(ellipse, #21AB711A 0%, transparent 70%);
  pointer-events: none;
}

.login-shell {
  width: 100%;
  max-width: 420px;
  position: relative;
  z-index: 1;
}

.login-brand {
  text-align: center;
  margin-bottom: 28px;
}

.login-brand-mark {
  font-size: 16px;
  letter-spacing: 0.32em;
  justify-content: center;
}

.login-brand-tag {
  margin-top: 8px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.4em;
  color: var(--accent);
  font-style: italic;
}

.accent-top {
  height: 3px;
  background: var(--gradient);
  border-radius: 3px 3px 0 0;
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  overflow: hidden;
}

.login-card-body { padding: 32px; }

.login-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
}

.login-sub {
  font-size: 13px;
  color: var(--faint);
  margin-bottom: 28px;
}

.login-form { display: flex; flex-direction: column; gap: 16px; }

.login-hint {
  font-size: 12px;
  color: var(--faint);
  text-align: center;
  margin-top: 16px;
}

/* ══════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════ */

@media (max-width: 900px) {
  .items-header { display: none; }

  .item-row {
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "desc   desc"
      "qty    price"
      "total  action";
    padding: 14px;
    gap: 12px;
  }

  .item-row .item-desc   { grid-area: desc; }
  .item-row .item-qty    { grid-area: qty; }
  .item-row .item-price  { grid-area: price; }
  .item-row .item-total  { grid-area: total; }
  .item-row .item-action { grid-area: action; justify-content: flex-end; padding-top: 0; }

  .field label.mobile-only { display: block; }
  .item-qty input, .item-price input { text-align: left; }
  .line-total { text-align: left; padding: 0; }
}

@media (max-width: 768px) {
  .sidebar {
    width: 100%;
    min-height: auto;
    position: relative;
    flex-direction: row;
    flex-wrap: wrap;
  }

  .main-content {
    margin-left: 0;
    max-width: 100%;
    padding: 24px 16px;
  }

  .grid-2 { grid-template-columns: 1fr; }

  .form-footer {
    flex-direction: column;
    align-items: stretch;
  }

  .form-actions {
    width: 100%;
    flex-direction: column-reverse;
  }

  .btn-primary, .btn-secondary { justify-content: center; width: 100%; }
}