:root {
  --paper: #f6f2e7;
  --ink: #1a1b1d;
  --accent: #ff6b35;
  --accent-2: #205676;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: "IBM Plex Sans", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 20% 20%, rgba(38, 61, 65, 0.34), transparent 40%),
    radial-gradient(circle at 80% 70%, rgba(57, 91, 84, 0.34), transparent 35%),
    rgb(38, 61, 65);
}

body.login-page {
  background: rgb(38, 61, 65);
}

.portal-main {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.2rem;
}

.portal-stack {
  width: min(1100px, 96vw);
  display: grid;
  justify-items: center;
  gap: 1rem;
}

.portal-top-logo {
  width: min(340px, 78vw);
  height: auto;
  object-fit: contain;
}

.portal-card {
  width: min(1100px, 96vw);
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 16px;
  padding: 1rem;
  backdrop-filter: blur(4px);
}

h1 { margin: 0 0 0.8rem; }
h2 { margin: 0 0 0.55rem; font-size: 1.1rem; }

.portal-grid {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 1rem;
  min-height: 320px;
}

.portal-col {
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 12px;
  padding: 0.8rem;
}

.portal-col-action {
  display: grid;
  place-items: center;
}

.workspace-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
}

.workspace-actions {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  flex-wrap: wrap;
}

.workspace-section + .workspace-section {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.auth-card {
  width: min(520px, 96vw);
}

.login-layout {
  width: min(980px, 96vw);
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 1.2rem;
  align-items: center;
}

.login-left.auth-card {
  width: 100%;
}

.login-right {
  display: grid;
  place-items: center;
  min-height: 300px;
}

.login-logo {
  width: min(420px, 100%);
  height: auto;
  object-fit: contain;
}

.auth-actions {
  justify-content: flex-end;
}

.auth-inline-actions {
  display: flex;
  justify-content: flex-end;
}

.text-link-btn {
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--accent-2);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
}

.text-link-btn:hover {
  color: #163b52;
}

.login-signup-divider {
  height: 1px;
  margin: 1.1rem 0 0.95rem;
  background: rgba(0, 0, 0, 0.12);
}

.login-signup-prompt {
  display: grid;
  gap: 0.7rem;
  justify-items: start;
}

.login-signup-prompt p {
  margin: 0;
}

.signup-modal-card {
  width: min(760px, 100%);
}

.signup-grid-row {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.project-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.5rem;
}

.project-item-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.project-item-btn {
  flex: 1;
  border: 1px solid rgba(0,0,0,0.12);
  border-radius: 10px;
  padding: 0.65rem;
  background: rgba(255,255,255,0.9);
  text-align: left;
  cursor: pointer;
}

