:root {
  color-scheme: light;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  color: #183a38;
  background: #f2f7f5;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
button, input, select, textarea { font: inherit; }
a { color: #126b63; }

.auth-page { display: grid; place-items: center; padding: 32px 16px; }
.auth-card, .portal-card {
  width: min(100%, 680px);
  padding: 28px;
  border: 1px solid #d6e5df;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 12px 38px #183a3812;
}
.auth-card h1, .portal-header h1 { margin: 12px 0 6px; }
.portal-brand { font-weight: 800; color: #155d55; text-decoration: none; }
.muted { color: #647873; }

.portal-shell { width: min(1120px, calc(100% - 32px)); margin: 36px auto; }
.portal-header, .portal-nav, .portal-card-header, .order-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.portal-header { margin-bottom: 22px; }
.portal-header p { margin: 0; }
.portal-nav { justify-content: flex-start; flex-wrap: wrap; margin: 18px 0; }
.portal-nav a, .button-secondary {
  border: 1px solid #bfd4cc;
  border-radius: 9px;
  padding: 9px 13px;
  color: #155d55;
  background: #fff;
  text-decoration: none;
}
.portal-layout { display: grid; gap: 18px; }
.portal-card { width: 100%; margin-bottom: 18px; }
.portal-card h2 { margin: 0 0 14px; font-size: 1.2rem; }
.portal-card-header { align-items: flex-start; }
.portal-form { display: grid; gap: 14px; }
.portal-form label { display: grid; gap: 6px; font-weight: 650; }
.portal-form input, .portal-form select, .portal-form textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #bdcec8;
  border-radius: 8px;
  background: #fff;
  color: #183a38;
}
.portal-form textarea { min-height: 100px; resize: vertical; }
button {
  border: 0;
  border-radius: 9px;
  padding: 10px 15px;
  color: #fff;
  background: #176a61;
  cursor: pointer;
  font-weight: 700;
}
button:disabled { cursor: wait; opacity: .65; }
.button-secondary { display: inline-block; cursor: pointer; font-weight: 700; }
.notice { min-height: 1.5em; color: #176a61; }
.notice-error { color: #a33232; }
.order-list, .user-list { display: grid; gap: 12px; }
.order-card, .user-row {
  border: 1px solid #d9e5e0;
  border-radius: 12px;
  padding: 16px;
  background: #fbfdfc;
}
.order-card h3 { margin: 0 0 8px; }
.order-card p { margin: 5px 0; }
.order-actions { justify-content: flex-start; flex-wrap: wrap; margin-top: 12px; }
.user-row { display: grid; grid-template-columns: minmax(180px, 1fr) minmax(150px, 220px) auto; align-items: center; gap: 10px; }
.user-row select { padding: 9px; border: 1px solid #bdcec8; border-radius: 8px; }
.empty-state { padding: 18px; border: 1px dashed #bfd4cc; border-radius: 10px; color: #647873; }
.status-pill { display: inline-block; border-radius: 99px; padding: 4px 9px; background: #e2f1eb; color: #155d55; font-size: .85rem; }
.message-thread { margin-top: 18px; padding-top: 14px; border-top: 1px solid #d9e5e0; }
.message-thread h4 { margin: 0 0 10px; }
.message-list { display: grid; gap: 8px; }
.order-message { padding: 10px 12px; border-radius: 9px; background: #edf5f1; }
.order-message p { white-space: pre-wrap; overflow-wrap: anywhere; }
.message-form { display: grid; gap: 9px; margin-top: 12px; }
.message-form label { display: grid; gap: 6px; font-weight: 650; }
.message-form textarea { width: 100%; min-height: 78px; padding: 10px 12px; border: 1px solid #bdcec8; border-radius: 8px; resize: vertical; }
[hidden] { display: none !important; }

@media (max-width: 640px) {
  .portal-header, .portal-card-header { align-items: flex-start; flex-direction: column; }
  .auth-card, .portal-card { padding: 21px; }
  .user-row { grid-template-columns: 1fr; }
}
