:root {
  --bg: #f3f7ff;
  --panel: #ffffff;
  --ink: #172033;
  --muted: #64748b;
  --line: #dbe7ff;
  --teal: #2563eb;
  --teal-dark: #1d4ed8;
  --amber: #ea580c;
  --red: #dc2626;
  --blue: #2563eb;
  --sky: #38bdf8;
  --shadow: 0 18px 44px rgba(37, 99, 235, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", sans-serif;
}

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

[hidden] {
  display: none !important;
}

.login-screen {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 20% 12%, rgba(125, 211, 252, 0.5), transparent 32%),
    linear-gradient(135deg, #eaf4ff 0%, #dbeafe 48%, #1d4ed8 100%);
}

.login-card {
  display: grid;
  width: min(440px, 100%);
  gap: 16px;
  padding: 26px;
  border: 1px solid rgba(191, 219, 254, 0.8);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 24px 70px rgba(30, 64, 175, 0.2);
}

.login-card p {
  color: var(--muted);
}

.login-brand {
  padding-bottom: 16px;
  border-bottom-color: var(--line);
  color: var(--ink);
}

.login-brand span {
  color: var(--muted);
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 236px;
  padding: 22px 18px;
  background:
    linear-gradient(180deg, rgba(37, 99, 235, 0.98), rgba(14, 116, 144, 0.95)),
    #2563eb;
  color: #eff6ff;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  padding-bottom: 22px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.18);
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 8px;
  background: #ffffff;
  color: var(--blue);
  font-weight: 800;
}

.brand-logo-img {
  display: block;
  object-fit: cover;
}

.brand strong,
.brand span {
  display: block;
}

.brand span {
  margin-top: 4px;
  color: rgba(239, 246, 255, 0.74);
  font-size: 13px;
}

.login-card .brand {
  border-bottom-color: var(--line);
}

.login-card .brand span {
  color: var(--muted);
}

nav {
  display: grid;
  gap: 8px;
  margin-top: 24px;
}

nav a {
  padding: 11px 12px;
  border-radius: 8px;
  color: rgba(239, 246, 255, 0.86);
  text-decoration: none;
}

nav a:hover,
nav a.active {
  background: rgba(255, 255, 255, 0.09);
  color: #fff;
}

nav a.active {
  box-shadow: inset 3px 0 0 #bfdbfe;
  background: rgba(255, 255, 255, 0.18);
}

.workspace {
  min-height: 100vh;
  margin-left: 236px;
  padding: 26px;
  background:
    radial-gradient(circle at 88% 4%, rgba(125, 211, 252, 0.28), transparent 28%),
    var(--bg);
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  margin-bottom: 20px;
}

.top-actions {
  min-width: 0;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 26px;
  letter-spacing: 0;
}

.topbar p,
.section-title span,
.muted {
  color: var(--muted);
}

.section {
  margin-bottom: 22px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
}

.view-section {
  display: none;
}

.view-section.active {
  display: block;
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 12px;
}

.filter-pill {
  min-height: 34px;
  border-radius: 999px;
  color: #35606d;
  background: #f4f8ff;
}

.filter-pill.active {
  border-color: #2563eb;
  color: #fff;
  background: #2563eb;
}

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

.section-title h2 {
  font-size: 19px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  gap: 12px;
}

.metric {
  min-height: 98px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.metric span {
  color: var(--muted);
  font-size: 13px;
}

.metric strong {
  display: block;
  margin-top: 10px;
  font-size: 26px;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
}

th,
td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 14px;
}

th {
  color: #334155;
  background: #f8fbff;
  font-weight: 700;
}

tr:last-child td {
  border-bottom: 0;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 230px;
}

button,
.button {
  min-height: 36px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
}

button:hover {
  border-color: var(--blue);
}

.primary {
  border-color: var(--teal);
  background: var(--teal);
  color: #fff;
}

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

.ghost {
  background: transparent;
}

.danger {
  border-color: #f2c5c0;
  color: var(--red);
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 8px;
  border-radius: 999px;
  background: #edf4ff;
  color: var(--blue);
  font-size: 12px;
  white-space: nowrap;
}

.tag.warn {
  background: #fff3df;
  color: var(--amber);
}

.tag.red {
  background: #fff0ee;
  color: var(--red);
}

.tag.blue {
  background: #edf4ff;
  color: var(--blue);
}

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

.card-grid {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

#servicesList.card-grid,
#hospitalsList.card-grid {
  grid-template-columns: 1fr;
}

.subsection-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
  margin: 24px 0 14px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.subsection-head h2 {
  margin-bottom: 4px;
  font-size: 18px;
}

.list {
  display: grid;
  gap: 10px;
}

.item,
.panel {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.service-admin-card p {
  margin-top: 8px;
  line-height: 1.55;
}

.item-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.form {
  display: grid;
  gap: 12px;
  align-self: start;
}

label {
  display: grid;
  gap: 6px;
  color: #334155;
  font-size: 14px;
}

input,
select,
textarea {
  width: 100%;
  min-height: 38px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(37, 99, 235, 0.16);
  border-color: var(--blue);
}

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

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.security-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 420px);
  gap: 16px;
}

.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(15, 23, 42, 0.42);
  z-index: 20;
}

.modal-card {
  width: min(760px, 100%);
  max-height: min(88vh, 920px);
  overflow: auto;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 28px 70px rgba(15, 23, 42, 0.24);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.form-actions {
  min-width: 0;
}

.drawer {
  position: fixed;
  inset: 0 0 0 auto;
  width: min(560px, 100vw);
  padding: 20px;
  overflow: auto;
  border-left: 1px solid var(--line);
  background: #fff;
  box-shadow: -16px 0 35px rgba(37, 99, 235, 0.14);
  transform: translateX(105%);
  transition: transform 0.2s ease;
  z-index: 5;
}

.drawer.open {
  transform: translateX(0);
}

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

.timeline {
  display: grid;
  gap: 10px;
  margin: 14px 0;
}

.node {
  display: grid;
  gap: 4px;
  padding: 12px;
  border-left: 4px solid var(--line);
  background: #f8fbff;
}

.node.done {
  border-left-color: var(--blue);
}

.node-location {
  padding: 8px 10px;
  border-radius: 8px;
  color: #46606d;
  background: #eef6ff;
  line-height: 1.55;
}

.node-photo-wrap {
  display: grid;
  gap: 6px;
  margin-top: 6px;
}

.node-photo {
  width: 150px;
  height: 96px;
  border-radius: 8px;
  object-fit: cover;
  background: #eef6ff;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  max-width: 360px;
  padding: 12px 14px;
  border-radius: 8px;
  background: #172033;
  color: #fff;
  box-shadow: var(--shadow);
  z-index: 10;
}

.reply-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  margin-top: 12px;
}

.reply-box {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #edf4ff;
  color: #1d4ed8;
}

.message-item-admin p {
  line-height: 1.6;
}

.message-item-admin.pending {
  border-color: #bfdbfe;
  background: #f7fbff;
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.08);
}

.chat-line {
  display: grid;
  gap: 4px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

.chat-line:last-child {
  border-bottom: 0;
}

@media (max-width: 920px) {
  .sidebar {
    position: static;
    width: auto;
  }

  .workspace {
    margin-left: 0;
    padding: 16px;
  }

  .topbar,
  .section-title,
  .two-column,
  .subsection-head,
  .security-grid {
    display: grid;
  }

  .metric-grid {
    grid-template-columns: repeat(2, minmax(130px, 1fr));
  }
}
