:root {
  color-scheme: light;
  --bg: #eef2f6;
  --panel: #ffffff;
  --panel-soft: #f8fafc;
  --text: #182230;
  --muted: #667085;
  --line: #d6dde8;
  --line-soft: #e6ebf2;
  --brand: #0f6f7f;
  --brand-2: #0a4f5c;
  --brand-soft: #e7f5f7;
  --danger: #b42318;
  --danger-soft: #fef3f2;
  --ok: #027a48;
  --ok-soft: #ecfdf3;
  --warn: #b54708;
  --warn-soft: #fffaeb;
  --shadow: 0 12px 32px rgba(16, 24, 40, .08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  background:
    linear-gradient(180deg, #f8fafc 0, var(--bg) 240px),
    var(--bg);
  color: var(--text);
}

button, input, textarea, select {
  font: inherit;
}

button {
  min-height: 38px;
  border: 0;
  border-radius: 7px;
  background: var(--brand);
  color: #fff;
  padding: 9px 14px;
  cursor: pointer;
  font-weight: 750;
  letter-spacing: 0;
  transition: background .16s ease, box-shadow .16s ease, transform .16s ease;
}

button:hover {
  background: var(--brand-2);
  box-shadow: 0 8px 18px rgba(15, 111, 127, .18);
}

button:active {
  transform: translateY(1px);
}

button.secondary {
  background: #e9eff6;
  color: #243244;
}

button.secondary:hover {
  background: #dfe8f2;
  box-shadow: none;
}

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

button.danger:hover {
  background: #fee4e2;
  box-shadow: none;
}

button:disabled {
  opacity: .55;
  cursor: not-allowed;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
}

.login-visual {
  background:
    linear-gradient(rgba(7, 52, 60, .68), rgba(15, 111, 127, .78)),
    url("https://images.unsplash.com/photo-1551836022-d5d88e9218df?auto=format&fit=crop&w=1600&q=80") center/cover;
  color: #fff;
  display: flex;
  align-items: end;
  padding: 54px;
}

.login-visual h1 {
  font-size: 44px;
  margin: 0 0 12px;
  letter-spacing: 0;
}

.login-visual p {
  margin: 0;
  max-width: 620px;
  line-height: 1.7;
  color: rgba(255, 255, 255, .88);
}

.login-panel {
  display: flex;
  align-items: center;
  padding: 34px;
  background: var(--panel);
}

.login-card, .page {
  width: 100%;
}

.login-card h2 {
  margin: 0 0 22px;
  font-size: 24px;
}

.login-card button {
  width: 100%;
  margin-top: 4px;
}

.login-card .sso-btn {
  margin-top: 10px;
  background: #1677ff;
}

.login-card .sso-btn:hover {
  background: #0958d9;
  box-shadow: 0 8px 18px rgba(22, 119, 255, .18);
}

.field {
  display: grid;
  gap: 7px;
  margin-bottom: 14px;
}

.field label {
  color: #344054;
  font-size: 13px;
  font-weight: 750;
}

input, textarea, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--text);
  padding: 10px 12px;
  outline: none;
  box-shadow: 0 1px 1px rgba(16, 24, 40, .02);
}

select {
  min-height: 42px;
}

textarea {
  min-height: 108px;
  resize: vertical;
  line-height: 1.6;
}

input::placeholder,
textarea::placeholder {
  color: #98a2b3;
}

input:focus, textarea:focus, select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(15, 111, 127, .12);
}

.readonly-period {
  min-height: 42px;
  display: flex;
  align-items: center;
  border: 1px solid var(--line-soft);
  border-radius: 7px;
  background: var(--panel-soft);
  color: #344054;
  padding: 10px 12px;
  font-weight: 800;
}

.hint, .muted {
  color: var(--muted);
  font-size: 13px;
}

.error {
  color: var(--danger);
  margin-top: 10px;
}

.topbar {
  height: 72px;
  background: rgba(255, 255, 255, .94);
  border-bottom: 1px solid var(--line-soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 5;
  backdrop-filter: blur(10px);
}

.brand {
  display: grid;
  gap: 2px;
  font-weight: 850;
  font-size: 18px;
}

.brand small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

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

.user-chip {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  background: var(--panel-soft);
  color: #475467;
  padding: 0 12px;
  font-size: 13px;
  font-weight: 700;
}

.layout {
  display: grid;
  grid-template-columns: 380px minmax(0, 1fr);
  gap: 20px;
  width: min(1560px, calc(100vw - 56px));
  margin: 22px auto 42px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 20px;
  box-shadow: var(--shadow);
}

#composePanel {
  position: sticky;
  top: 94px;
  align-self: start;
}

