@import url("https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700&family=Fraunces:wght@600&display=swap");

/* ================= RESET ================= */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --bg: #f8fafc;
    --panel: #ffffff;
    --text: #0f172a;
    --muted: #64748b;

    --primary: #2563eb;
    --primary-hover: #1d4ed8;

    --danger: #dc2626;
    --danger-hover: #b91c1c;

    --success: #16a34a;
    --warning: #f59e0b;

    --border: #e5e7eb;
    --shadow: 0 12px 40px rgba(0, 0, 0, 0.08);
}

body {
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

/* ================= HEADER ================= */
.app-header {
    background: #020617;
    color: #ffffff;
    padding: 18px 28px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.app-header h2 {
    font-size: 18px;
    font-weight: 600;
}

.app-header button {
    background: var(--danger);
    border: none;
    color: #ffffff;
    padding: 8px 14px;
    border-radius: 8px;
    cursor: pointer;
}

.app-header button:hover {
    background: var(--danger-hover);
}

/* ================= MAIN ================= */
.main {
    max-width: 1200px;
    margin: 36px auto;
    padding: 0 22px;
}

/* ================= PANELS ================= */
.panel {
    background: var(--panel);
    border-radius: 16px;
    padding: 26px;
    margin-bottom: 26px;
    box-shadow: var(--shadow);
}

.panel h3 {
    margin-bottom: 14px;
    font-weight: 600;
}

/* ================= PRIMARY PANEL ================= */
.panel.primary {
    border-left: 6px solid var(--primary);
}

/* ================= RANGE CONTROLS ================= */
.range-controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    align-items: end;
    margin-bottom: 16px;
}

.range-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    margin: 6px 0 18px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #ffffff;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.06);
}

.range-label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
    white-space: nowrap;
}

.range-bar .range-controls {
    margin-bottom: 0;
    flex: 1;
}

@media (max-width: 700px) {
    .range-bar {
        flex-direction: column;
        align-items: flex-start;
    }

    .range-bar .range-controls {
        width: 100%;
    }
}

/* ================= PRIMARY BUTTON ================= */
.primary-btn {
    background: var(--primary);
    font-weight: 600;
}

.primary-btn:hover {
    background: var(--primary-hover);
}

/* ================= CARD ================= */
.card {
    background: #f8fafc;
    border-radius: 12px;
    padding: 16px;
    border: 1px solid var(--border);
    box-shadow: 0 8px 20px rgba(0,0,0,0.04);
}

/* ================= GRID ================= */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 18px;
    margin-top: 16px;
}


/* ================= FORMS ================= */
input,
select {
    width: 100%;
    padding: 11px 14px;
    border-radius: 10px;
    border: 1px solid var(--border);
    font-size: 14px;
    margin-bottom: 12px;
    background: #ffffff;
}

input:focus,
select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

/* ================= BUTTONS ================= */
button {
    background: var(--primary);
    border: none;
    color: #ffffff;
    padding: 10px 18px;
    border-radius: 10px;
    font-size: 14px;
    cursor: pointer;
    font-weight: 500;
}

button:hover {
    background: var(--primary-hover);
}

button.danger {
    background: var(--danger);
}

button.danger:hover {
    background: var(--danger-hover);
}

/* ================= TABLE ================= */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 14px;
    font-size: 14px;
}

th,
td {
    padding: 12px 10px;
    border-bottom: 1px solid var(--border);
    text-align: left;
}

th {
    background: #f1f5f9;
    font-weight: 600;
}

.table-scroll {
    overflow-x: auto;
    scrollbar-gutter: stable;
}

.report-table {
    min-width: 860px;
    font-size: 12px;
}

.report-table th,
.report-table td {
    padding: 8px 8px;
    white-space: normal;
}

/* ================= STATUS ================= */
.status-pill {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}

.status-good {
    background: #dcfce7;
    color: #166534;
}

.status-bad {
    background: #fee2e2;
    color: #991b1b;
}

/* ================= ERROR ================= */
.error-banner {
    background: #fee2e2;
    color: #991b1b;
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.error-banner.hidden {
    display: none;
}

/* ================= LOGIN PAGE ================= */
.login-page {
    min-height: 100vh;
    background:
        radial-gradient(900px 500px at 20% 10%, rgba(37, 99, 235, 0.10), transparent),
        radial-gradient(900px 500px at 80% 30%, rgba(14, 165, 233, 0.08), transparent),
        #f3f6fb;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-wrapper {
    width: 100%;
    display: flex;
    justify-content: center;
    padding: 20px;
}

.login-box {
    width: 100%;
    max-width: 420px;
    padding: 36px 32px;
    background: #ffffff;
    border-radius: 18px;
    box-shadow: 0 18px 50px rgba(15, 23, 42, 0.12);
    text-align: center;
}

.login-box .logo {
    width: 120px;
    margin-bottom: 18px;
}

.login-box h2 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 6px;
}

.login-box .muted {
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 22px;
}

/* PASSWORD TOGGLE */
.password-field {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 8px;
}

.password-field label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--muted);
    cursor: pointer;
    margin-bottom: 12px;
}

/* ================= OPS ADMIN ================= */