.project-item-btn:hover { background: #fff; }

.admin-btn {
  white-space: nowrap;
  border: 1px solid rgba(0,0,0,0.18);
  border-radius: 999px;
  padding: 0.45rem 0.85rem;
  background: rgba(255,255,255,0.9);
  font-family: inherit;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  color: var(--accent-2);
}

.admin-btn:hover { background: #fff; }

.export-btn {
  white-space: nowrap;
  border: 1px solid rgba(0,0,0,0.18);
  border-radius: 999px;
  padding: 0.45rem 0.85rem;
  background: rgba(255,255,255,0.9);
  font-family: inherit;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  color: #1f6f43;
}

.export-btn:hover { background: #fff; }

.muted { color: rgba(0,0,0,0.55); }

.primary-btn,
.secondary-btn {
  border: 0;
  border-radius: 999px;
  padding: 0.6rem 1rem;
  font-weight: 600;
  cursor: pointer;
}

.primary-btn {
  background: var(--accent);
  color: #fff;
}

.secondary-btn {
  background: rgba(0,0,0,0.1);
  color: var(--ink);
}

.form-card { width: min(980px, 96vw); }

.project-form { display: grid; gap: 0.9rem; }
.field { display: grid; gap: 0.35rem; }
.field input { border: 1px solid rgba(0,0,0,0.18); border-radius: 10px; padding: 0.45rem 0.55rem; font: inherit; }
.field select {
  border: 1px solid rgba(0,0,0,0.18);
  border-radius: 10px;
  padding: 0.45rem 0.55rem;
  font: inherit;
  background: #fff;
}
.field textarea {
  border: 1px solid rgba(0,0,0,0.18);
  border-radius: 10px;
  padding: 0.45rem 0.55rem;
  font: inherit;
  resize: vertical;
  width: 100%;
}

.field-row { display: grid; grid-template-columns: 1fr 220px; gap: 0.8rem; }
.settings-password-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.settings-contact-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.discipline-trade-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.settings-profile-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.settings-profile-row { align-items: start; }
.field-subset {
  border-left: 2px solid rgba(0,0,0,0.12);
  padding-left: 0.7rem;
}
.field-subset-disabled {
  opacity: 0.75;
}
.field-subset-disabled input {
  background: rgba(255,255,255,0.7);
}

.settings-page-card {
  width: min(920px, 96vw);
}

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

.settings-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}

.settings-section {
  display: grid;
  gap: 0.9rem;
}

.settings-meta {
  display: grid;
  gap: 0.2rem;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(14, 21, 23, 0.45);
  display: grid;
  place-items: center;
  padding: 1rem;
  z-index: 1000;
}

.modal-backdrop[hidden] {
  display: none;
}

.modal-card {
  width: min(520px, 100%);
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 16px;
  padding: 1rem;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.16);
}

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

.modal-close-btn {
  border: 0;
  background: transparent;
  color: rgba(0, 0, 0, 0.6);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}

.modal-close-btn:hover {
  color: rgba(0, 0, 0, 0.85);
}

.discipline-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.35rem 0.8rem;
}

.discipline-option { display: flex; align-items: center; gap: 0.4rem; font-size: 0.92rem; }

.custom-discipline-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.65rem;
  margin-top: 0.8rem;
}

.custom-discipline-row input {
  border: 1px solid rgba(0,0,0,0.18);
  border-radius: 10px;
  padding: 0.45rem 0.55rem;
  font: inherit;
}

.import-field {
  padding: 0.6rem 0.7rem;
  border: 1px dashed rgba(0,0,0,0.2);
  border-radius: 10px;
  background: rgba(255,255,255,0.55);
}

.csv-status {
  min-height: 1.1rem;
  font-size: 0.82rem;
  color: rgba(0,0,0,0.62);
}

.csv-status.error {
  color: #8f1d1d;
  font-weight: 600;
}

.csv-status.success {
  color: #166534;
  font-weight: 600;
}

.csv-upload-actions {
  display: flex;
  gap: 0.65rem;
  flex-wrap: wrap;
  margin-top: 0.35rem;
}

.csv-file-name {
  font-size: 0.88rem;
}

.danger-btn {
  background: rgba(143, 29, 29, 0.1);
  color: #8f1d1d;
}

.danger-btn:hover {
  background: rgba(143, 29, 29, 0.16);
}

.secondary-btn:disabled,
.primary-btn:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.field-hint {
  font-size: 0.82rem;
  color: rgba(0,0,0,0.5);
  margin-top: -0.15rem;
}

.team-email-input {
  resize: vertical;
}

.team-rows {
  display: grid;
  gap: 0.35rem;
  margin-top: 0.5rem;
}

.email-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.42rem 0.65rem;
  background: rgba(255,255,255,0.72);
  border: 1px solid rgba(0,0,0,0.1);
  border-radius: 8px;
}

