/*
  Paleta y componentes tomados directamente de compliance_entregas
  (el panel de entregas Multimat) para que este sistema se vea idéntico:
  verde de marca #1b5e20, naranja #ea580c, tarjetas blancas, pills,
  sidebar verde con nav-section-label, login split-screen con anillos.
*/

:root {
  /* Marca */
  --brand-green: #1b5e20;
  --brand-green-dark: #143f17;
  --brand-green-active-row: #46631f;
  --brand-orange: #ea580c;
  --brand-orange-dark: #c2410c;

  /* Superficie */
  --bg-app: #f0f2f4;
  --bg-card: #ffffff;
  --bg-sidebar: #1b5e20;
  --line: #e5e7eb;
  --text-main: #1f2937;
  --text-muted: #6b7280;
  --text-faint: #9ca3af;

  /* Pills */
  --pill-gray-bg: #f3f4f6;
  --pill-gray-text: #4b5563;
  --pill-orange-bg: #fff3e0;
  --pill-orange-text: #b45309;
  --pill-green-bg: #dcfce7;
  --pill-green-text: #166534;
  --pill-green-dot: #16a34a;
  --pill-red-bg: #fee2e2;
  --pill-red-text: #b91c1c;

  --radius: 8px;
  --radius-sm: 6px;
  --shadow-card: 0 1px 2px rgba(16, 24, 40, 0.04), 0 1px 3px rgba(16, 24, 40, 0.04);

  --font-body: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-display: "Space Grotesk", var(--font-body);
  --font-mono: "IBM Plex Mono", monospace;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }

body {
  margin: 0;
  background: var(--bg-app);
  color: var(--text-main);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }
button, input, select, textarea { font-family: inherit; }
:focus-visible { outline: 2px solid var(--brand-orange); outline-offset: 2px; }

/* ─── Layout raíz ─────────────────────────────────────────────────────── */

.app-shell { display: grid; grid-template-columns: 235px 1fr; min-height: 100vh; }

.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 999; }

/* ─── Sidebar ─────────────────────────────────────────────────────────── */

.sidebar {
  background: var(--bg-sidebar);
  color: #eaf3ea;
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: sticky;
  top: 0;
  align-self: start;
  overflow-y: auto;
}

