:root {
  --ink: #18211d;
  --muted: #52605a;
  --subtle: #6b756f;
  --line: #d7ddd9;
  --line-strong: #aeb9b2;
  --surface: #ffffff;
  --surface-soft: #f3f6f4;
  --surface-deep: #e8eee9;
  --green: #2f6f4e;
  --green-dark: #1e5339;
  --green-soft: #dcebe2;
  --gold: #dcae58;
  --danger: #8f302d;
  --warning: #8a5a19;
  --focus: #1b70c9;
  --font: Inter, "Segoe UI", Arial, sans-serif;
}
* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  color: var(--ink);
  background: var(--surface-soft);
  font-family: var(--font);
}

body {
  min-height: 100vh;
  margin: 0;
}

button,
input {
  font: inherit;
}

a {
  color: inherit;
}

a:focus-visible,
button:focus-visible,
input:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--focus) 55%, transparent);
  outline-offset: 3px;
}

.site-header,
.site-main,
.site-footer,
.admin-main {
  width: min(1120px, calc(100% - 40px));
  margin-inline: auto;
}

.site-header {
  display: flex;
  min-height: 82px;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.brand-mark {
  width: 10px;
  height: 34px;
  border-radius: 3px;
  background: var(--gold);
}

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

.brand strong {
  font-size: 0.94rem;
  letter-spacing: 0.025em;
}

.brand small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.73rem;
}

.button {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  color: var(--ink);
  font-weight: 680;
  text-decoration: none;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  cursor: pointer;
  transition: background-color 180ms ease-out, border-color 180ms ease-out, color 180ms ease-out;
}

.button:hover:not(:disabled) {
  background: var(--surface-deep);
  border-color: #83938a;
}

.button.primary {
  color: #ffffff;
  background: var(--green);
  border-color: var(--green);
}

.button.primary:hover:not(:disabled) {
  background: var(--green-dark);
  border-color: var(--green-dark);
}

.button:disabled {
  color: #7c8680;
  background: #e9edea;
  border-color: #dce1de;
  cursor: wait;
}

.quiet-link {
  color: var(--green-dark);
  font-size: 0.86rem;
  font-weight: 680;
  text-underline-offset: 3px;
}

.site-main {
  padding: 82px 0 96px;
}

.intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 0.8fr);
  align-items: end;
  gap: 64px;
  padding-bottom: 54px;
}

.context-line {
  margin: 0 0 10px;
  color: var(--green-dark);
  font-size: 0.82rem;
  font-weight: 720;
}

h1,
h2,
h3,
p {
  text-wrap: pretty;
}

h1,
h2,
h3 {
  text-wrap: balance;
}

h1 {
  margin: 0;
  font-size: 3.15rem;
  line-height: 1.04;
  letter-spacing: -0.035em;
}

.intro-copy {
  max-width: 54ch;
  margin: 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.65;
}

.catalog {
  background: var(--surface);
  border-top: 3px solid var(--ink);
}

.catalog-header {
  display: flex;
  min-height: 64px;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 0 20px;
  border-bottom: 1px solid var(--line);
}

.catalog-header h2 {
  margin: 0;
  font-size: 1.05rem;
}

.catalog-header span {
  color: var(--muted);
  font-size: 0.8rem;
}

.project-row {
  display: grid;
  grid-template-columns: minmax(220px, 0.7fr) minmax(280px, 1.3fr) minmax(180px, auto);
  align-items: center;
  gap: 30px;
  min-height: 132px;
  padding: 24px 20px;
  border-bottom: 1px solid var(--line);
}

.project-row:last-child {
  border-bottom: 0;
}

.project-heading span {
  color: var(--subtle);
  font-size: 0.75rem;
}

.project-heading h3 {
  margin: 5px 0 0;
  font-size: 1.12rem;
}

.project-row > p {
  max-width: 58ch;
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.55;
}

.project-meta {
  display: flex;
  align-items: flex-end;
  flex-direction: column;
  gap: 9px;
}

.project-meta time {
  color: var(--subtle);
  font-size: 0.72rem;
}

.project-status {
  display: inline-flex;
  min-height: 27px;
  align-items: center;
  padding: 0 10px;
  color: var(--green-dark);
  font-size: 0.74rem;
  font-weight: 720;
  background: var(--green-soft);
  border-radius: 99px;
}

.loading-state,
.error-state {
  margin: 0;
  padding: 32px 20px;
  color: var(--muted);
}

