:root {
  color-scheme: light;
  --bg: #f3efe6;
  --ink: #1c1917;
  --muted: #78716c;
  --card: #fffdf8;
  --line: #d6d3d1;
  --accent: #0f766e;
  --danger: #b91c1c;
  --shadow: 0 18px 50px rgba(28, 25, 23, 0.08);
  font-family: "Segoe UI", "Helvetica Neue", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(15, 118, 110, 0.12), transparent 40%),
    linear-gradient(180deg, #faf7f0 0%, var(--bg) 100%);
}

.shell {
  width: min(1180px, calc(100% - 2rem));
  margin: 2rem auto 3rem;
}

header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.eyebrow {
  margin: 0 0 0.25rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.75rem;
  color: var(--accent);
  font-weight: 700;
}

h1,
h2 {
  margin: 0;
  line-height: 1.1;
}

h1 {
  font-size: clamp(1.75rem, 4vw, 2.4rem);
}

h2 {
  font-size: 1.25rem;
  margin-bottom: 0.35rem;
}

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 1.25rem 1.35rem 1.5rem;
  box-shadow: var(--shadow);
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: 0.75rem;
}

.lede {
  margin: 0 0 1rem;
  color: var(--muted);
  line-height: 1.5;
}

.lede.compact {
  margin-bottom: 0.5rem;
  font-size: 0.92rem;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.tab {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.55rem 0.95rem;
  font-weight: 600;
}

.tab.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

form {
  display: grid;
  gap: 0.9rem;
}

label {
  display: grid;
  gap: 0.35rem;
  font-size: 0.92rem;
  font-weight: 600;
}

label.row {
  grid-template-columns: 1fr auto;
  align-items: center;
}

input,
textarea,
button {
  font: inherit;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.7rem 0.8rem;
  background: #fff;
  color: var(--ink);
}

textarea {
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.85rem;
  line-height: 1.45;
}

button {
  border: 0;
  border-radius: 999px;
  padding: 0.8rem 1.1rem;
  background: var(--accent);
  color: white;
  font-weight: 700;
  cursor: pointer;
}

button.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}

.error {
  color: var(--danger);
  min-height: 1.25rem;
}

.status {
  min-height: 1.25rem;
  color: var(--accent);
  font-weight: 600;
}

.counts {
  margin: 0 0 0.75rem;
  font-weight: 700;
}

.muted {
  margin-top: 1rem;
  color: var(--muted);
  font-size: 0.85rem;
}

.hidden {
  display: none !important;
}

code {
  font-size: 0.85em;
}

.user-list {
  display: grid;
  gap: 0.85rem;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: auto;
  font-size: 0.82rem;
  line-height: 1.3;
}

.admin-table th,
.admin-table td {
  text-align: left;
  vertical-align: middle;
  padding: 0.4rem 0.55rem;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.admin-table th {
  background: rgba(15, 118, 110, 0.08);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.admin-table tbody tr:hover td {
  background: #fafaf8;
}

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

.admin-table tr.detail-row td {
  background: #fafaf9;
  padding: 0.65rem 0.75rem;
  white-space: normal;
}

.admin-table .name-cell {
  white-space: normal;
  min-width: 160px;
  max-width: 240px;
}

.admin-table .name-cell strong {
  display: block;
  font-size: 0.84rem;
  font-weight: 650;
  line-height: 1.25;
}

.admin-table .name-cell .muted {
  display: block;
  margin: 0.05rem 0 0;
  font-size: 0.72rem;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-table .num-cell,
.admin-table .status-cell {
  width: 1%;
}

.admin-table .actions-cell {
  white-space: nowrap;
  width: 1%;
}

.admin-table .actions-cell .btn-row {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.28rem;
}

.admin-table .actions-cell button.ghost {
  margin: 0;
  padding: 0.18rem 0.5rem;
  font-size: 0.7rem;
  font-weight: 600;
  line-height: 1.2;
  border-radius: 6px;
  min-height: 0;
}

.admin-table .badge {
  font-size: 0.65rem;
  padding: 0.12rem 0.4rem;
}

.pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 0.85rem;
}

.pager .pager-meta {
  color: var(--muted);
  font-size: 0.88rem;
}

.pager .pager-btns {
  display: flex;
  gap: 0.45rem;
}

.pager .ghost {
  padding: 0.4rem 0.75rem;
  font-size: 0.82rem;
}

.pager .ghost:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.user-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.95rem 1rem;
  background: #fff;
}

.user-card-top {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem;
  align-items: baseline;
  margin-bottom: 0.55rem;
}

.user-card h3 {
  margin: 0;
  font-size: 1.05rem;
}

.badge {
  display: inline-block;
  border-radius: 999px;
  padding: 0.2rem 0.55rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.badge.in_call {
  background: #dcfce7;
  color: #166534;
}

.badge.in_queue {
  background: #fef3c7;
  color: #92400e;
}

.badge.recently_active {
  background: #e0e7ff;
  color: #3730a3;
}

.meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.35rem 0.85rem;
  font-size: 0.88rem;
}

.meta-grid span {
  color: var(--muted);
}

.meta-grid strong {
  font-weight: 600;
  color: var(--ink);
}

.package-preview {
  display: grid;
  gap: 0.65rem;
  margin-bottom: 1.1rem;
}

.package-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.75rem 0.9rem;
  background: #fff;
}

.package-card strong {
  display: block;
  margin-bottom: 0.2rem;
}

.package-box {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.9rem 1rem 1rem;
  margin: 0;
}

.package-box legend {
  padding: 0 0.35rem;
  font-weight: 700;
}

.price-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
}

/* Product catalogue tab */
.catalogue-section {
  margin-top: 1.35rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--line);
}

.catalogue-section:first-of-type {
  margin-top: 0.85rem;
  padding-top: 0;
  border-top: 0;
}

.catalogue-h3 {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
}

.catalogue-h4 {
  margin: 1.1rem 0 0.45rem;
  font-size: 0.95rem;
}

.catalogue-intro {
  margin: 0 0 0.85rem;
  font-size: 0.9rem;
  line-height: 1.45;
}

.catalogue-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.75rem;
}

.catalogue-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.85rem 0.95rem;
  background: #fff;
}

.catalogue-card h4 {
  margin: 0 0 0.35rem;
  font-size: 0.95rem;
  color: var(--accent);
}

.catalogue-card p {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.45;
  color: var(--ink);
}

.catalogue-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.catalogue-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
}

.catalogue-table th,
.catalogue-table td {
  text-align: left;
  vertical-align: top;
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid var(--line);
  line-height: 1.4;
}

.catalogue-table th {
  background: rgba(15, 118, 110, 0.08);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

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

.catalogue-table code {
  font-size: 0.8rem;
  background: #f5f5f4;
  padding: 0.1rem 0.35rem;
  border-radius: 6px;
}

.catalogue-note {
  margin-top: 1rem;
  padding: 0.85rem 1rem;
  border-radius: 12px;
  border: 1px dashed var(--line);
  background: rgba(15, 118, 110, 0.06);
  font-size: 0.88rem;
  line-height: 1.5;
}

.catalogue-note code {
  font-size: 0.8rem;
  background: #fff;
  padding: 0.1rem 0.35rem;
  border-radius: 6px;
}