.panel h2, .panel h3 {
  margin: 0 0 16px;
  font-size: 18px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.section-head h2 {
  margin: 0;
}

.view-subtitle {
  color: var(--muted);
  font-size: 13px;
  margin-top: 4px;
}

.count-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-2);
  padding: 0 10px;
  font-size: 13px;
  font-weight: 800;
}

.tabs, .row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 4px;
  border-radius: 8px;
  background: #eef3f8;
}

.tabs button {
  background: transparent;
  color: #475467;
  box-shadow: none;
}

.tabs button.active {
  background: #fff;
  color: var(--brand-2);
  box-shadow: 0 4px 12px rgba(16, 24, 40, .08);
}

#reportForm {
  margin-top: 18px;
}

#reportForm h2 {
  margin-top: 0;
}

.submit-btn {
  width: 100%;
  margin-top: 4px;
}

.filters {
  display: grid;
  grid-template-columns: minmax(120px, .8fr) minmax(120px, .8fr) minmax(170px, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--panel-soft);
}

.filters a {
  text-decoration: none;
}

.filters button,
.filters a button {
  width: 100%;
  white-space: nowrap;
}

.active-filter {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid #b9e6ee;
  border-radius: 8px;
  background: var(--brand-soft);
  color: var(--brand-2);
  font-size: 14px;
  font-weight: 800;
}

.active-filter button {
  min-height: 32px;
  padding: 6px 10px;
}

.report-list {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.report-card {
  position: relative;
  border: 1px solid var(--line-soft);
  border-left: 4px solid var(--brand);
  border-radius: 8px;
  padding: 16px 16px 16px 18px;
  background: #fff;
  box-shadow: 0 4px 14px rgba(16, 24, 40, .04);
}

.report-card:hover {
  border-color: #c7d2df;
  box-shadow: 0 10px 24px rgba(16, 24, 40, .08);
}

.report-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: start;
}

.report-title {
  font-size: 16px;
  font-weight: 850;
  margin: 0 0 7px;
}

.meta {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 13px;
}

.meta span {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  background: #f2f5f9;
  padding: 0 8px;
  font-weight: 650;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 0 9px;
  font-size: 12px;
  font-weight: 850;
  background: #eef4ff;
  color: #3538cd;
}

.badge.ok {
  background: var(--ok-soft);
  color: var(--ok);
}

.badge.warn {
  background: var(--warn-soft);
  color: var(--warn);
}

.report-body {
  white-space: pre-wrap;
  line-height: 1.68;
  margin-top: 13px;
  color: #243244;
}

.report-body.compact {
  margin-top: 6px;
}

.section-label {
  display: inline-flex;
  margin-top: 14px;
  color: #344054;
  font-size: 13px;
  font-weight: 850;
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 18px;
}

.user-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  margin-top: 14px;
}

.user-table th, .user-table td {
  border-bottom: 1px solid var(--line-soft);
  padding: 11px 8px;
  text-align: left;
}

.selected-user-row td {
  background: #f0fbfd;
}

.user-view-btn {
  width: 100%;
  min-height: 0;
  display: grid;
  gap: 2px;
  justify-items: start;
  border-radius: 7px;
  background: transparent;
  color: var(--text);
  padding: 6px 8px;
  text-align: left;
  box-shadow: none;
}

.user-view-btn:hover {
  background: var(--brand-soft);
  color: var(--brand-2);
  box-shadow: none;
}

.user-view-btn span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, .42);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  z-index: 20;
}

.modal {
  width: min(420px, 100%);
  background: var(--panel);
  border-radius: 8px;
  border: 1px solid var(--line-soft);
  padding: 20px;
  box-shadow: 0 24px 70px rgba(15, 23, 42, .24);
}

.modal h2 {
  margin: 0 0 16px;
  font-size: 20px;
}

.report-editor {
  width: min(760px, 100%);
}

@media (max-width: 1100px) {
  .layout,
  .admin-grid {
    grid-template-columns: 1fr;
  }

  #composePanel {
    position: static;
  }

  .filters {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 700px) {
  .login-shell {
    grid-template-columns: 1fr;
  }

  .login-visual {
    min-height: 260px;
    padding: 30px;
  }

  .login-visual h1 {
    font-size: 32px;
  }

  .topbar {
    height: auto;
    min-height: 72px;
    align-items: flex-start;
    gap: 12px;
    flex-direction: column;
    padding: 14px;
  }

  .top-actions {
    width: 100%;
    justify-content: space-between;
  }

  .layout {
    width: calc(100vw - 24px);
    margin-top: 12px;
  }

  .panel {
    padding: 16px;
  }

  .filters {
    grid-template-columns: 1fr;
  }
}