.error-state {
  color: var(--danger);
}

.site-footer {
  display: flex;
  min-height: 72px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  color: var(--subtle);
  font-size: 0.75rem;
  border-top: 1px solid var(--line);
}

.admin-main {
  padding: 68px 0 96px;
}

.login-panel {
  display: grid;
  grid-template-columns: minmax(260px, 0.8fr) minmax(320px, 1fr);
  gap: 72px;
  width: min(780px, 100%);
  margin: 36px auto 0;
  padding: 42px;
  background: var(--surface);
  border-top: 3px solid var(--ink);
}

.login-copy h1,
.workspace-header h1 {
  font-size: 2rem;
  letter-spacing: -0.025em;
}

.login-copy p:last-child,
.workspace-header p:last-child {
  max-width: 52ch;
  margin: 14px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.login-form {
  display: grid;
  align-content: start;
  gap: 8px;
}

.login-form label {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 680;
}

.login-form input {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
}

.login-form .button {
  margin-top: 10px;
}

.form-error {
  margin: 6px 0 0;
  color: var(--danger);
  font-size: 0.82rem;
  line-height: 1.45;
}

.workspace-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 36px;
  padding-bottom: 28px;
}

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

.system-strip {
  display: grid;
  grid-template-columns: auto auto 1fr;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 14px;
  color: var(--muted);
  font-size: 0.78rem;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  border-top: 1px solid var(--line);
}

.system-strip strong {
  color: var(--ink);
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--warning);
}

.system-strip[data-state="ready"] .status-dot {
  background: #2d9b5c;
}

.telephony-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 28px;
  align-items: center;
  margin: 22px 0;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.telephony-control-copy {
  min-width: 0;
}

.telephony-control-title {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  align-items: center;
}

.telephony-control h2,
.telephony-control p {
  margin: 0;
}

.telephony-control h2 {
  font-size: 1.05rem;
}

.telephony-control-copy > p:last-child {
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.5;
}

.telephony-state {
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  padding: 0 9px;
  color: var(--subtle);
  font-size: 0.72rem;
  font-weight: 720;
  background: var(--surface-deep);
  border-radius: 999px;
}

.telephony-control[data-state="accepting"] {
  border-color: #9cc9ae;
  box-shadow: inset 4px 0 0 #2d9b5c;
}

.telephony-control[data-state="accepting"] .telephony-state {
  color: var(--green-dark);
  background: var(--green-soft);
}

.telephony-control[data-state="blocked"],
.telephony-control[data-state="draining"] {
  border-color: #d8c08c;
  box-shadow: inset 4px 0 0 var(--warning);
}

.admin-project-list {
  background: var(--surface);
}

.admin-project-row {
  display: flex;
  min-height: 126px;
  align-items: center;
  justify-content: space-between;
  gap: 36px;
  padding: 24px 20px;
  border-bottom: 1px solid var(--line);
}

.admin-project-title {
  display: flex;
  align-items: center;
  gap: 14px;
}

.admin-project-title h2 {
  margin: 0;
  font-size: 1.05rem;
}

.admin-project-row p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
}

[hidden] {
  display: none !important;
}

@media (max-width: 760px) {
  .site-header,
  .site-main,
  .site-footer,
  .admin-main {
    width: min(100% - 24px, 1120px);
  }

  .site-header {
    min-height: 72px;
  }

  .site-header .button {
    min-height: 38px;
    padding-inline: 12px;
    font-size: 0.78rem;
  }

  .site-main,
  .admin-main {
    padding: 48px 0 64px;
  }

  .intro {
    grid-template-columns: 1fr;
    gap: 24px;
    padding-bottom: 38px;
  }

  h1 {
    font-size: 2.35rem;
  }

  .project-row {
    grid-template-columns: 1fr;
    gap: 14px;
    min-height: 0;
  }

  .project-meta {
    align-items: flex-start;
  }

  .login-panel {
    grid-template-columns: 1fr;
    gap: 30px;
    margin-top: 0;
    padding: 26px 20px;
  }

  .workspace-header,
  .admin-project-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .workspace-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .system-strip {
    grid-template-columns: auto 1fr;
    padding-block: 10px;
  }

  .system-strip > span:last-child {
    grid-column: 2;
  }

  .telephony-control {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .telephony-control .button {
    width: 100%;
  }

  .site-footer {
    align-items: flex-start;
    flex-direction: column;
    justify-content: center;
  }
}

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