:root {
  --wine: #92263b;
  --wine-dark: #721b2d;
  --wine-soft: #f6e6e8;
  --cream: #f3e8d4;
  --paper: #fffdf8;
  --workspace: #f5f4f0;
  --ink: #1f2428;
  --muted: #667078;
  --line: #dfe3e5;
  --line-warm: #ddc9a8;
  --green: #247653;
  --green-dark: #195d40;
  --green-soft: #e5f3ec;
  --yellow: #9a6812;
  --yellow-soft: #fff2cf;
  --red: #a52b3f;
  --red-soft: #fae4e7;
  --shadow-panel: 0 16px 42px rgba(45, 34, 29, 0.14);
  --shadow-float: 0 10px 28px rgba(43, 35, 31, 0.16);
  --radius-sm: 9px;
  --radius-md: 13px;
  --radius-lg: 16px;
  --sidebar-width: 248px;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--workspace);
  color-scheme: light;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select {
  font: inherit;
}

button {
  color: inherit;
}

button,
[role="button"] {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(36, 118, 83, 0.28);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

svg {
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.primary-button,
.refresh-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 44px;
  padding: 10px 16px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 650;
  transition: background-color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.primary-button {
  border: 0;
  background: var(--green);
  color: #fff;
  box-shadow: 0 5px 14px rgba(36, 118, 83, 0.2);
}

.primary-button:hover {
  background: var(--green-dark);
  transform: translateY(-1px);
}

.primary-button:active,
.refresh-button:active {
  transform: translateY(0);
}

.primary-button:disabled,
.refresh-button:disabled {
  cursor: wait;
  opacity: 0.65;
  transform: none;
}

.primary-button svg,
.refresh-button svg {
  width: 18px;
  height: 18px;
}

.primary-button.full {
  width: 100%;
  min-height: 50px;
}

.refresh-button {
  border: 1px solid #cfd5d8;
  background: #fff;
  color: #3e484f;
}

.refresh-button:hover {
  background: #f7f9fa;
  border-color: #b9c2c7;
}

.icon-button {
  display: grid;
  place-items: center;
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: inherit;
  cursor: pointer;
}

.icon-button:hover {
  background: rgba(255, 255, 255, 0.1);
}

.icon-button svg {
  width: 21px;
  height: 21px;
}

/* Authentication */

.auth-body {
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--cream);
}

.auth-layout {
  display: grid;
  grid-template-columns: minmax(360px, 0.92fr) minmax(430px, 1.08fr);
  width: min(100% - 40px, 1080px);
  min-height: min(740px, calc(100vh - 64px));
  margin: 32px auto;
  overflow: hidden;
  border-radius: 20px;
  background: var(--paper);
  box-shadow: var(--shadow-panel);
}

.auth-brand-panel {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 100%;
  padding: 54px 50px;
  background: var(--wine);
  color: #fff;
}

.auth-brand-panel img {
  display: block;
  width: min(100%, 320px);
  height: auto;
  padding: 20px 18px;
  border-radius: 14px;
  background: #fffaf2;
}

.auth-brand-panel p,
.page-kicker,
.modal-header p,
.drawer-header p {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.auth-brand-panel p {
  color: #f3cfd6;
}

.auth-brand-panel h1 {
  max-width: 430px;
  margin: 0;
  font-size: clamp(32px, 4vw, 47px);
  line-height: 1.04;
  letter-spacing: -0.03em;
  text-wrap: balance;
}

.auth-brand-panel span {
  display: block;
  max-width: 430px;
  margin-top: 18px;
  color: #f7e2e6;
  font-size: 16px;
}

.auth-card {
  align-self: center;
  width: min(100% - 64px, 470px);
  margin: 48px auto;
}

.auth-mobile-logo {
  display: none;
}

.page-kicker {
  color: var(--wine);
}

.auth-card h2 {
  margin: 0;
  font-size: clamp(30px, 4vw, 40px);
  line-height: 1.1;
  letter-spacing: -0.025em;
}

.auth-lead {
  max-width: 54ch;
  margin: 9px 0 28px;
  color: var(--muted);
}

.auth-form,
.modal-form {
  display: grid;
  gap: 17px;
}

.field {
  display: grid;
  gap: 6px;
}

.field > span:first-child,
.copy-field > span {
  color: #3f484e;
  font-size: 13px;
  font-weight: 650;
}

.field input,
.field select,
.copy-field input {
  width: 100%;
  min-height: 50px;
  padding: 0 14px;
  border: 1px solid #cbd2d6;
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font-size: 16px;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.field input:hover,
.field select:hover,
.copy-field input:hover {
  border-color: #abb6bb;
}

.field input:focus,
.field select:focus,
.copy-field input:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(36, 118, 83, 0.12);
  outline: 0;
}

.field small,
.form-note {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.password-control {
  position: relative;
  display: block;
}

.password-control input {
  padding-right: 58px;
}

.password-control .password-toggle {
  position: absolute;
  top: 50%;
  right: 4px;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transform: translateY(-50%);
  transition: background-color 150ms ease, color 150ms ease;
}

.password-control .password-toggle:hover {
  background: #edf1f2;
  color: var(--wine);
}

.password-toggle svg {
  grid-area: 1 / 1;
  width: 21px;
  height: 21px;
  pointer-events: none;
}

.password-toggle .eye-off,
.password-toggle.is-visible .eye-open {
  display: none;
}

.password-toggle.is-visible .eye-off {
  display: block;
}

.form-error {
  padding: 11px 12px;
  border-radius: 9px;
  background: var(--red-soft);
  color: #7b2132;
  font-size: 13px;
  font-weight: 600;
}

.auth-help {
  margin: 22px 0 0;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

.invite-loading {
  padding: 36px 0;
  color: var(--muted);
  text-align: center;
}

.invite-invalid h2 {
  margin: 0 0 10px;
}

.invite-invalid p:last-child {
  color: var(--muted);
}

/* App shell */

.app-body {
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  background: var(--workspace);
}

.app-shell {
  min-height: 100vh;
  min-height: 100dvh;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  width: var(--sidebar-width);
  min-height: 100vh;
  padding: 22px 16px 18px;
  background: var(--wine);
  color: #fff;
}

.sidebar-brand {
  display: block;
  padding: 5px 7px 20px;
  color: #fff;
  text-decoration: none;
}

.sidebar-brand img {
  display: block;
  width: 164px;
  max-height: 82px;
  padding: 8px;
  border-radius: 10px;
  background: #fffaf2;
  object-fit: contain;
}

.sidebar-brand span {
  display: block;
  margin-top: 10px;
  color: #f4dce0;
  font-size: 13px;
  font-weight: 600;
}

.side-nav {
  display: grid;
  gap: 6px;
  margin-top: 8px;
}

.nav-item {
  display: grid;
  grid-template-columns: 24px 1fr auto;
  align-items: center;
  gap: 11px;
  min-height: 48px;
  padding: 0 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #f3dfe3;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  text-align: left;
}

.nav-item svg {
  width: 22px;
  height: 22px;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.09);
}

.nav-item.active {
  background: #fffaf2;
  color: var(--wine);
  box-shadow: 0 4px 12px rgba(61, 16, 27, 0.2);
}

.nav-count {
  display: grid;
  place-items: center;
  min-width: 24px;
  height: 24px;
  padding: 0 7px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.18);
  font-size: 11px;
}

.nav-item.active .nav-count {
  background: var(--yellow-soft);
  color: #82550a;
}

.sidebar-user {
  display: grid;
  grid-template-columns: 38px 1fr 40px;
  align-items: center;
  gap: 9px;
  margin-top: auto;
  padding: 13px 8px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.16);
}

.sidebar-user .avatar {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #fffaf2;
  color: var(--wine);
  font-weight: 750;
}

.sidebar-user strong,
.sidebar-user span:not(.avatar) {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-user strong {
  font-size: 13px;
}

.sidebar-user span:not(.avatar) {
  color: #edcbd2;
  font-size: 11px;
}

.workspace {
  min-height: 100vh;
  margin-left: var(--sidebar-width);
  padding: 34px clamp(24px, 4vw, 58px) 58px;
}

.mobile-header,
.mobile-nav {
  display: none;
}

.demo-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  width: min(100%, 1220px);
  margin: 0 auto 20px;
  padding: 10px 13px;
  border: 1px solid #e4c16e;
  border-radius: 10px;
  background: var(--yellow-soft);
  color: #66440c;
  font-size: 13px;
}

.demo-banner strong {
  flex: 0 0 auto;
}

.view {
  width: min(100%, 1220px);
  margin: 0 auto;
}

.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
}

