/* =========================================================
   CHOPIN OS — Design System
   ========================================================= */

:root {
  --ch-sidebar-w: 240px;
  --ch-navy:      #0f172a;
  --ch-navy-2:    #1e293b;
  --ch-navy-3:    #334155;
  --ch-accent:    #6366f1;
  --ch-accent-h:  #4f46e5;
  --ch-success:   #22c55e;
  --ch-warning:   #f59e0b;
  --ch-danger:    #ef4444;
  --ch-info:      #38bdf8;
  --ch-bg:        #f1f5f9;
  --ch-card:      #ffffff;
  --ch-border:    #e2e8f0;
  --ch-text:      #1e293b;
  --ch-muted:     #64748b;
  --ch-radius:    10px;
  --ch-shadow:    0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
  --ch-shadow-md: 0 4px 6px -1px rgba(0,0,0,.1), 0 2px 4px -1px rgba(0,0,0,.06);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--ch-bg);
  color: var(--ch-text);
  font-size: 14px;
}

/* ---- Layout ---- */

.ch-layout {
  display: flex;
  min-height: 100vh;
}

/* ---- Sidebar ---- */

.ch-sidebar {
  width: var(--ch-sidebar-w);
  min-height: 100vh;
  background: var(--ch-navy);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  overflow-y: auto;
  z-index: 100;
}

.ch-sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 16px 16px;
  border-bottom: 1px solid var(--ch-navy-3);
  margin-bottom: 8px;
}

.ch-brand-icon {
  font-size: 24px;
  color: var(--ch-accent);
  line-height: 1;
}

.ch-brand-name {
  font-size: 15px;
  font-weight: 700;
  color: #f1f5f9;
  letter-spacing: .5px;
}

.ch-brand-store {
  font-size: 10px;
  color: var(--ch-muted);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-top: 1px;
}

.ch-sidebar-section {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1px;
  color: var(--ch-muted);
  text-transform: uppercase;
  padding: 12px 16px 4px;
}

.ch-nav-link {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 16px;
  color: #94a3b8;
  text-decoration: none;
  border-radius: 6px;
  margin: 1px 8px;
  font-size: 13.5px;
  transition: background .15s, color .15s;
}

.ch-nav-link:hover {
  background: var(--ch-navy-2);
  color: #f1f5f9;
}

.ch-nav-link.active {
  background: var(--ch-accent);
  color: #ffffff;
  font-weight: 600;
}

.ch-nav-link i { font-size: 15px; }

.ch-sidebar-footer {
  margin-top: auto;
  padding: 12px 16px;
  border-top: 1px solid var(--ch-navy-3);
  display: flex;
  align-items: center;
  gap: 10px;
}

.ch-user-name {
  font-size: 13px;
  font-weight: 600;
  color: #f1f5f9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ch-user-role {
  font-size: 11px;
  color: var(--ch-muted);
}

.ch-user-info { flex: 1; min-width: 0; }

.ch-logout-btn {
  color: var(--ch-muted);
  font-size: 18px;
  text-decoration: none;
  flex-shrink: 0;
  transition: color .15s;
}
.ch-logout-btn:hover { color: var(--ch-danger); }

/* ---- Main area ---- */

.ch-main {
  margin-left: var(--ch-sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.ch-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 28px 0;
}

.ch-page-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--ch-text);
  margin: 0;
}

.ch-topbar-actions { display: flex; gap: 8px; }

.ch-alerts { padding: 12px 28px 0; }

.ch-content { padding: 20px 28px 40px; }

/* ---- Cards ---- */

.ch-card {
  background: var(--ch-card);
  border-radius: var(--ch-radius);
  box-shadow: var(--ch-shadow);
  padding: 20px;
  border: 1px solid var(--ch-border);
}

.ch-card-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--ch-muted);
  margin-bottom: 6px;
}

.ch-stat {
  font-size: 28px;
  font-weight: 700;
  color: var(--ch-text);
  line-height: 1.1;
}

.ch-stat-sub {
  font-size: 12px;
  color: var(--ch-muted);
  margin-top: 2px;
}

/* ---- Stat grid ---- */

.ch-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

/* ---- Tables ---- */

.ch-table-wrap {
  background: var(--ch-card);
  border-radius: var(--ch-radius);
  box-shadow: var(--ch-shadow);
  border: 1px solid var(--ch-border);
  overflow: hidden;
}

.ch-table-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--ch-border);
}

.ch-table-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ch-text);
}

.ch-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.ch-table thead th {
  padding: 10px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--ch-muted);
  background: #f8fafc;
  border-bottom: 1px solid var(--ch-border);
}

.ch-table tbody td {
  padding: 11px 16px;
  border-bottom: 1px solid var(--ch-border);
  vertical-align: middle;
}

.ch-table tbody tr:last-child td { border-bottom: none; }

