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

:root {
  --blue: #1a56db; --blue-light: #eff3ff;
  --green: #057a55; --green-light: #f0fdf4;
  --orange: #c27803; --orange-light: #fffbeb;
  --red: #c81e1e; --red-light: #fef2f2;
  --gray-50: #f9fafb; --gray-100: #f3f4f6; --gray-200: #e5e7eb;
  --gray-300: #d1d5db; --gray-400: #9ca3af;
  --gray-500: #6b7280; --gray-700: #374151; --gray-900: #111827;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--gray-50); color: var(--gray-900); min-height: 100vh;
}

/* ── SIDEBAR ── */
.sidebar {
  position: fixed; top: .75rem; left: .75rem; bottom: .75rem; width: 200px;
  background: white; border: 1px solid var(--gray-200); border-radius: 16px;
  display: flex; flex-direction: column; z-index: 100; overflow: hidden;
}
.sidebar-logo {
  padding: 1.25rem 1.25rem 1rem; border-bottom: 1px solid var(--gray-200);
  display: flex; align-items: center; gap: .75rem;
}
.sidebar-logo-icon {
  width: 36px; height: 36px; background: var(--blue); border-radius: 9px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.sidebar-logo-icon svg { width: 18px; height: 18px; }
.sidebar-logo-text { font-size: .95rem; font-weight: 700; }
.sidebar-logo-sub { font-size: .72rem; color: var(--gray-500); margin-top: 1px; }

.sidebar-nav { padding: .75rem; flex: 1; overflow-y: auto; }
.nav-section { margin-bottom: 1.25rem; }
.nav-label {
  font-size: .68rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: .06em; color: var(--gray-500); padding: 0 .5rem; margin-bottom: .4rem;
}
.nav-item {
  display: flex; align-items: center; gap: .65rem;
  padding: .5rem .75rem; border-radius: 8px; font-size: .875rem;
  color: var(--gray-700); cursor: pointer; text-decoration: none;
  transition: background .12s, color .12s; margin-bottom: 2px;
}
.nav-item:hover { background: var(--gray-100); }
.nav-item.active { background: var(--blue-light); color: var(--blue); font-weight: 600; }
.nav-item svg { width: 16px; height: 16px; flex-shrink: 0; }

.sidebar-footer { padding: .5rem .75rem .75rem; border-top: 1px solid var(--gray-200); }

.update-btn {
  display: flex; align-items: center; gap: .65rem;
  padding: .45rem .75rem; border-radius: 8px; font-size: .8rem;
  color: var(--gray-500); cursor: pointer; margin-bottom: 4px;
  transition: background .12s, color .12s;
}
.update-btn:hover { background: var(--gray-100); color: var(--gray-700); }
.update-btn svg { width: 14px; height: 14px; flex-shrink: 0; }
.update-btn.updating svg { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.user-row {
  display: flex; align-items: center; gap: .65rem;
  padding: .5rem .75rem; border-radius: 8px; cursor: pointer;
  transition: background .12s;
}
.user-row:hover { background: var(--gray-100); }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; background: var(--blue);
  color: white; display: flex; align-items: center; justify-content: center;
  font-size: .75rem; font-weight: 700; flex-shrink: 0;
}
.user-name { font-size: .85rem; font-weight: 600; flex: 1; }

/* ── MAIN ── */
.main { margin-left: 217px; padding: 2rem 2rem; min-height: 100vh; }

.page-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 1.75rem;
}
.page-header h1 { font-size: 1.5rem; font-weight: 700; }
.page-header p { color: var(--gray-500); font-size: .875rem; margin-top: .2rem; }