.page-header h1 {
  margin: 0;
  font-size: clamp(27px, 3vw, 36px);
  line-height: 1.1;
  letter-spacing: -0.025em;
}

.page-header p:last-child {
  max-width: 680px;
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.page-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}

.queue-panel,
.access-panel {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: #fff;
  box-shadow: 0 8px 24px rgba(38, 48, 54, 0.06);
}

.queue-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
  padding: 6px;
  border-bottom: 1px solid var(--line);
  background: #e9edef;
}

.queue-tab {
  min-height: 44px;
  padding: 8px 12px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #59646a;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
}

.queue-tab:hover {
  background: rgba(255, 255, 255, 0.52);
}

.queue-tab.active {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 3px 10px rgba(43, 53, 59, 0.1);
}

.queue-tab span {
  display: inline-grid;
  place-items: center;
  min-width: 24px;
  height: 22px;
  margin-left: 5px;
  padding: 0 6px;
  border-radius: 11px;
  background: #dde3e6;
  color: #566067;
  font-size: 11px;
}

.queue-tab[data-status="new"].active span {
  background: var(--yellow-soft);
  color: var(--yellow);
}

.queue-tab[data-status="sent"].active span {
  background: var(--green-soft);
  color: var(--green-dark);
}

.filter-row {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: #f8fafb;
}

