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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: #f0f2f5;
  margin: 0;
  padding: 0;
  color: #1a1a2e;
  line-height: 1.6;
}

.nav-bar {
  max-width: 1280px;
  margin: 24px auto -12px;
  padding: 0 30px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 15px;
}
.nav-bar .user-info {
  color: #718096;
}
.nav-bar .user-info strong {
  color: #1a1a2e;
}
.nav-links a {
  color: #5a67d8;
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 6px;
  transition: background 0.2s, color 0.2s;
}
.nav-links a:hover {
  background: #eef0ff;
  color: #434bb2;
}
.nav-links .sep {
  color: #cbd5e0;
  margin: 0 2px;
}

.user-drop {
  position: relative;
  display: inline-block;
  margin-left: 12px;
}
.user-drop-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: 1px solid #e8ecf1;
  border-radius: 8px;
  padding: 5px 12px;
  font-size: 13px;
  color: #1a1a2e;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.user-drop-btn:hover {
  background: #f8f9fb;
  border-color: #cbd5e0;
}
.user-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #5a67d8;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.user-drop-arrow {
  font-size: 10px;
  color: #8795a1;
  margin-left: 2px;
}
.user-drop-menu {
  display: none;
  position: absolute;
  right: 0;
  top: 100%;
  margin-top: 6px;
  background: #fff;
  border: 1px solid #e8ecf1;
  border-radius: 10px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
  min-width: 220px;
  z-index: 200;
  overflow: hidden;
}
.user-drop.open .user-drop-menu { display: block; }
.user-drop-header {
  padding: 14px 16px;
  border-bottom: 1px solid #f0f2f5;
}
.user-drop-header .name {
  font-size: 14px;
  font-weight: 500;
  color: #1a1a2e;
}
.user-drop-header .role {
  font-size: 12px;
  color: #8795a1;
}
.user-drop-menu a {
  display: block;
  padding: 10px 16px;
  font-size: 13px;
  color: #1a1a2e;
  text-decoration: none;
  transition: background 0.12s;
}
.user-drop-menu a:hover {
  background: #f8f9fb;
  text-decoration: none;
}
.user-drop-menu .logout-link {
  border-top: 1px solid #f0f2f5;
  color: #e53e3e;
}
.user-drop-menu .logout-link:hover {
  background: #fff0f0;
}