.ch-table tbody tr:hover { background: #f8fafc; }

/* ---- Badges de estado ---- */

.ch-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.ch-badge-secondary { background: #f1f5f9; color: #475569; }
.ch-badge-warning   { background: #fef9c3; color: #854d0e; }
.ch-badge-info      { background: #e0f2fe; color: #075985; }
.ch-badge-primary   { background: #ede9fe; color: #4338ca; }
.ch-badge-success   { background: #dcfce7; color: #166534; }
.ch-badge-danger    { background: #fee2e2; color: #991b1b; }

/* ---- Buttons ---- */

.ch-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 7px;
  font-size: 13.5px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: opacity .15s, transform .1s;
  white-space: nowrap;
}

.ch-btn:hover { opacity: .88; }
.ch-btn:active { transform: scale(.97); }

.ch-btn-primary  { background: var(--ch-accent);  color: #fff; }
.ch-btn-success  { background: var(--ch-success);  color: #fff; }
.ch-btn-warning  { background: var(--ch-warning);  color: #fff; }
.ch-btn-danger   { background: var(--ch-danger);   color: #fff; }
.ch-btn-ghost    { background: transparent; color: var(--ch-muted); border: 1px solid var(--ch-border); }
.ch-btn-sm       { padding: 4px 10px; font-size: 12px; border-radius: 5px; }

/* ---- Forms ---- */

.ch-form-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ch-text);
  margin-bottom: 4px;
  display: block;
}

.ch-form-control {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--ch-border);
  border-radius: 7px;
  font-size: 13.5px;
  color: var(--ch-text);
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
  outline: none;
}

.ch-form-control:focus {
  border-color: var(--ch-accent);
  box-shadow: 0 0 0 3px rgba(99,102,241,.12);
}

select.ch-form-control { cursor: pointer; }

.ch-form-group { margin-bottom: 14px; }

.ch-form-row {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
}

/* ---- Login page ---- */

.ch-login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--ch-navy);
}

.ch-login-box {
  background: var(--ch-card);
  border-radius: 14px;
  padding: 40px 36px;
  width: 100%;
  max-width: 380px;
  box-shadow: var(--ch-shadow-md);
}

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

.ch-login-logo .ch-brand-icon { font-size: 36px; display: block; margin-bottom: 6px; }
.ch-login-logo .ch-brand-name { font-size: 22px; color: var(--ch-text); font-weight: 800; }
.ch-login-logo .ch-brand-store { font-size: 12px; }

/* ---- Status colors for preparation ---- */

.ch-prep-card {
  background: var(--ch-card);
  border: 1px solid var(--ch-border);
  border-radius: var(--ch-radius);
  padding: 16px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.ch-prep-card.done { opacity: .55; }

.ch-check-big {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--ch-border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
  transition: all .15s;
}

.ch-check-big.checked {
  background: var(--ch-success);
  border-color: var(--ch-success);
  color: white;
}

/* ---- Low stock indicator ---- */

.ch-stock-low { color: var(--ch-danger); font-weight: 600; }
.ch-stock-ok  { color: var(--ch-success); }
.ch-stock-mid { color: var(--ch-warning); }

/* ---- Sidebar badges ---- */

.ch-nav-badge {
  margin-left: auto;
  background: var(--ch-navy-3);
  color: #cbd5e1;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 999px;
  min-width: 18px;
  text-align: center;
}

.ch-nav-badge-warn {
  background: var(--ch-warning);
  color: #1a1f2e;
}

.ch-nav-link.active .ch-nav-badge {
  background: rgba(255,255,255,.25);
  color: #fff;
}

/* ---- Quick status filters ---- */

.ch-quick-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.ch-qf {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ch-muted);
  background: var(--ch-card);
  border: 1px solid var(--ch-border);
  text-decoration: none;
  transition: all .15s;
  white-space: nowrap;
}

.ch-qf:hover { border-color: var(--ch-accent); color: var(--ch-accent); }
.ch-qf.active { background: var(--ch-accent); color: #fff; border-color: var(--ch-accent); }
.ch-qf.ch-qf-warning.active  { background: #f59e0b; border-color: #f59e0b; }
.ch-qf.ch-qf-info.active     { background: #38bdf8; border-color: #38bdf8; color: #0f172a; }
.ch-qf.ch-qf-primary.active  { background: #6366f1; border-color: #6366f1; }
.ch-qf.ch-qf-success.active  { background: #22c55e; border-color: #22c55e; }
.ch-qf.ch-qf-danger.active   { background: #ef4444; border-color: #ef4444; }
.ch-qf.ch-qf-secondary.active { background: #64748b; border-color: #64748b; }

.ch-qf-count {
  background: rgba(0,0,0,.12);
  border-radius: 999px;
  padding: 0 5px;
  font-size: 11px;
  font-weight: 700;
}
.ch-qf.active .ch-qf-count { background: rgba(255,255,255,.25); }

/* ---- Utilities ---- */

.ch-empty {
  text-align: center;
  padding: 48px 20px;
  color: var(--ch-muted);
}

.ch-empty i { font-size: 40px; display: block; margin-bottom: 10px; opacity: .4; }

.text-muted-sm { font-size: 12px; color: var(--ch-muted); }