/* Header already exists but reinforce consistency */
.app-header {
  background: #020617;
  color: #fff;
  padding: 18px 28px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.app-header h2 {
  font-size: 18px;
  font-weight: 600;
}

.app-header span {
  margin-right: 14px;
  font-size: 14px;
  opacity: 0.9;
}

/* ================= PANELS ================= */
.panel {
  background: #ffffff;
  border-radius: 16px;
  padding: 26px;
  margin-bottom: 28px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.08);
}

.panel h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
}

/* ================= GRID ================= */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 18px;
  margin-top: 16px;
}

/* ================= CARD ================= */
.card {
  background: #f8fafc;
  border-radius: 14px;
  padding: 18px;
  border: 1px solid #e5e7eb;
  font-size: 14px;
}

.card strong {
  font-size: 15px;
  display: block;
  margin-bottom: 6px;
}

/* ================= FORMS ================= */
input,
select,
textarea {
  width: 100%;
  padding: 11px 14px;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
  font-size: 14px;
  margin-bottom: 12px;
  background: #ffffff;
}

textarea {
  min-height: 90px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

/* ================= BUTTONS ================= */
button {
  background: #2563eb;
  border: none;
  color: #ffffff;
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 14px;
  cursor: pointer;
  font-weight: 500;
}

button:hover {
  background: #1d4ed8;
}

/* Create buttons */
#openCreateSbuBtn,
#openCreateStaffBtn {
  margin-bottom: 14px;
}

/* Danger-style buttons (optional JS adds class) */
button.danger {
  background: #dc2626;
}

button.danger:hover {
  background: #b91c1c;
}

/* ================= ASSIGN PANEL ================= */
#assignStaffBtn {
  margin-top: 8px;
}

/* ================= AUDIT LOGS ================= */
#adminAuditLog {
  margin-top: 14px;
}

.log-item {
  padding: 10px 0;
  border-bottom: 1px solid #e5e7eb;
  font-size: 13px;
}

.log-item:last-child {
  border-bottom: none;
}

.log-item small {
  color: #64748b;
}

/* ================= STATUS TEXT ================= */
.status-active {
  color: #16a34a;
  font-weight: 600;
}

.status-inactive {
  color: #dc2626;
  font-weight: 600;
}

/* ================= NET LOSS ================= */
.net-loss {
  color: #dc2626;
  font-weight: 600;
}

/* ================= RESPONSIVE ================= */
@media (max-width: 768px) {
  .main {
    padding: 0 14px;
  }

  .panel {
    padding: 20px;
  }
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal.hidden {
  display: none;
}

.modal-box {
  background: white;
  padding: 24px;
  border-radius: 14px;
  width: 400px;
}

.modal-actions {
  display: flex;
  justify-content: space-between;
  margin-top: 14px;
}

/* ================= COMPACT LAYOUT OVERRIDES ================= */
:root {
  --bg: #eef2f7;
  --text: #111827;
  --muted: #6b7280;
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
}

body {
  font-family: "Manrope", "Segoe UI", sans-serif;
  background:
    radial-gradient(1200px 600px at 90% -10%, rgba(37, 99, 235, 0.08), transparent),
    radial-gradient(1000px 500px at 0% 20%, rgba(14, 165, 233, 0.07), transparent),
    var(--bg);
  line-height: 1.5;
}

.app-header {
  background: linear-gradient(135deg, #0b1324, #0f172a);
  padding: 12px 20px;
  position: sticky;
  top: 0;
  z-index: 5;
}

.app-header h2 {
  font-size: 16px;
  letter-spacing: 0.3px;
}

.app-header button {
  padding: 6px 10px;
  font-size: 12px;
}

.main {
  max-width: 1120px;
  margin: 22px auto 80px;
  padding: 0 18px;
}

.panel {
  border-radius: 14px;
  padding: 18px;
  margin-bottom: 18px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  animation: fadeUp 0.35s ease both;
}

.panel h3 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 12px;
}

.grid {
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.card {
  background: linear-gradient(180deg, #ffffff, #f8fafc);
  padding: 12px;
  border-radius: 12px;
  font-size: 13px;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.06);
  animation: fadeUp 0.35s ease both;
}

.card strong {
  font-size: 14px;
  font-family: "Fraunces", serif;
}

input,
select,
textarea {
  padding: 9px 10px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 10px;
}

button {
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
}

input[type="checkbox"] {
  width: auto;
  margin: 0;
}

.panel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
  margin-bottom: 16px;
  align-items: start;
}

.panel-grid .panel {
  margin-bottom: 0;
}

.scroll-panel {
  max-height: 520px;
  overflow: auto;
  scrollbar-gutter: stable;
}

.log-panel {
  max-height: 360px;
  overflow: auto;
  scrollbar-gutter: stable;
}

details.collapse summary {
  list-style: none;
  cursor: pointer;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
}

details.collapse summary::-webkit-details-marker {
  display: none;
}

details.collapse[open] summary {
  margin-bottom: 12px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.field label {
  font-size: 12px;
  color: var(--muted);
}

.form-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 6px;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}

.report-meta {
  border-left: 4px solid var(--primary);
}

.report-range {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 10px;
  margin-bottom: 10px;
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 900px) {
  .panel-grid {
    grid-template-columns: 1fr;
  }
}
