:root {
  --ink: #1b1633;
  --paper: #f7f1f5;
  --acid: #f26aa3;
  --violet: #665a96;
  --muted: #6e5872;
  --line: rgba(27, 22, 51, 0.2);
  --strong: #1b1633;
}

* {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: Manrope, Arial, sans-serif;
}
button,
input,
textarea,
select {
  font: inherit;
}
button {
  cursor: pointer;
}
.theme-toggle { margin-left: auto; border: 1px solid var(--line); background: transparent; color: var(--ink); padding: 9px 12px; font-size: 11px; }
html[data-theme="dark"] { color-scheme: dark; --ink: #f7f1f5; --paper: #110b24; --acid: #ff5c9b; --violet: #8d82c4; --muted: #bba9c2; --line: rgba(247, 241, 245, 0.2); --strong: #182348; }
html[data-theme="dark"] .panel,
html[data-theme="dark"] input,
html[data-theme="dark"] textarea,
html[data-theme="dark"] select,
html[data-theme="dark"] .message,
html[data-theme="dark"] .inquiry-card,
html[data-theme="dark"] .client-card { background: #211738; color: #f7f1f5; }
html[data-theme="dark"] .primary-button,
html[data-theme="dark"] .project-sidebar,
html[data-theme="dark"] .conversation-panel { background-color: #182348; }
.portal-header {
  height: 82px;
  padding: 0 5vw;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
  font-weight: 800;
}
.brand img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
}
.account-bar {
  display: flex;
  align-items: center;
  gap: 20px;
  font-size: 13px;
}
.account-bar button {
  border: 0;
  border-bottom: 1px solid;
  background: transparent;
  padding: 4px 0;
}
.kicker {
  margin: 0 0 14px;
  font:
    500 11px DM Mono,
    monospace;
  letter-spacing: 0.12em;
  color: var(--muted);
}
.login-view {
  min-height: calc(100vh - 82px);
  padding: 8vw;
  display: grid;
  grid-template-columns: 1fr minmax(320px, 440px);
  gap: 10vw;
  align-items: center;
}
.login-copy h1 {
  margin: 0 0 30px;
  font-size: clamp(58px, 7vw, 104px);
  line-height: 0.92;
  letter-spacing: -0.065em;
}
.login-copy h1 em {
  font-family: Georgia, serif;
  font-weight: 400;
}
.login-copy > p:last-child {
  max-width: 540px;
  color: var(--muted);
  line-height: 1.7;
}
.panel {
  padding: 34px;
  border: 1px solid var(--line);
  background: #faf8f2;
}
.login-panel h2 {
  margin: 0 0 35px;
  font-size: 28px;
}
label {
  display: block;
  margin: 20px 0;
  font:
    500 10px DM Mono,
    monospace;
  letter-spacing: 0.08em;
}
input,
textarea,
select {
  display: block;
  width: 100%;
  margin-top: 9px;
  padding: 13px 0;
  border: 0;
  border-bottom: 1px solid #777;
  outline: 0;
  background: transparent;
  color: inherit;
}
input:focus,
textarea:focus,
select:focus {
  border-color: var(--violet);
}
.primary-button {
  display: flex;
  justify-content: space-between;
  gap: 30px;
  border: 0;
  padding: 14px 17px;
  background: var(--strong);
  color: white;
  font-weight: 700;
}
.login-panel .primary-button {
  width: 100%;
  margin-top: 32px;
}
.form-status {
  min-height: 18px;
  margin: 14px 0 0;
  color: #a42e2e;
  font-size: 12px;
}
.portal-view {
  min-height: calc(100vh - 82px);
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr) 310px;
}
.panel-overview {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 50px;
  align-items: end;
  padding: 48px 5vw;
  border-bottom: 1px solid var(--line);
  background: var(--strong);
  color: var(--paper);
}
.panel-overview h1 {
  margin: 0 0 12px;
  font-size: clamp(38px, 5vw, 70px);
  line-height: 0.95;
  letter-spacing: -0.05em;
}
.panel-overview > div > p:last-child {
  margin: 0;
  color: #aaa;
}
.panel-overview .kicker {
  color: var(--acid);
}
.overview-stats {
  display: flex;
  border: 1px solid #444;
}
.overview-stats article {
  min-width: 112px;
  padding: 20px;
  border-right: 1px solid #444;
}
.overview-stats article:last-child {
  border-right: 0;
}
.overview-stats strong,
.overview-stats span {
  display: block;
}
.overview-stats strong {
  margin-bottom: 7px;
  color: var(--acid);
  font-size: 28px;
}
.overview-stats span {
  color: #aaa;
  font:
    9px DM Mono,
    monospace;
}
.project-sidebar,
.conversation-panel,
.admin-panel,
.account-panel {
  padding: 32px;
  border-right: 1px solid var(--line);
}
.project-sidebar h2 {
  margin: 0 0 30px;
}
.project-list {
  display: grid;
  gap: 8px;
}
.project-button {
  width: 100%;
  padding: 15px;
  text-align: left;
  border: 1px solid transparent;
  background: transparent;
}
.project-button:hover,
.project-button.active {
  border-color: var(--ink);
  background: var(--acid);
}
.project-button strong,
.project-button span {
  display: block;
}
.project-button span {
  margin-top: 6px;
  color: var(--muted);
  font:
    10px DM Mono,
    monospace;
  text-transform: uppercase;
}
.conversation-panel {
  min-width: 0;
}
.conversation-empty {
  min-height: 70vh;
  display: grid;
  place-items: center;
  color: var(--muted);
}
.conversation-header {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
}
.conversation-header h2 {
  margin: 0;
  font-size: 32px;
}
.status-pill {
  align-self: start;
  padding: 7px 10px;
  background: var(--acid);
  font:
    10px DM Mono,
    monospace;
  text-transform: uppercase;
}
.message-list {
  height: calc(100vh - 390px);
  min-height: 280px;
  overflow-y: auto;
  padding: 28px 0;
}
.message {
  width: min(78%, 650px);
  margin-bottom: 18px;
  padding: 16px;
  background: white;
  border: 1px solid var(--line);
}
.message.mine {
  margin-left: auto;
  background: #e7e0ff;
}
.message-meta {
  display: flex;
  justify-content: space-between;
  gap: 15px;
  margin-bottom: 9px;
  color: var(--muted);
  font:
    9px DM Mono,
    monospace;
}
.message p {
  margin: 0;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.message-form {
  border-top: 1px solid var(--line);
}
.message-form textarea {
  min-height: 80px;
  resize: vertical;
}
.message-form > div {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
}
.admin-panel {
  border-right: 0;
}
.account-panel {
  grid-column: 1 / -1;
  border-top: 1px solid var(--line);
  border-right: 0;
}
.account-panel details {
  max-width: 420px;
}
.admin-panel details {
  border-top: 1px solid var(--line);
  padding: 18px 0;
}
.admin-panel summary {
  cursor: pointer;
  font-weight: 700;
}
.inquiry-card {
  margin: 14px 0;
  padding: 14px;
  border: 1px solid var(--line);
  background: white;
}
.inquiry-card h3 {
  margin: 0 0 5px;
  font-size: 14px;
}
.inquiry-card a {
  color: inherit;
  font-size: 12px;
}
.inquiry-card p {
  max-height: 120px;
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 12px;
  line-height: 1.5;
}
.inquiry-card select {
  font-size: 11px;
}
.privacy-copy { color: var(--muted); font-size: 11px; line-height: 1.55; }
.client-directory { display: grid; gap: 10px; margin-top: 15px; }
.maintenance-control { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-top: 15px; }
.maintenance-control > div { min-width: 0; }
.maintenance-control p { color: var(--muted); margin: 5px 0 0; }
.maintenance-indicator { display: inline-block; width: 9px; height: 9px; margin-right: 8px; border-radius: 50%; background: #999; box-shadow: 0 0 0 4px rgba(153,153,153,.12); }
.maintenance-indicator.online { background: #4ea72e; box-shadow: 0 0 0 4px rgba(78,167,46,.14); }
.maintenance-indicator.maintenance { background: #e05a3f; box-shadow: 0 0 0 4px rgba(224,90,63,.14); }
@media (max-width: 620px) { .maintenance-control { align-items: stretch; flex-direction: column; } }
.client-card { padding: 14px; border: 1px solid var(--line); background: white; }
.client-card-top { display: flex; justify-content: space-between; gap: 12px; align-items: start; }
.client-card h3 { margin: 0 0 4px; font-size: 14px; }
.client-card a { color: inherit; font-size: 11px; overflow-wrap: anywhere; }
.client-card-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin: 14px 0; color: var(--muted); font: 9px DM Mono, monospace; }
.client-status { padding: 5px 7px; background: var(--acid); font: 9px DM Mono, monospace; text-transform: uppercase; }
.client-status.inactive { background: #ddd; }
.client-toggle { border: 0; border-bottom: 1px solid; padding: 3px 0; background: transparent; font-size: 11px; }
.empty-state {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

@media (max-width: 1050px) {
  .panel-overview {
    grid-template-columns: 1fr;
  }
  .overview-stats {
    width: max-content;
    max-width: 100%;
    flex-wrap: wrap;
  }
  .portal-view {
    grid-template-columns: 240px 1fr;
  }
  .admin-panel {
    grid-column: 1 / -1;
    border-top: 1px solid var(--line);
  }
}
@media (max-width: 720px) {
  .panel-overview {
    padding: 38px 24px;
  }
  .overview-stats {
    width: 100%;
  }
  .overview-stats article {
    flex: 1;
    min-width: 50%;
    border-bottom: 1px solid #444;
  }
  .login-view {
    grid-template-columns: 1fr;
    padding: 50px 22px;
  }
  .login-copy h1 {
    font-size: 55px;
  }
  .portal-view {
    display: block;
  }
  .project-sidebar,
  .conversation-panel,
  .admin-panel {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 24px;
  }
  .message-list {
    height: 48vh;
  }
}