.search-field {
  position: relative;
  display: block;
  flex: 1 1 420px;
  min-width: 240px;
}

.search-field > svg {
  position: absolute;
  top: 50%;
  left: 13px;
  width: 19px;
  height: 19px;
  color: #758087;
  transform: translateY(-50%);
}

.search-field input {
  width: 100%;
  min-height: 44px;
  padding: 0 45px 0 42px;
  border: 1px solid #cdd5d8;
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
}

.search-field input:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(36, 118, 83, 0.11);
  outline: 0;
}

.search-field button {
  position: absolute;
  top: 50%;
  right: 7px;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #68737a;
  cursor: pointer;
  font-size: 23px;
  transform: translateY(-50%);
}

.filter-select {
  position: relative;
  display: grid;
  flex: 0 1 250px;
  gap: 4px;
  min-width: 210px;
}

.filter-select > span {
  color: #59646a;
  font-size: 11px;
  font-weight: 650;
}

.filter-select select {
  width: 100%;
  min-height: 44px;
  padding: 0 38px 0 12px;
  border: 1px solid #cdd5d8;
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
}

.filter-select select:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(36, 118, 83, 0.11);
  outline: 0;
}

.queue-error {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 11px 16px;
  border-bottom: 1px solid #edc2c8;
  background: var(--red-soft);
  color: #762236;
  font-size: 12px;
}

.queue-error button {
  flex: 0 0 auto;
  min-height: 40px;
  padding: 7px 12px;
  border: 1px solid #d99da8;
  border-radius: 9px;
  background: #fff;
  color: #762236;
  cursor: pointer;
  font-weight: 650;
}

.request-table-wrap {
  min-height: 320px;
}