.email-label {
  flex: 1;
  font-size: 0.9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.email-row .team-discipline {
  flex-shrink: 0;
  border: 1px solid rgba(0,0,0,0.18);
  border-radius: 8px;
  padding: 0.38rem 0.42rem;
  font: inherit;
  min-width: 160px;
}

.actions-row { display: flex; justify-content: space-between; align-items: center; }
.secondary-link { color: var(--accent-2); text-decoration: none; font-weight: 600; }
.action-link {
  display: inline-flex;
  align-items: center;
  min-height: 2.3rem;
}

.readonly-block {
  opacity: 0.72;
}

.admin-summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.admin-section-block {
  margin-top: 1rem;
}

.stats-list {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.stat-pill {
  min-width: 120px;
  padding: 0.75rem 0.9rem;
  border-radius: 12px;
  background: rgba(255,255,255,0.82);
  border: 1px solid rgba(0,0,0,0.08);
  display: grid;
  gap: 0.2rem;
}

.stat-pill strong {
  font-size: 1.2rem;
}

.stat-pill span {
  color: rgba(0,0,0,0.6);
  font-size: 0.85rem;
}

.project-admin-row {
  align-items: stretch;
}

.project-admin-card {
  flex: 1;
  display: grid;
  gap: 0.2rem;
  padding: 0.75rem 0.85rem;
  border: 1px solid rgba(0,0,0,0.12);
  border-radius: 10px;
  background: rgba(255,255,255,0.9);
}

@media (max-width: 900px) {
  .portal-grid { grid-template-columns: 1fr; }
  .admin-summary-grid { grid-template-columns: 1fr; }
  .discipline-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .custom-discipline-row { grid-template-columns: 1fr; }
  .field-row { grid-template-columns: 1fr; }
  .login-layout { grid-template-columns: 1fr; }
  .login-right { min-height: 180px; }
  .login-logo { width: min(300px, 88%); }
  .settings-card-header { flex-direction: column; }
  .portal-top-logo { width: min(260px, 70vw); }
  .signup-grid-row { grid-template-columns: 1fr; }
}

/* Wizard styles */
.wizard-card {
  position: relative;
}

.wizard-progress {
  display: flex;
  gap: 2rem;
  justify-content: center;
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.progress-step {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.9rem;
  color: rgba(0, 0, 0, 0.5);
  text-decoration: none;
  cursor: pointer;
  transition: color 0.2s;
}

.progress-step:hover {
  color: rgba(0, 0, 0, 0.7);
}

.progress-step.active {
  color: var(--accent);
  font-weight: 600;
}

.step-number {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.08);
  font-weight: 600;
  font-size: 0.85rem;
}

.progress-step.active .step-number {
  background: var(--accent);
  color: #fff;
}

.wizard-form {
  display: grid;
  gap: 0.9rem;
}

.wizard-page {
  display: none;
}

.wizard-page.active {
  display: grid;
  gap: 0.9rem;
}

.wizard-page h1 {
  font-size: 1.3rem;
  margin-bottom: 1.2rem;
}

/* Deliverables styles */
.deliverable-types {
  display: grid;
  gap: 0.8rem;
  margin-bottom: 1.5rem;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.5);
  border-radius: 10px;
}

.deliverable-option {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  cursor: pointer;
  padding: 0.6rem;
  border-radius: 8px;
  transition: background 0.2s;
}

.deliverable-option:hover {
  background: rgba(255, 255, 255, 0.7);
}

.deliverable-option input[type="radio"] {
  margin-top: 0.3rem;
}

.deliverable-option span {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.deliverable-option strong {
  font-weight: 600;
}

.deliverable-option small {
  color: rgba(0, 0, 0, 0.6);
  font-size: 0.85rem;
}

.deliverable-section {
  padding: 1rem;
  background: rgba(255, 255, 255, 0.5);
  border-radius: 10px;
  display: grid;
  gap: 0.9rem;
}

.individual-deliverables-list {
  display: grid;
  gap: 0.8rem;
}

.deliverable-item {
  padding: 0.8rem;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 8px;
}

.deliverable-item .field {
  gap: 0.25rem;
}

.deliverable-item span:first-child {
  font-weight: 600;
  font-size: 0.95rem;
}

.deliverable-input-group {
  display: flex;
  gap: 0.6rem;
  margin-top: 0.5rem;
}

.deliverable-type-select {
  min-width: 160px;
  border: 1px solid rgba(0, 0, 0, 0.18);
  border-radius: 8px;
  padding: 0.38rem 0.42rem;
  font: inherit;
  background: white;
  cursor: pointer;
}

.deliverable-name-input {
  flex: 1;
  border: 1px solid rgba(0, 0, 0, 0.18);
  border-radius: 8px;
  padding: 0.45rem 0.55rem;
  font: inherit;
}

.deliverable-name-input:disabled {
  background: rgba(0, 0, 0, 0.05);
  color: rgba(0, 0, 0, 0.5);
}
