:root {
  --accent: #EA4D37;
  --accent-hover: #D33F2A;
  --heading: #1B1B1B;
  --bg: #ffffff;
  --panel: #ffffff;
  --border: #e5e5e5;
  --muted: #6b6b6b;
  --danger: #c0392b;
  --danger-hover: #a5311f;
  --radius: 10px;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--heading);
}

/* Topbar */
.topbar {
  border-bottom: 1px solid var(--border);
  background: #fff;
}
.topbar-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 24px;
}
.brand-logo { height: 34px; display: block; }
.nav { flex: 1; display: flex; gap: 20px; }
.nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  padding: 6px 2px;
  border-bottom: 2px solid transparent;
}
.nav a.active, .nav a:hover { color: var(--heading); border-bottom-color: var(--accent); }
.topbar-user { display: flex; align-items: center; gap: 12px; }
.user-name { font-size: 14px; color: var(--muted); }

.link-btn {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
  padding: 0;
}
.link-btn:hover { color: var(--accent); text-decoration: underline; }

/* Layout */
.page { min-height: calc(100vh - 60px); }
.wrap { max-width: 1100px; margin: 0 auto; padding: 32px 24px; }
h1 { font-size: 24px; margin: 0 0 4px; color: var(--heading); }
h2 { font-size: 16px; margin: 0 0 14px; color: var(--heading); }
.sub { color: var(--muted); font-size: 14px; margin: 0 0 22px; }

/* Toolbar */
.toolbar { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; align-items: center; }
.search {
  flex: 1;
  min-width: 220px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
}

/* Buttons */
button, input[type="submit"] {
  font-size: 14px;
  padding: 9px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: #fff;
  color: var(--heading);
  cursor: pointer;
}
button.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
button.primary:hover { background: var(--accent-hover); }
button:hover { border-color: var(--accent); }
button.danger { color: var(--danger); }
button.danger:hover { background: var(--danger); color: #fff; border-color: var(--danger); }
button.full-width { width: 100%; }

/* Panels & tables */
.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 20px;
}
.form-panel { padding: 20px 24px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; }
tr:last-child td { border-bottom: none; }
td a { color: var(--accent); text-decoration: none; }
td a:hover { text-decoration: underline; }
.added-by { display: block; font-weight: 600; }
.added-date { display: block; font-size: 12px; color: var(--muted); }
.row-actions { display: flex; gap: 6px; white-space: nowrap; }
.row-actions button, .row-actions form { display: inline-block; }
.row-actions button { padding: 5px 10px; font-size: 13px; }
.empty { padding: 40px; text-align: center; color: var(--muted); }

/* Badges */
.badge { padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge-active { background: #e6f4ea; color: #1e7a34; }
.badge-inactive { background: #f1f1f1; color: var(--muted); }
.badge-create { background: #e6f4ea; color: #1e7a34; }
.badge-update { background: #fdf1e0; color: #a9670a; }
.badge-delete { background: #fbe9e7; color: var(--danger); }

/* Banners */
.banner { padding: 12px 16px; border-radius: var(--radius); margin-bottom: 18px; font-size: 14px; }
.banner-success { background: #e6f4ea; color: #1e7a34; }
.banner-error { background: #fbe9e7; color: var(--danger); }
.banner code { background: rgba(0,0,0,0.06); padding: 2px 6px; border-radius: 4px; font-weight: 600; }

/* Forms */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 5px; font-weight: 600; }
.field input, .field select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
}
.field input[type="color"] { padding: 4px; height: 42px; }
.field .hint { display: block; font-size: 12px; color: var(--muted); margin-top: 4px; }
.field-row { display: flex; gap: 20px; }
.field-row .field { flex: 1; }
.inline-form { display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap; }
.inline-form .field { margin-bottom: 0; flex: 1; min-width: 200px; }
.form-error { color: var(--danger); font-size: 14px; margin: 0 0 14px; }
.logo-preview { max-height: 60px; display: block; margin-top: 4px; }

/* Auth pages */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.auth-card {
  width: 100%;
  max-width: 380px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
}
.auth-logo { height: 44px; margin-bottom: 20px; display: block; }
.auth-card h1 { font-size: 19px; margin-bottom: 16px; }

/* Modal */
.modal-backdrop {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.4);
  align-items: center;
  justify-content: center;
  z-index: 10;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: #fff;
  border-radius: var(--radius);
  padding: 24px;
  width: 100%;
  max-width: 400px;
  border: 1px solid var(--border);
}
.modal h2 { margin: 0 0 16px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.footer-actions { margin-top: 4px; }
.count { color: var(--muted); font-size: 13px; }