/* ---- Nav dropdown (inline menu in nav-links) ---- */
.nav-drop {
  position: relative;
  display: inline-block;
}
.nav-drop-btn {
  background: none;
  border: 1px solid #e8ecf1;
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 15px;
  font-weight: 500;
  color: #5a67d8;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
.nav-drop-btn:hover {
  background: #eef0ff;
  color: #434bb2;
}
.nav-drop-arrow {
  font-size: 10px;
  margin-left: 2px;
  color: #8795a1;
}
.nav-drop-menu {
  display: none;
  position: absolute;
  left: 0;
  top: 100%;
  margin-top: 6px;
  background: #fff;
  border: 1px solid #e8ecf1;
  border-radius: 10px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
  min-width: 200px;
  z-index: 200;
  overflow: hidden;
}
.nav-drop.open .nav-drop-menu { display: block; }
.nav-drop-menu a {
  display: block;
  padding: 10px 16px;
  font-size: 13px;
  color: #1a1a2e;
  text-decoration: none;
  transition: background 0.12s;
}
.nav-drop-menu a:hover {
  background: #f8f9fb;
  text-decoration: none;
}

.container {
  max-width: 1280px;
  margin: 24px auto 40px;
  background: #fff;
  padding: 32px;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 6px 24px rgba(0,0,0,0.06);
}

.subtitle {
  color: #718096;
  font-size: 14px;
  margin-bottom: 24px;
}

.pill {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  background: #eef0ff;
  color: #5a67d8;
  font-size: 13px;
  font-weight: 500;
}
.pill-green { background: #e6ffed; color: #1a7a3a; }
.pill-red { background: #fff0f0; color: #e53e3e; }
.pill-muted { background: #f0f2f5; color: #8795a1; }

table {
  width: 100%;
  border-collapse: collapse;
}
thead th {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #8795a1;
  border-bottom: 2px solid #e8ecf1;
  padding: 10px 12px;
  text-align: left;
}
tbody tr {
  transition: background 0.15s;
}
tbody tr:hover {
  background: #f8f9fb;
}
tbody td {
  padding: 12px;
  border-bottom: 1px solid #f0f2f5;
  font-size: 14px;
  vertical-align: middle;
}

.muted { color: #8795a1; font-size: 13px; }
.right { text-align: right; }

a { color: #5a67d8; text-decoration: none; }
a:hover { text-decoration: underline; }

.msg {
  margin-bottom: 16px;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 14px;
}
.err { background: #fff0f0; color: #b00020; border: 1px solid #fdd; }
.ok { background: #e6ffed; color: #1a7a3a; border: 1px solid #c3f0d0; }

code {
  background: #f0f2f5;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 13px;
  color: #5a67d8;
}

/* ---- Pagination bar ---- */
.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 16px;
  font-size: 13px;
  color: #8795a1;
}
.pagination-bar a {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  background: #edf2f7;
  color: #4a5568;
  text-decoration: none;
  font-weight: 500;
  transition: background 0.15s;
}
.pagination-bar a:hover {
  background: #e2e8f0;
  color: #1a1a2e;
}
.pagination-bar .disabled {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  background: #f7fafc;
  color: #cbd5e0;
  font-weight: 500;
  cursor: default;
}
.pagination-bar .page-info {
  margin: 0 8px;
}

/* ---- Row-detail modal ---- */
.row-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.row-modal-overlay.hidden { display: none; }
.row-modal {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.18);
  max-width: 640px;
  width: 92%;
  max-height: 80vh;
  overflow-y: auto;
  padding: 28px 32px 24px;
  position: relative;
}
.row-modal-close {
  position: absolute;
  top: 12px;
  right: 16px;
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: #8795a1;
  line-height: 1;
}
.row-modal-close:hover { color: #1a1a2e; }
.row-modal h2 {
  margin: 0 0 20px;
  font-size: 18px;
  font-weight: 600;
  color: #1a1a2e;
}
.row-modal-field { margin-bottom: 16px; }
.row-modal-field:last-child { margin-bottom: 0; }
.row-modal-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #8795a1;
  margin-bottom: 4px;
}
.row-modal-value {
  font-size: 14px;
  color: #1a1a2e;
  word-break: break-word;
  white-space: pre-wrap;
}

/* ---- Shared page headings ---- */
h2 {
    margin: 0 0 4px;
    font-size: 22px;
    font-weight: 600;
    color: #1a1a2e;
}

/* ---- Form card ---- */
.form-card {
    background: #f8f9fb;
    padding: 20px 24px;
    border-radius: 10px;
    border: 1px solid #e8ecf1;
    margin-bottom: 28px;
}
.form-card .row {
    display: flex;
    gap: 14px;
    align-items: flex-end;
    flex-wrap: wrap;
}
label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: #4a5568;
    margin-bottom: 6px;
}

/* ---- Buttons ---- */
button {
    padding: 9px 16px;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    background: #5a67d8;
    color: #fff;
}
button:hover { background: #4c51bf; }
button:active { transform: scale(0.97); }
.btn-grey { background: #a0aec0; color: #fff; }
.btn-grey:hover { background: #8a96a8; }
.btn-red { background: #e53e3e; color: #fff; }
.btn-red:hover { background: #c53030; }
.btn-green { background: #38a169; color: #fff; }
.btn-green:hover { background: #2f855a; }

/* ---- Controls bar ---- */
.controls {
    display: flex;
    gap: 10px;
    align-items: flex-end;
    margin-bottom: 24px;
}
.controls label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: #4a5568;
    margin-bottom: 6px;
}
.controls input {
    padding: 9px 12px;
    border: 1px solid #d2d8e0;
    border-radius: 8px;
    width: 100px;
    font-size: 14px;
    background: #fff;
    color: #1a1a2e;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.controls input:focus {
    outline: none;
    border-color: #5a67d8;
    box-shadow: 0 0 0 3px rgba(90,103,216,0.12);
}
.controls button {
    padding: 9px 16px;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    background: #5a67d8;
    color: #fff;
}
.controls button:hover { background: #4c51bf; }
.controls button:active { transform: scale(0.97); }
.controls .status {
    color: #8795a1;
    font-size: 13px;
    padding-bottom: 10px;
}

/* ---- Footer tip ---- */
.footer-tip {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid #f0f2f5;
    color: #8795a1;
    font-size: 13px;
}