.request-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.request-table th {
  padding: 11px 14px;
  background: #eef2f4;
  color: #536068;
  font-size: 12px;
  font-weight: 650;
  text-align: left;
}

.request-table th:nth-child(1) { width: 14%; }
.request-table th:nth-child(2) { width: 24%; }
.request-table th:nth-child(3) { width: 20%; }
.request-table th:nth-child(4) { width: 20%; }
.request-table th:nth-child(5) { width: 17%; }
.request-table th:nth-child(6) { width: 5%; }

.request-table td {
  padding: 13px 14px;
  border-top: 1px solid #edf0f1;
  color: #364148;
  font-size: 13px;
  vertical-align: middle;
}

.request-table tbody tr {
  cursor: pointer;
  transition: background-color 130ms ease;
}

.request-table tbody tr:hover,
.request-table tbody tr:focus-within {
  background: #fbf2e6;
  box-shadow: inset 3px 0 var(--wine);
}

.cell-main,
.cell-secondary {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cell-main {
  color: #20272b;
  font-weight: 600;
}

.cell-secondary {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.open-row {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-left: auto;
  border: 0;
  border-radius: 8px;
  background: #edf1f2;
  color: #556168;
  cursor: pointer;
  font-size: 18px;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 4px 9px;
  border-radius: 7px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.status-badge::before {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  content: "";
}

.status-badge.new {
  background: var(--yellow-soft);
  color: #8a5b0d;
}

.status-badge.sent,
.status-badge.active {
  background: var(--green-soft);
  color: var(--green-dark);
}

.status-badge.blocked {
  background: var(--red-soft);
  color: #8c2638;
}

.status-badge.owner {
  background: var(--wine-soft);
  color: var(--wine);
}

.mobile-request-list {
  display: none;
}

.empty-state {
  display: grid;
  place-items: center;
  align-content: center;
  min-height: 320px;
  padding: 36px;
  text-align: center;
}

.empty-state svg {
  width: 58px;
  height: 58px;
  margin-bottom: 12px;
  color: #9aa5aa;
}

.empty-state strong {
  font-size: 17px;
}

.empty-state span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

/* Request drawer */

.drawer-backdrop,
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(23, 28, 31, 0.42);
}

.request-drawer {
  position: fixed;
  inset: 0 0 0 auto;
  z-index: 80;
  display: flex;
  flex-direction: column;
  width: min(100%, 470px);
  background: #fff;
  box-shadow: -18px 0 46px rgba(23, 28, 31, 0.19);
  transform: translateX(104%);
  transition: transform 210ms cubic-bezier(0.2, 0.75, 0.25, 1);
}

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

.drawer-header,
.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.drawer-header {
  padding: 20px 22px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--wine);
  color: #fff;
}

.drawer-header p {
  color: #f0cbd2;
}

.drawer-header h2,
.modal-header h2 {
  margin: 0;
  font-size: 22px;
  line-height: 1.15;
  letter-spacing: -0.015em;
}

.drawer-header .icon-button,
.modal-header .icon-button {
  font-size: 28px;
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 22px;
}

.drawer-person {
  margin-bottom: 22px;
}

.drawer-person h3 {
  margin: 0;
  font-size: 23px;
  line-height: 1.2;
  letter-spacing: -0.018em;
}

.drawer-person p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.detail-section {
  margin-top: 24px;
}

.detail-section > h3 {
  margin: 0 0 10px;
  font-size: 15px;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--line);
}

.detail-item {
  min-width: 0;
  padding: 13px;
  background: #fff;
}

.detail-item.wide {
  grid-column: 1 / -1;
}