/* ── BUTTONS ── */
.btn {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .6rem 1.1rem; border-radius: 8px; font-size: .875rem;
  font-weight: 600; cursor: pointer; border: none; transition: background .15s;
  text-decoration: none; font-family: inherit;
}
.btn-primary { background: var(--blue); color: white; }
.btn-primary:hover { background: #1648c0; }
.btn-ghost { background: white; color: var(--gray-700); border: 1px solid var(--gray-200); }
.btn-ghost:hover { background: var(--gray-100); }
.btn-danger { background: var(--red-light); color: var(--red); border: 1px solid #fecaca; }
.btn-danger:hover { background: #fee2e2; }
.btn svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ── CARD / TABLE ── */
.card { background: white; border-radius: 14px; border: 1px solid var(--gray-200); overflow: hidden; }
.card-header {
  padding: 1rem 1.25rem; border-bottom: 1px solid var(--gray-100);
  display: flex; align-items: center; justify-content: space-between;
}
.card-title { font-size: .9rem; font-weight: 700; }
.card-link { font-size: .8rem; color: var(--blue); cursor: pointer; text-decoration: none; }

table { width: 100%; border-collapse: collapse; }
th {
  text-align: left; padding: .65rem 1.25rem; font-size: .72rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .04em; color: var(--gray-500);
  background: var(--gray-50); border-bottom: 1px solid var(--gray-100); white-space: nowrap;
}
td { padding: .8rem 1.25rem; font-size: .875rem; border-bottom: 1px solid var(--gray-100); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tbody tr { cursor: pointer; transition: background .1s; }
tbody tr:hover td { background: var(--gray-50); }

/* ── BADGES ── */
.badge { display: inline-block; padding: .15rem .55rem; border-radius: 99px; font-size: .7rem; font-weight: 600; }
.badge-blue { background: var(--blue-light); color: var(--blue); }
.badge-green { background: var(--green-light); color: var(--green); }
.badge-orange { background: var(--orange-light); color: var(--orange); }
.badge-gray { background: var(--gray-100); color: var(--gray-500); }
.badge-red { background: var(--red-light); color: var(--red); }
.badges { display: flex; gap: .3rem; flex-wrap: wrap; }

/* ── EMPTY STATE ── */
.empty-state { padding: 4rem 1.5rem; text-align: center; color: var(--gray-500); }
.empty-state svg { width: 44px; height: 44px; stroke: var(--gray-300); fill: none; stroke-width: 1.5; margin-bottom: .75rem; display: block; margin-inline: auto; }
.empty-state p { font-size: .9rem; }

/* ── FILTER BAR ── */
.filter-bar { display: flex; gap: .75rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.search-wrap { position: relative; flex: 1; min-width: 200px; max-width: 320px; }
.search-wrap svg { position: absolute; left: .75rem; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; stroke: var(--gray-500); fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }
.search-input { width: 100%; padding: .55rem .9rem .55rem 2.25rem; border: 1.5px solid var(--gray-200); border-radius: 8px; font-size: .875rem; outline: none; background: white; transition: border-color .15s; font-family: inherit; }
.search-input:focus { border-color: var(--blue); }
.filter-tabs { display: flex; background: white; border: 1px solid var(--gray-200); border-radius: 8px; overflow: hidden; }
.filter-tab { padding: .5rem .9rem; font-size: .8rem; font-weight: 600; cursor: pointer; color: var(--gray-500); border: none; background: none; transition: background .12s, color .12s; font-family: inherit; }
.filter-tab.active { background: var(--blue-light); color: var(--blue); }

/* ── MODAL ── */
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 200; display: none; align-items: center; justify-content: center; padding: 1rem; }
.overlay.open { display: flex; }
.modal { background: white; border-radius: 16px; width: 100%; max-width: 560px; max-height: 90vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,.2); }
.modal-header { padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--gray-100); display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; background: white; z-index: 1; border-radius: 16px 16px 0 0; }
.modal-header h2 { font-size: 1rem; font-weight: 700; }
.modal-close { width: 30px; height: 30px; border: none; background: var(--gray-100); border-radius: 6px; cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 1.1rem; color: var(--gray-500); transition: background .12s; font-family: inherit; }
.modal-close:hover { background: var(--gray-200); }
.modal-body { padding: 1.5rem; }
.modal-footer { padding: 1rem 1.5rem; border-top: 1px solid var(--gray-100); display: flex; justify-content: space-between; align-items: center; gap: .75rem; background: white; border-radius: 0 0 16px 16px; }
.modal-footer-right { display: flex; gap: .5rem; }

/* ── FORM ── */
.form-section { margin-bottom: 1.5rem; }
.form-section-title { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--gray-500); margin-bottom: .75rem; padding-bottom: .5rem; border-bottom: 1px solid var(--gray-100); }
.form-row { display: grid; gap: .75rem; margin-bottom: .75rem; }
.form-row.cols-2 { grid-template-columns: 1fr 1fr; }
.form-row.cols-3 { grid-template-columns: 2fr 1fr 1.2fr; }
.form-row.cols-addr { grid-template-columns: 2fr 1fr; }
.field label { display: block; font-size: .78rem; font-weight: 600; color: var(--gray-700); margin-bottom: .35rem; }
.field input, .field textarea, .field select {
  width: 100%; padding: .6rem .85rem; border: 1.5px solid var(--gray-200); border-radius: 8px;
  font-size: .9rem; color: var(--gray-900); outline: none; transition: border-color .15s; font-family: inherit;
  box-sizing: border-box; line-height: 1.4; height: 2.6rem;
}
.field textarea { height: auto; min-height: 70px; }
.field select { appearance: auto; cursor: pointer; }
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--blue); }
.field textarea { resize: vertical; min-height: 70px; }
