/* ═══════════════════════════════════════════ css/layout.css */

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

/* ─── Topbar ─────────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 100;
  height: var(--topbar-h);
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-border);
  display: flex; align-items: center;
  padding: 0 24px; gap: 16px;
}
.btn-sidebar-toggle {
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: var(--radius-sm);
  color: var(--c-text-2);
  transition: background var(--transition);
}
.btn-sidebar-toggle:hover { background: var(--c-bg); }
.topbar-breadcrumb {
  font-size: .95rem; font-weight: 600; color: var(--c-text);
}
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.topbar-badge {
  background: var(--c-primary-l); color: var(--c-primary);
  font-size: .75rem; font-weight: 600;
  padding: 4px 12px; border-radius: 99px;
}

/* ─── Page Content ───────────────────────────────────────── */
.page-content {
  flex: 1;
  padding: 28px 32px;
  max-width: 1680px;
  width: 100%;
}

/* ─── Page Header ────────────────────────────────────────── */
.page-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 24px; gap: 16px;
}
.page-header-left h1 {
  font-size: 1.4rem; font-weight: 700; color: var(--c-text);
}
.page-header-left p {
  color: var(--c-text-2); margin-top: 2px; font-size: .875rem;
}

/* ─── Cards ──────────────────────────────────────────────── */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}
.card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}
.card-stat {
  display: flex; align-items: flex-start; justify-content: space-between;
}
.card-stat-value {
  font-size: 2rem; font-weight: 700; line-height: 1.1;
  color: var(--c-text);
}
.card-stat-label {
  font-size: .8rem; color: var(--c-text-2); margin-top: 4px; font-weight: 500;
}
.card-stat-icon {
  width: 42px; height: 42px; border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.card-stat-icon.blue   { background: var(--c-primary-l); color: var(--c-primary); }
.card-stat-icon.green  { background: var(--c-success-l); color: var(--c-success); }
.card-stat-icon.yellow { background: var(--c-warning-l); color: var(--c-warning); }
.card-stat-icon.red    { background: var(--c-danger-l);  color: var(--c-danger);  }

/* ─── Section Card ───────────────────────────────────────── */
.section-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.section-card + .section-card { margin-top: 20px; }
.section-card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--c-border);
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
}
.section-card-header h2 {
  font-size: 1rem; font-weight: 600; color: var(--c-text);
}
.section-card-body { padding: 20px; }

/* ─── Toolbar ────────────────────────────────────────────── */
.toolbar {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--c-border);
  flex-wrap: wrap;
}
.search-box {
  display: flex; align-items: center; gap: 8px;
  background: var(--c-bg); border: 1px solid var(--c-border);
  border-radius: var(--radius-sm); padding: 0 12px;
  flex: 1; min-width: 180px; max-width: 340px;
  transition: border-color var(--transition);
}
.search-box:focus-within { border-color: var(--c-primary); }
.search-box input {
  border: none; background: transparent; outline: none;
  padding: 7px 0; width: 100%; font-size: .875rem; color: var(--c-text);
}
.search-box svg { color: var(--c-text-3); flex-shrink: 0; }

.filter-select {
  padding: 7px 12px; border: 1px solid var(--c-border);
  border-radius: var(--radius-sm); background: var(--c-bg);
  font-size: .875rem; color: var(--c-text); outline: none;
  transition: border-color var(--transition);
}
.filter-select:focus { border-color: var(--c-primary); }

/* ─── Modal ──────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(15,23,42,.5);
  display: none; align-items: center; justify-content: center;
  padding: 24px;
}
.modal-overlay.open { display: flex; }

.modal {
  background: var(--c-surface); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); width: 100%;
  max-width: 580px; max-height: 90vh;
  display: flex; flex-direction: column;
  animation: modalIn .2s ease;
}
.modal-sm { max-width: 400px; }
.modal-lg { max-width: 780px; }
.modal-xl { max-width: 980px; }
@keyframes modalIn { from { transform: scale(.95) translateY(-10px); opacity: 0; } to { transform: none; opacity: 1; } }

.modal-header {
  padding: 18px 24px; border-bottom: 1px solid var(--c-border);
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0;
}
.modal-header h3 { font-size: 1.05rem; font-weight: 600; }
.modal-close {
  width: 30px; height: 30px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem; color: var(--c-text-2);
  transition: background var(--transition);
}
.modal-close:hover { background: var(--c-bg); color: var(--c-text); }
.modal-body {
  padding: 24px; overflow-y: auto; flex: 1;
}
.modal-footer {
  padding: 16px 24px; border-top: 1px solid var(--c-border);
  display: flex; justify-content: flex-end; gap: 10px;
  flex-shrink: 0;
}
