/* ── Reset & Root ─────────────────────────────────────────── */
* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --orange:      #F07418;
  --orange-dark: #C85A08;
  --orange-pale: #FFF4E8;
  --bg:          #FAF7F3;
  --white:       #fff;
  --border:      #EDE5DA;
  --text:        #1a1a1a;
  --muted:       #888;
}
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', system-ui, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { text-decoration: none; color: inherit; }

/* ── Header ───────────────────────────────────────────────── */
header {
  height: 64px;
  background: var(--white);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  flex-shrink: 0;
  z-index: 10;
}
.logo-area { display: flex; align-items: center; gap: 12px; }
.logo-area img { height: 42px; object-fit: contain; }
.company-name { font-size: 15px; font-weight: 800; }
.company-sub  { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; margin-top: 1px; }
.user-chip {
  display: flex; align-items: center; gap: 9px;
  background: var(--orange-pale); border: 1px solid #F5C080;
  padding: 6px 14px 6px 8px; border-radius: 24px;
}
.avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: linear-gradient(135deg, var(--orange), var(--orange-dark));
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 800; color: white; flex-shrink: 0;
}
.user-name { font-size: 13px; font-weight: 700; display: flex; align-items: center; gap: 6px; }
.user-role { font-size: 11px; color: var(--muted); }
.sa-badge {
  background: linear-gradient(135deg, #C85A08, #F07418);
  color: white; font-size: 10px; font-weight: 800;
  padding: 2px 8px; border-radius: 20px; letter-spacing: 0.3px;
}

/* ── Layout ───────────────────────────────────────────────── */
.layout { display: flex; flex: 1; overflow: hidden; }

/* ── Sidebar ──────────────────────────────────────────────── */
.sidebar {
  width: 220px; background: var(--white);
  border-right: 1px solid var(--border);
  padding: 20px 12px;
  display: flex; flex-direction: column; flex-shrink: 0;
}
.nav-lbl {
  font-size: 10px; font-weight: 700; color: #C0A890;
  text-transform: uppercase; letter-spacing: 1.5px;
  padding: 0 10px; margin: 4px 0 8px;
}
.nav-item {
  display: flex; align-items: center;
  padding: 10px 12px; border-radius: 10px;
  font-size: 14px; color: var(--muted);
  cursor: pointer; margin-bottom: 2px;
  transition: all 0.15s;
}
.nav-item:hover:not(.active):not(.admin-active) { background: #FDF5EE; color: var(--orange-dark); }
.nav-item.active { background: var(--orange-pale); color: var(--orange); font-weight: 700; border-left: 3px solid var(--orange); }
.nav-item.admin-active { background: linear-gradient(90deg,#FFF4E8,#FDECD8); color: var(--orange-dark); font-weight: 700; border-left: 3px solid var(--orange-dark); }
.nav-div { height: 1px; background: var(--border); margin: 14px 0; }
.sidebar-bottom { margin-top: auto; }

/* ── Content area ─────────────────────────────────────────── */
.content { flex: 1; padding: 24px 28px; overflow-y: auto; }
.page-hdr { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 20px; }
.page-title { font-size: 20px; font-weight: 800; }
.page-sub   { font-size: 13px; color: var(--muted); margin-top: 3px; }

/* ── Flash messages ───────────────────────────────────────── */
.flash-container { padding: 0 28px; margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.flash {
  padding: 12px 16px; border-radius: 10px; font-size: 13px; font-weight: 600;
  display: flex; align-items: center; gap: 10px;
}
.flash-success { background: #E8F5E9; color: #1b5e20; border: 1px solid #A5D6A7; }
.flash-error   { background: #FFEBEE; color: #b71c1c; border: 1px solid #EF9A9A; }
.flash-warning { background: #FFF8E1; color: #E65100; border: 1px solid #FFE082; }
.flash-info    { background: #E3F2FD; color: #0d47a1; border: 1px solid #90CAF9; }

/* ── Buttons ──────────────────────────────────────────────── */
.btn-primary {
  padding: 13px 24px; background: linear-gradient(135deg, #F07418, #C85A08);
  color: white; border: none; border-radius: 10px;
  font-size: 15px; font-weight: 700; cursor: pointer;
  box-shadow: 0 4px 16px rgba(240,116,24,0.35);
  transition: all 0.2s; font-family: inherit; width: 100%;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(240,116,24,0.45); }
.btn-sm {
  padding: 6px 14px; background: var(--bg); border: 1px solid var(--border);
  color: var(--muted); border-radius: 7px; font-size: 12px;
  cursor: pointer; font-family: inherit; transition: all 0.15s;
}
.btn-sm:hover { border-color: var(--orange); color: var(--orange); }
.btn-action {
  display: flex; align-items: center; gap: 6px;
  background: var(--white); border: 1px solid var(--border);
  color: var(--muted); padding: 8px 16px; border-radius: 9px;
  font-size: 13px; cursor: pointer; font-family: inherit; transition: all 0.15s;
}
.btn-action:hover { border-color: var(--orange); color: var(--orange); }
.btn-gold { background: var(--orange); color: white; border-color: var(--orange); font-weight: 600; }

/* ── Cards / Sections ─────────────────────────────────────── */
.section {
  background: var(--white); border: 1px solid var(--border);
  border-radius: 14px; margin-bottom: 20px; overflow: hidden;
  box-shadow: 0 2px 10px rgba(0,0,0,0.04);
}
.section-hdr {
  padding: 16px 20px; border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
}
.section-title { font-size: 15px; font-weight: 700; }
.section-sub   { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ── Tables ───────────────────────────────────────────────── */
table { width: 100%; border-collapse: collapse; }
th {
  padding: 11px 16px; font-size: 11px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.7px; text-align: left;
  background: #FDF8F4; border-bottom: 1px solid var(--border); white-space: nowrap;
}
td { padding: 13px 16px; font-size: 13px; border-bottom: 1px solid #F5EFE8; vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #FDF8F3; }

/* ── Badges ───────────────────────────────────────────────── */
.role-badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 700; }
.role-sa       { background: linear-gradient(135deg,#FFF4E8,#FDECD8); color: #C85A08; border: 1px solid #F5C080; }
.role-admin    { background: #EEF4FF; color: #0984e3; }
.role-planta   { background: #E8F5E9; color: #2e7d32; }
.role-comercial{ background: #F3F0FF; color: #6c5ce7; }

.status-badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 20px; font-size: 11px; font-weight: 700; }
.s-active   { background: #E8F5E9; color: #2e7d32; }
.s-inactive { background: #F0EDE8; color: #B0A090; }
.s-pending  { background: #FFF3E0; color: #E65100; }
.sdot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }

.tok-used    { background: #EEF4FF; color: #0984e3; display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 11px; font-weight: 700; }
.tok-review  { background: #FFF3E0; color: #E65100; display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 11px; font-weight: 700; }
.tok-avail   { background: #E8F5E9; color: #2e7d32; display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 11px; font-weight: 700; }
.token-code  { font-family: monospace; font-size: 12px; font-weight: 700; background: #F0EDE8; padding: 3px 9px; border-radius: 5px; color: #444; }

.act-btn { padding: 4px 11px; border-radius: 6px; font-size: 11px; font-weight: 600; cursor: pointer; border: 1px solid var(--border); background: var(--white); color: var(--muted); font-family: inherit; transition: all 0.15s; white-space: nowrap; }
.act-btn:hover        { border-color: var(--orange); color: var(--orange); }
.act-btn.danger:hover { border-color: #c62828; color: #c62828; }
.action-row { display: flex; gap: 6px; flex-wrap: wrap; }

/* ── Move badges (historial) ──────────────────────────────── */
.move-badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 6px; font-size: 12px; font-weight: 600; }
.move-carga    { background: #E8F5E9; color: #2e7d32; }
.move-descarga { background: #FFEBEE; color: #c62828; }
.move-cambio   { background: #EEF4FF; color: #0984e3; }
.tank-tag  { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 11px; font-weight: 800; background: var(--orange-pale); color: var(--orange); }
.prod-tag  { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 11px; font-weight: 700; }
.up   { color: #2e7d32; font-weight: 700; }
.down { color: #c62828; font-weight: 700; }

/* ── Two-panel auth pages ─────────────────────────────────── */
.auth-body {
  min-height: 100vh; display: flex; flex-direction: row;
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: #FAF7F3;
}
.auth-left {
  width: 42%; min-height: 100vh;
  background: linear-gradient(160deg, #C85A08 0%, #E8700A 40%, #F5900C 75%, #FFA030 100%);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 60px 48px; position: relative; overflow: hidden;
}
.auth-left::before { content:''; position:absolute; width:500px; height:500px; border-radius:50%; border:1px solid rgba(255,255,255,0.15); top:-150px; right:-150px; }
.auth-left::after  { content:''; position:absolute; width:350px; height:350px; border-radius:50%; border:1px solid rgba(255,255,255,0.1); bottom:-100px; left:-80px; }
.brand-logo     { width:150px; height:150px; object-fit:contain; margin-bottom:28px; filter:drop-shadow(0 8px 24px rgba(0,0,0,0.2)); }
.brand-divider  { width:50px; height:2px; background:linear-gradient(90deg,transparent,rgba(255,255,255,0.7),transparent); margin:24px auto; }
.brand-tagline  { font-size:13px; color:rgba(255,255,255,0.65); text-align:center; line-height:1.7; }
.auth-right     { flex:1; background:#FAF7F3; display:flex; align-items:center; justify-content:center; padding:60px 40px; }
.auth-box       { width:100%; max-width:420px; }
.auth-title     { font-size:24px; font-weight:700; color:#1a1a1a; margin-bottom:4px; }
.auth-sub       { font-size:14px; color:#888; margin-bottom:28px; }

/* ── Form elements ────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }
.form-group label { display:block; font-size:11px; font-weight:700; color:#555; text-transform:uppercase; letter-spacing:0.8px; margin-bottom:7px; }
.form-group input, .form-group select {
  width:100%; padding:13px 16px; background:#fff;
  border:1.5px solid #E0E0E0; border-radius:10px;
  font-size:15px; color:#1a1a1a; outline:none;
  transition:border-color 0.2s, box-shadow 0.2s; font-family:inherit;
}
.form-group input:focus, .form-group select:focus { border-color:#F07418; box-shadow:0 0 0 3px rgba(240,116,24,0.12); }
.form-group input::placeholder { color:#bbb; }

/* ── Password toggle ─────────────────────────────────────── */
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 42px; }
.pw-eye {
  position: absolute; right: 13px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer; padding: 0;
  color: #B0A090; display: flex; align-items: center; transition: color 0.15s;
}
.pw-eye:hover { color: var(--orange); }

/* ── Steps (register) ─────────────────────────────────────── */
.steps { display:flex; flex-direction:column; gap:14px; width:100%; max-width:240px; }
.step  { display:flex; align-items:center; gap:12px; }
.step-num { width:28px; height:28px; border-radius:50%; background:rgba(255,255,255,0.2); border:1px solid rgba(255,255,255,0.4); display:flex; align-items:center; justify-content:center; font-size:12px; font-weight:700; color:white; flex-shrink:0; }
.step-num.done    { background:rgba(255,255,255,0.9); color:#C85A08; border-color:white; }
.step-num.current { background:white; color:#C85A08; border-color:white; }
.step-text { font-size:13px; color:rgba(255,255,255,0.6); }
.step-text.active { color:white; font-weight:600; }

/* ── Hamburger (hidden on desktop) ───────────────────────── */
.hamburger {
  display: none; align-items: center; justify-content: center;
  width: 38px; height: 38px; border: none; background: none;
  cursor: pointer; color: var(--text); border-radius: 8px; flex-shrink: 0;
  transition: background 0.15s;
}
.hamburger:hover { background: var(--bg); }

/* Sidebar overlay (hidden on desktop) */
.sidebar-overlay {
  display: none; position: fixed;
  top: 64px; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.3); z-index: 199;
}
.sidebar-overlay.visible { display: block; }

/* ── Mobile (≤ 768px) ─────────────────────────────────────── */
@media (max-width: 768px) {

  /* Header */
  header { padding: 0 14px; gap: 10px; }
  .company-sub { display: none; }
  .user-role { display: none; }
  .user-chip { padding: 6px 10px 6px 8px; }
  .hamburger { display: flex; }

  /* Sidebar — off-canvas */
  .sidebar {
    position: fixed;
    left: -240px; top: 64px;
    height: calc(100vh - 64px);
    width: 220px; z-index: 200;
    transition: left 0.25s ease;
    box-shadow: none;
  }
  .sidebar.open {
    left: 0;
    box-shadow: 4px 0 24px rgba(0,0,0,0.15);
  }

  /* Content */
  .content { padding: 14px; }
  .flash-container { padding: 0 14px; }

  /* Page header */
  .page-hdr { flex-wrap: wrap; gap: 10px; }

  /* Tables — horizontal scroll */
  .tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table { min-width: 560px; }

  /* Auth pages — hide left panel */
  .auth-body { flex-direction: column; }
  .auth-left { display: none; }
  .auth-right { padding: 40px 24px; min-height: 100vh; }
  .auth-box { max-width: 100%; }
}