.sidebar-brand { padding: 20px 22px; }
.sidebar-brand .logo { font-size: 19px; font-weight: 800; color: #fff; letter-spacing: -0.01em; font-family: var(--font-display); }
.sidebar-brand .logo em { font-style: normal; color: var(--brand-orange); }
.sidebar-brand .tag { display: block; font-size: 10px; letter-spacing: 0.12em; color: #9fc79f; font-weight: 600; margin-top: 1px; }

.sidebar-nav { padding: 6px 12px; display: flex; flex-direction: column; gap: 2px; margin-top: 6px; }
.nav-section-label {
  letter-spacing: 0.08em; text-transform: uppercase; color: #7fa07f;
  padding: 14px 12px 6px; font-size: 10px; font-weight: 700;
}
.sidebar-nav .nav-section-label:first-child { padding-top: 4px; }

.sidebar-nav .item {
  display: flex; align-items: center; gap: 11px; padding: 10px 12px;
  border-radius: var(--radius-sm); font-size: 13.5px; font-weight: 500;
  color: #cfe4cf; text-decoration: none;
}
.sidebar-nav .item svg { width: 17px; height: 17px; flex-shrink: 0; }
.sidebar-nav .item:hover { background: rgba(255,255,255,0.06); color: #fff; text-decoration: none; }
.sidebar-nav .item.active { background: var(--brand-green-active-row); color: var(--brand-orange); font-weight: 600; }

.sidebar-foot { margin-top: auto; padding: 16px 18px 20px; border-top: 1px solid rgba(255,255,255,0.12); }
.sidebar-user { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.sidebar-user .avatar {
  width: 34px; height: 34px; border-radius: 50%; background: var(--brand-orange); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; flex-shrink: 0;
}
.sidebar-user .name { font-size: 13px; font-weight: 600; color: #fff; }
.sidebar-user .role {
  display: inline-block; margin-top: 2px; font-size: 9.5px; font-weight: 700; letter-spacing: 0.05em;
  padding: 1px 7px; border-radius: 999px; background: rgba(255,255,255,0.14); color: #d7ecd7;
}
.sidebar-logout {
  display: flex; align-items: center; gap: 9px; width: 100%; background: transparent; border: none;
  color: #cfe4cf; font-size: 12.5px; padding: 8px 2px; cursor: pointer; text-align: left;
}
.sidebar-logout svg { width: 15px; height: 15px; }
.sidebar-logout:hover { color: #fff; }

/* ─── Contenido principal ────────────────────────────────────────────── */

.main { padding: 26px 32px 60px; max-width: 1440px; width: 100%; margin: 0 auto; }

.page-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 20px; gap: 16px; flex-wrap: wrap; }
.page-head h1 { font-size: 21px; font-weight: 700; margin: 0; color: var(--text-main); font-family: var(--font-display); }
.page-head .today { color: var(--text-faint); font-size: 13px; padding-top: 3px; text-transform: uppercase; }
.mobile-topbar-toggle {
  display: none; background: none; border: none; font-size: 1.3rem; color: var(--text-main);
  margin-right: 8px; cursor: pointer; align-items: center;
}

/* ─── Tarjetas / stats ────────────────────────────────────────────────── */

.card { background: var(--bg-card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-card); }
.card-header { background: #f9fafb; font-weight: 600; border-bottom: 1px solid var(--line); border-radius: var(--radius) var(--radius) 0 0 !important; font-size: 13.5px; }

.stat-tile { background: var(--bg-card); border: 1px solid var(--line); border-radius: var(--radius); padding: 15px 17px; box-shadow: var(--shadow-card); }
.stat-tile .label { font-size: 11.5px; color: var(--text-muted); font-weight: 600; }
.stat-tile .value { font-size: 26px; font-weight: 700; margin-top: 5px; color: var(--text-main); font-family: var(--font-display); }
.stat-tile.orange .value { color: var(--brand-orange); }
.stat-tile.green .value { color: var(--brand-green); }

/* ─── Botones ─────────────────────────────────────────────────────────── */

.btn-primary, .btn-dark {
  background: var(--brand-orange); border-color: var(--brand-orange); color: #fff;
  border-radius: var(--radius-sm); font-weight: 600;
}
.btn-primary:hover, .btn-dark:hover, .btn-primary:focus, .btn-dark:focus {
  background: var(--brand-orange-dark); border-color: var(--brand-orange-dark); color: #fff;
}
.btn-outline-primary { color: var(--brand-orange); border-color: var(--brand-orange); border-radius: var(--radius-sm); }
.btn-outline-primary:hover { background: var(--brand-orange); color: #fff; }
.btn-outline-dark { color: var(--brand-green); border-color: var(--brand-green); border-radius: var(--radius-sm); }
.btn-outline-dark:hover { background: var(--brand-green); color: #fff; }
.btn-outline-secondary { border-radius: var(--radius-sm); }
.btn { font-size: 13.5px; }

/* ─── Formularios ─────────────────────────────────────────────────────── */

.form-control, .form-select { border-color: var(--line); border-radius: var(--radius-sm); font-size: 13.5px; color: var(--text-main); }
.form-control:focus, .form-select:focus { border-color: var(--brand-orange); box-shadow: 0 0 0 0.2rem rgba(234,88,12,0.15); }
label, .form-label { font-size: 11px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-muted); }

/* ─── Tablas (estilo data-row) ────────────────────────────────────────── */

table thead th {
  text-transform: uppercase; font-size: 10.5px; letter-spacing: 0.05em;
  color: var(--text-faint); background: #f9fafb; border-bottom: 1px solid var(--line) !important; font-weight: 700;
}
table tbody td { font-size: 13.5px; color: var(--text-main); }
.table>:not(caption)>*>* { border-bottom-color: var(--line); }
.table-hover>tbody>tr:hover>* { background: #f9fafb; }

/* ─── Pills (roles / estados) ─────────────────────────────────────────── */

.pill, .badge {
  display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 700;
  padding: 4px 10px; border-radius: 999px; text-transform: uppercase; letter-spacing: 0.03em; white-space: nowrap;
}
.badge.bg-secondary, .pill.gray { background: var(--pill-gray-bg) !important; color: var(--pill-gray-text) !important; }
.pill.orange { background: var(--pill-orange-bg); color: var(--pill-orange-text); }
.pill.green, .pill-activo { background: var(--pill-green-bg); color: var(--pill-green-text); }
.pill.red, .badge-bloqueado { background: var(--pill-red-bg) !important; color: var(--pill-red-text) !important; }
.pill .dot, .pill-activo::before { width: 5px; height: 5px; border-radius: 50%; background: currentColor; content: ""; }

/* ─── Alertas ─────────────────────────────────────────────────────────── */

.alert-success { background: var(--pill-green-bg); color: var(--pill-green-text); border-color: transparent; border-radius: var(--radius); }
.alert-info { background: #eaf1f7; color: #1c4a63; border-color: transparent; border-radius: var(--radius); }
.alert-danger { background: var(--pill-red-bg); color: var(--pill-red-text); border-color: transparent; border-radius: var(--radius); }

/* ─── Kanban ──────────────────────────────────────────────────────────── */

.kanban-col { min-width: 260px; }
.kanban-scroll { overflow-x: auto; padding-bottom: 1rem; }
.folio-card { cursor: pointer; transition: box-shadow 0.15s ease-in-out; border-color: var(--line) !important; }
.folio-card:hover { box-shadow: var(--shadow-card); border-color: var(--brand-green) !important; }

@media (max-width: 900px) { .kanban-col { min-width: 85vw; } }

/* ─── Página de login (idéntica a compliance_entregas) ───────────────── */

.login-screen { min-height: 100vh; display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); }
@media (max-width: 860px) { .login-screen { grid-template-columns: 1fr; } .login-hero { display: none; } }

.login-hero {
  position: relative; background: var(--brand-green); overflow: hidden;
  display: flex; flex-direction: column; justify-content: space-between; padding: 48px;
}
.login-hero::before {
  content: ""; position: absolute; inset: 0;
  background-image: radial-gradient(rgba(255,255,255,0.14) 1.4px, transparent 1.4px);
  background-size: 18px 18px;
  -webkit-mask-image: linear-gradient(to bottom, transparent, black 40%, black 70%, transparent);
  mask-image: linear-gradient(to bottom, transparent, black 40%, black 70%, transparent);
}
.login-hero .ring { position: absolute; border-radius: 50%; border: 2px solid rgba(255,255,255,0.12); }
.login-hero .ring--1 { width: 340px; height: 340px; top: -120px; left: -80px; }
.login-hero .ring--2 { width: 520px; height: 520px; bottom: -260px; right: -180px; border-color: rgba(255,255,255,0.09); }
.login-hero .ring--3 { width: 220px; height: 220px; bottom: 60px; right: 120px; border-color: rgba(234,88,12,0.35); }

.login-hero .dots-mark { position: relative; display: grid; grid-template-columns: repeat(4, 6px); gap: 6px; z-index: 1; }
.login-hero .dots-mark span { width: 6px; height: 6px; border-radius: 50%; background: rgba(255,255,255,0.35); }

.login-hero .hero-content { position: relative; z-index: 1; }
.login-hero .rule { width: 46px; height: 3px; background: var(--brand-orange); border-radius: 2px; margin-bottom: 18px; }
.login-hero h1 { font-family: var(--font-display); color: #fff; font-size: 34px; font-weight: 700; line-height: 1.15; margin: 0; }
.login-hero h1 em { display: block; font-style: normal; color: var(--brand-orange); }
.login-hero p { color: #cfe4cf; font-size: 14.5px; line-height: 1.6; max-width: 320px; margin-top: 16px; }

.login-panel { position: relative; display: flex; align-items: center; justify-content: center; padding: 24px; background: var(--bg-app); overflow: hidden; }
.login-panel::before {
  content: ""; position: absolute; inset: 0;
  background-image: radial-gradient(rgba(18,23,43,0.08) 1.2px, transparent 1.2px); background-size: 20px 20px;
}

.login-card {
  position: relative; z-index: 1; width: 100%; max-width: 380px; background: var(--bg-card);
  border-radius: var(--radius); padding: 34px 32px; box-shadow: 0 24px 60px rgba(16,24,40,0.12);
}
.login-card .eyebrow { font-size: 11px; font-weight: 700; letter-spacing: 0.12em; color: var(--brand-orange); text-transform: uppercase; }
.login-card h1 { font-family: var(--font-display); font-size: 25px; font-weight: 700; margin: 4px 0 3px; color: var(--text-main); }
.login-card .sub { color: var(--text-muted); font-size: 13px; }
.login-card .rule { width: 40px; height: 3px; background: var(--brand-green); border-radius: 2px; margin: 16px 0 22px; }
.login-card label { display: block; font-size: 11px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 6px; }
.login-card .field { margin-bottom: 16px; }
.login-card input {
  width: 100%; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 11px 12px;
  font-size: 14px; background: var(--bg-card); color: var(--text-main);
}
.login-card .password-field { position: relative; }
.login-card .password-field input { padding-right: 40px; }
.login-card .toggle-password {
  position: absolute; right: 4px; top: 4px; bottom: 4px; width: 32px; background: transparent; border: none;
  color: var(--text-faint); display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.login-card .toggle-password:hover { color: var(--text-muted); }
.login-card .error { background: var(--pill-red-bg); color: var(--pill-red-text); border-radius: var(--radius-sm); padding: 9px 11px; font-size: 13px; margin-bottom: 16px; }
.login-card button[type="submit"] {
  width: 100%; background: var(--brand-orange); color: #fff; border: none; border-radius: var(--radius-sm);
  padding: 12px; font-size: 14px; font-weight: 700; cursor: pointer; margin-top: 4px;
}
.login-card button[type="submit"]:hover { background: var(--brand-orange-dark); }
.login-card .footnote { text-align: center; color: var(--text-faint); margin-top: 22px; font-size: 11.5px; }
.login-card .footnote b { color: var(--text-muted); }

/* ─── Responsivo móvil (al final para que gane en la cascada) ─────────── */

@media (max-width: 860px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed !important; left: -260px; top: 0; height: 100vh;
    width: 235px; z-index: 1000; transition: left 0.2s ease;
  }
  .app-shell.sidebar-open .sidebar { left: 0; box-shadow: 0 0 30px rgba(0,0,0,0.3); }
  .app-shell.sidebar-open .mobile-topbar-toggle { display: none !important; }
  .mobile-topbar-toggle {
    display: inline-flex !important;
    position: fixed;
    top: 14px;
    left: 14px;
    z-index: 1001;
    width: 40px;
    height: 40px;
    background: var(--bg-card);
    border: 1px solid var(--line);
    border-radius: 999px;
    box-shadow: var(--shadow-card);
    align-items: center;
    justify-content: center;
    margin-right: 0;
  }
  .page-head { padding-left: 54px; }
  .app-shell.sidebar-open .sidebar-overlay { display: block; }
}
