:root {
  --primary: #0066cc;
  --success: #00e676;
  --error: #ff1744;
  --ink: #1c1c1e;
  --muted: #8e8e93;
  --canvas: #f2f2f7;
  --surface: #ffffff;
  font-family: Inter, "Source Han Sans", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--canvas);
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

aside {
  background: var(--ink);
  color: white;
  padding: 28px 20px;
}

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

a {
  color: white;
  text-decoration: none;
  padding: 12px;
  border-radius: 8px;
}

a:hover {
  background: rgba(255, 255, 255, 0.12);
}

main {
  padding: 24px;
  display: grid;
  gap: 24px;
  align-content: start;
}

section {
  background: var(--surface);
  border: 1px solid rgba(28, 28, 30, 0.08);
  border-radius: 8px;
  padding: 20px;
}

.admin-login-card {
  grid-column: 1 / -1;
  width: min(460px, calc(100vw - 40px));
  align-self: center;
  justify-self: center;
  padding: 32px;
  box-shadow: 0 18px 48px rgba(28, 28, 30, 0.12);
}

.admin-login-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
}

.admin-login-form input {
  width: 100%;
}

.admin-login-error {
  min-height: 20px;
  color: var(--error);
  margin: 12px 0 0;
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  background: linear-gradient(135deg, #ffffff 0%, #eaf4ff 100%);
}

.eyebrow,
.muted {
  color: var(--muted);
}

h1,
h2,
p {
  margin-top: 0;
}

.metric {
  min-width: 180px;
  border-radius: 8px;
  padding: 16px;
  background: white;
  display: grid;
  align-content: center;
  gap: 4px;
}

.metric span {
  color: var(--primary);
  font-size: 28px;
  font-weight: 700;
}

.section-title,
.grid {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.section-title {
  justify-content: space-between;
  margin-bottom: 16px;
}

input,
select,
textarea,
button {
  min-height: 44px;
  border-radius: 8px;
  border: 1px solid rgba(28, 28, 30, 0.14);
  padding: 10px 12px;
  font: inherit;
}

textarea {
  width: 100%;
  margin-bottom: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.user-search-row,
.message-form {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  gap: 12px;
  margin-bottom: 16px;
}

.message-form textarea,
.message-form button,
.message-form .muted,
.specific-target-area {
  grid-column: 1 / -1;
}

.message-form select,
.message-form input,
.user-search-row input {
  width: 100%;
}

.section-actions {
  display: flex;
  gap: 8px;
}

.secondary-button {
  color: var(--primary);
  background: white;
}

.specific-target-area {
  padding: 14px;
  border: 1px solid rgba(0, 102, 204, 0.2);
  border-radius: 8px;
  background: #f7fbff;
}

.specific-target-area label {
  display: block;
  font-weight: 700;
  margin-bottom: 9px;
}

.selected-user {
  border-radius: 8px;
  padding: 12px;
  color: #064f91;
  background: #dceeff;
  font-weight: 700;
}

.selected-user-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.recipient-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  max-width: 100%;
  border-radius: 999px;
  padding: 7px 8px 7px 12px;
  color: #064f91;
  background: #dceeff;
  font-weight: 700;
}

.recipient-chip span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.recipient-chip small {
  display: block;
  color: #4c708e;
  font-weight: 400;
}

.recipient-chip .remove-recipient {
  min-height: 30px;
  width: 30px;
  padding: 0;
  border-radius: 50%;
}

.form-note {
  grid-column: 1 / -1;
  margin: -4px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.provider-ready {
  color: #087a48;
  background: #e2f7ec;
}

.compact-list {
  margin: -4px 0 20px;
}

.message-body {
  white-space: pre-wrap;
  margin: 6px 0 0;
}

button {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  cursor: pointer;
}

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

.item {
  border: 1px solid rgba(28, 28, 30, 0.1);
  border-radius: 8px;
  padding: 12px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  background: #fff;
}

.pill {
  color: var(--primary);
  background: #eaf4ff;
  border-radius: 999px;
  padding: 4px 10px;
}

@media (max-width: 760px) {
  body {
    grid-template-columns: 1fr;
  }

  aside {
    position: sticky;
    top: 0;
    z-index: 1;
  }

  nav {
    grid-template-columns: repeat(6, max-content);
    overflow-x: auto;
  }

  .hero {
    display: grid;
  }

  .admin-login-form,
  .user-search-row,
  .message-form {
    grid-template-columns: 1fr;
  }

  .message-form > * {
    grid-column: 1;
  }
}