.detail-item span,
.history-line span {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.detail-item strong {
  display: block;
  margin-top: 4px;
  overflow-wrap: anywhere;
  color: #293238;
  font-size: 14px;
  font-weight: 650;
}

.detail-item a {
  color: var(--wine);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.status-choice {
  display: grid;
  gap: 8px;
}

.status-option {
  display: grid;
  grid-template-columns: 20px 1fr auto;
  align-items: center;
  gap: 11px;
  min-height: 58px;
  padding: 10px 12px;
  border: 1px solid #d7dde0;
  border-radius: 11px;
  background: #fff;
  cursor: pointer;
  text-align: left;
}

.status-option:hover {
  border-color: #aab5ba;
  background: #fafbfb;
}

.status-option[data-status="sent"][aria-pressed="true"] {
  border-color: var(--green);
  background: var(--green-soft);
  box-shadow: 0 0 0 2px rgba(36, 118, 83, 0.11);
}

.status-option[data-status="new"][aria-pressed="true"] {
  border-color: #d59a2c;
  background: var(--yellow-soft);
  box-shadow: 0 0 0 2px rgba(154, 104, 18, 0.12);
}

.status-option .radio-mark {
  display: grid;
  place-items: center;
  width: 19px;
  height: 19px;
  border: 2px solid #aeb8bd;
  border-radius: 50%;
}

.status-option[data-status="sent"][aria-pressed="true"] .radio-mark {
  border-color: var(--green);
}

.status-option[data-status="sent"][aria-pressed="true"] .radio-mark::after {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--green);
  content: "";
}

.status-option[data-status="new"][aria-pressed="true"] .radio-mark {
  border-color: var(--yellow);
}

.status-option[data-status="new"][aria-pressed="true"] .radio-mark::after {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--yellow);
  content: "";
}

.status-option strong,
.status-option small {
  display: block;
}

.status-option strong {
  font-size: 13px;
}

.status-option small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.status-option .saving {
  color: var(--green);
  font-size: 11px;
  font-weight: 700;
}

.status-option[data-status="new"] .saving {
  color: var(--yellow);
}

.history-line {
  padding: 11px 12px;
  border-radius: 10px;
  background: #f2f5f6;
}

.history-line strong {
  display: block;
  margin-top: 3px;
  font-size: 12px;
  font-weight: 600;
}

.danger-zone {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 20px;
  border-top: 1px solid #efcbd1;
}

.danger-zone h3,
.danger-zone p {
  margin: 0;
}

.danger-zone p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.delete-request-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid #d99da8;
  border-radius: 9px;
  background: #fff;
  color: #8d2437;
  cursor: pointer;
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
}

.delete-request-button:hover {
  background: var(--red-soft);
}

.delete-request-button svg {
  width: 18px;
  height: 18px;
}

/* Access */

.access-intro {
  display: flex;
  align-items: baseline;
  gap: 14px;
  padding: 15px 17px;
  border-bottom: 1px solid var(--line);
  background: #eef2f4;
}

.access-intro strong {
  font-size: 14px;
}

.access-intro span {
  color: var(--muted);
  font-size: 12px;
}

.user-list,
.pending-list {
  display: grid;
}

.user-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
}

/* Security */

.security-panel {
  width: min(100%, 650px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: #fff;
  box-shadow: 0 8px 24px rgba(38, 48, 54, 0.06);
}

.security-form {
  display: grid;
  gap: 17px;
  padding: 24px;
}

.security-form h2,
.security-form p {
  margin: 0;
}

.security-form h2 {
  font-size: 20px;
}

.security-form p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
}

.security-form > .primary-button {
  justify-self: start;
  min-width: 220px;
}

.user-row,
.pending-row {
  display: grid;
  grid-template-columns: 42px minmax(180px, 1fr) minmax(150px, 0.7fr) auto auto;
  align-items: center;
  gap: 14px;
  min-height: 72px;
  padding: 12px 17px;
  border-top: 1px solid #edf0f1;
}

.user-row:first-child {
  border-top: 0;
}

.user-avatar {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--wine-soft);
  color: var(--wine);
  font-size: 14px;
  font-weight: 750;
}

.user-main strong,
.user-main span,
.user-meta strong,
.user-meta span {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-main strong,
.user-meta strong {
  font-size: 13px;
  font-weight: 650;
}

.user-main span,
.user-meta span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.secondary-button,
.danger-button {
  min-height: 44px;
  padding: 7px 11px;
  border-radius: 9px;
  background: #fff;
  cursor: pointer;
  font-size: 12px;
  font-weight: 650;
}

.secondary-button {
  border: 1px solid #b7c1c6;
  color: #47535a;
}

.secondary-button:hover {
  background: #f3f6f7;
}

.danger-button {
  border: 1px solid #e0aab3;
  color: #8d2437;
}

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

.pending-section {
  padding: 20px 17px 8px;
  border-top: 1px solid var(--line);
  background: #fafbfb;
}

.pending-section h2 {
  margin: 0 0 8px;
  font-size: 16px;
}

.pending-row {
  grid-template-columns: 42px minmax(180px, 1fr) minmax(150px, 0.7fr) auto;
  padding-inline: 0;
}

/* Modal and toast */

.modal-backdrop {
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 18px;
}

.modal {
  width: min(100%, 480px);
  max-height: calc(100vh - 36px);
  max-height: calc(100dvh - 36px);
  overflow-y: auto;
  border-radius: var(--radius-lg);
  background: #fff;
  box-shadow: var(--shadow-float);
}

.modal-header {
  padding: 19px 20px 16px;
  border-bottom: 1px solid var(--line);
}

.modal-header p {
  color: var(--wine);
}

.modal-header .icon-button:hover {
  background: #edf1f2;
}

.modal-form,
.invite-result {
  padding: 20px;
}

.invite-result {
  text-align: center;
}

.success-mark {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin: 0 auto 12px;
  border-radius: 50%;
  background: var(--green-soft);
  color: var(--green);
  font-size: 25px;
  font-weight: 800;
}

.invite-result h3 {
  margin: 0;
  font-size: 22px;
}

.invite-result > p {
  margin: 5px 0 18px;
  color: var(--muted);
  font-size: 13px;
}

.modal-lead {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.message-preview {
  min-height: 112px;
  padding: 13px 14px;
  border: 1px solid var(--line-warm);
  border-radius: 10px;
  background: #fffaf2;
  color: #3e4245;
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.copy-field {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
  text-align: left;
}

.toast-region {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 140;
  display: grid;
  gap: 8px;
  width: min(calc(100% - 36px), 360px);
}

.toast {
  padding: 12px 14px;
  border-radius: 10px;
  background: #253039;
  color: #fff;
  box-shadow: var(--shadow-float);
  font-size: 13px;
  animation: toast-in 200ms ease-out;
}

.toast.error {
  background: #85283a;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 980px) {
  :root { --sidebar-width: 220px; }

  .workspace {
    padding-inline: 24px;
  }

  .request-table th:nth-child(3),
  .request-table td:nth-child(3) {
    display: none;
  }

  .request-table th:nth-child(1) { width: 17%; }
  .request-table th:nth-child(2) { width: 29%; }
  .request-table th:nth-child(4) { width: 25%; }
  .request-table th:nth-child(5) { width: 23%; }
  .request-table th:nth-child(6) { width: 6%; }

  .user-row {
    grid-template-columns: 42px minmax(150px, 1fr) auto auto;
  }

  .user-meta {
    display: none;
  }
}

@media (max-width: 759px) {
  .auth-layout {
    display: block;
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    margin: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .auth-brand-panel {
    display: none;
  }

  .auth-card {
    width: min(100% - 36px, 470px);
    margin: 0 auto;
    padding: max(24px, env(safe-area-inset-top)) 0 max(28px, env(safe-area-inset-bottom));
  }

  .auth-mobile-logo {
    display: block;
    margin-bottom: 32px;
    padding-bottom: 22px;
    border-bottom: 1px solid var(--line-warm);
  }

  .auth-mobile-logo img {
    display: block;
    width: min(100%, 270px);
    height: auto;
  }

  .auth-card h2 {
    font-size: 31px;
  }

  .app-body {
    padding-bottom: calc(69px + env(safe-area-inset-bottom));
  }

  .sidebar {
    display: none;
  }

  .mobile-header {
    position: sticky;
    top: 0;
    z-index: 30;
    display: grid;
    grid-template-columns: 86px 1fr 40px;
    align-items: center;
    gap: 10px;
    min-height: 66px;
    padding: max(8px, env(safe-area-inset-top)) 13px 8px;
    border-bottom: 1px solid var(--line-warm);
    background: rgba(255, 250, 242, 0.97);
    color: var(--ink);
  }

  .mobile-header img {
    display: block;
    width: 82px;
    max-height: 44px;
    object-fit: contain;
  }

  .mobile-header strong,
  .mobile-header span {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-header strong {
    font-size: 13px;
  }

  .mobile-header span {
    margin-top: 2px;
    color: var(--muted);
    font-size: 11px;
  }

  .mobile-header .icon-button:hover {
    background: #edf1f2;
  }

  .workspace {
    min-height: auto;
    margin-left: 0;
    padding: 18px 12px 30px;
  }

  .demo-banner {
    align-items: flex-start;
    gap: 4px;
    margin-bottom: 16px;
    padding: 10px 12px;
    flex-direction: column;
  }

  .page-header {
    align-items: flex-start;
    margin-bottom: 16px;
  }

  .page-header h1 {
    font-size: 27px;
  }

  .page-header p:last-child {
    font-size: 13px;
  }

  .refresh-button {
    width: 44px;
    padding: 0;
    flex: 0 0 44px;
  }

  .refresh-button svg {
    width: 20px;
    height: 20px;
  }

  .refresh-button {
    font-size: 0;
  }

  .queue-panel,
  .access-panel {
    border-radius: 14px;
  }

  .queue-tabs {
    gap: 4px;
    padding: 5px;
  }

  .queue-tab {
    min-width: 0;
    min-height: 48px;
    padding: 6px 5px;
    font-size: 11px;
    line-height: 1.15;
  }

  .queue-tab span {
    min-width: 20px;
    height: 20px;
    margin-left: 2px;
    padding: 0 5px;
    font-size: 10px;
  }

  .filter-row {
    display: grid;
    grid-template-columns: 1fr;
    padding: 11px;
  }

  .search-field,
  .filter-select {
    width: 100%;
    min-width: 0;
  }

  .search-field input {
    min-height: 46px;
    font-size: 16px;
  }

  .request-table {
    display: none;
  }

  .mobile-request-list {
    display: grid;
  }

  .request-card {
    display: grid;
    gap: 11px;
    width: 100%;
    padding: 15px;
    border: 0;
    border-top: 1px solid #edf0f1;
    background: #fff;
    color: inherit;
    cursor: pointer;
    text-align: left;
  }

  .request-card:first-child {
    border-top: 0;
  }

  .request-card:active {
    background: #faf8f3;
  }

  .request-card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
  }

  .request-card-top strong {
    min-width: 0;
    font-size: 15px;
    line-height: 1.25;
  }

  .request-card-top .status-badge {
    flex: 0 0 auto;
  }

  .request-card-meta {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px 14px;
  }

  .request-card-meta span {
    display: block;
    min-width: 0;
    overflow: hidden;
    color: var(--muted);
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .request-card-meta b {
    display: block;
    margin-top: 2px;
    overflow: hidden;
    color: #38434a;
    font-size: 12px;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-nav {
    position: fixed;
    inset: auto 0 0;
    z-index: 35;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    min-height: calc(64px + env(safe-area-inset-bottom));
    padding: 5px 8px env(safe-area-inset-bottom);
    border-top: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 -8px 22px rgba(37, 46, 51, 0.08);
  }

  .mobile-nav:has(.mobile-nav-item[hidden]) {
    grid-template-columns: repeat(2, 1fr);
  }

  .mobile-nav-item {
    position: relative;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 2px;
    min-height: 54px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: #68737a;
    cursor: pointer;
    font-size: 10px;
    font-weight: 650;
  }

  .mobile-nav-item svg {
    width: 22px;
    height: 22px;
  }

  .mobile-nav-item.active {
    background: var(--wine-soft);
    color: var(--wine);
  }

  .mobile-nav-item b {
    position: absolute;
    top: 5px;
    left: calc(50% + 10px);
    display: grid;
    place-items: center;
    min-width: 19px;
    height: 19px;
    padding: 0 5px;
    border-radius: 10px;
    background: var(--yellow-soft);
    color: #82550a;
    font-size: 9px;
  }

  .request-drawer {
    top: max(0px, env(safe-area-inset-top));
    width: 100%;
  }

  .drawer-header {
    padding: 16px 16px 14px;
  }

  .drawer-header h2 {
    font-size: 20px;
  }

  .drawer-body {
    padding: 18px 16px calc(22px + env(safe-area-inset-bottom));
  }

  .drawer-person h3 {
    font-size: 21px;
  }

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

  .detail-item.wide {
    grid-column: auto;
  }

  .page-actions {
    gap: 7px;
  }

  .page-header .primary-button {
    flex: 0 0 48px;
    width: 48px;
    min-height: 48px;
    padding: 0;
    font-size: 0;
  }

  .access-intro {
    display: grid;
    gap: 3px;
  }

  .user-row,
  .pending-row {
    grid-template-columns: 40px minmax(0, 1fr) auto;
    gap: 10px;
    min-height: 78px;
    padding: 12px;
  }

  .user-meta,
  .pending-row > .status-badge {
    display: none;
  }

  .user-row > .user-avatar {
    grid-column: 1;
    grid-row: 1 / span 2;
  }

  .user-row > .user-main {
    grid-column: 2;
    grid-row: 1;
  }

  .user-row > .status-badge {
    display: inline-flex;
    grid-column: 2;
    grid-row: 2;
    justify-self: start;
  }

  .user-row > .secondary-button,
  .user-row > .danger-button {
    grid-column: 3;
    grid-row: 1 / span 2;
    align-self: center;
  }

  .user-row > .user-actions {
    display: grid;
    grid-column: 3;
    grid-row: 1 / span 2;
    align-self: center;
    gap: 6px;
  }

  .user-row .secondary-button,
  .user-row .danger-button,
  .pending-row .danger-button {
    min-width: 76px;
  }

  .user-actions .secondary-button,
  .user-actions .danger-button {
    min-width: 92px;
  }

  .security-form {
    padding: 18px 15px;
  }

  .security-form > .primary-button {
    width: 100%;
    min-width: 0;
  }

  .danger-zone {
    align-items: stretch;
    flex-direction: column;
  }

  .delete-request-button {
    width: 100%;
  }

  .pending-section {
    padding-inline: 12px;
  }

  .modal-backdrop {
    align-items: end;
    padding: 0;
  }

  .modal {
    width: 100%;
    max-height: calc(100dvh - 24px);
    border-radius: 18px 18px 0 0;
    padding-bottom: env(safe-area-inset-bottom);
  }

  .toast-region {
    right: 12px;
    bottom: calc(78px + env(safe-area-inset-bottom));
    width: calc(100% - 24px);
  }
}

@media (max-width: 370px) {
  .workspace {
    padding-inline: 8px;
  }

  .queue-tab {
    font-size: 10px;
  }

  .queue-tab span {
    display: none;
  }

  .queue-error {
    align-items: stretch;
    flex-direction: column;
  }

  .mobile-header {
    grid-template-columns: 76px 1fr 40px;
  }

  .mobile-header img {
    width: 72px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
