:root {
  --ink: #111111;
  --ink-muted: #4f4f4f;
  --panel: #ffffff;
  --card: #ffffff;
  --line: #d8d8d8;
  --brand: #111111;
  --brand-dark: #000000;
  --danger: #a73434;
  --danger-dark: #7f2323;
  --ok: #2a6b32;
  --shadow: 0 20px 45px -34px rgba(0, 0, 0, 0.36);
  --radius: 16px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Source Serif 4", "Adobe Caslon Pro", Georgia, serif;
  color: var(--ink);
  background:
    radial-gradient(900px 420px at 8% -8%, #ece8db 0%, transparent 60%),
    radial-gradient(780px 360px at 95% 2%, #f3efe4 0%, transparent 50%),
    linear-gradient(160deg, #f5f4f0 0%, #f8f7f3 42%, #fcfcfa 100%);
  padding: 20px;
}

.auth-shell {
  max-width: 1120px;
  margin: 0 auto;
  animation: fadeIn 420ms ease;
}

.auth-layout {
  display: grid;
  grid-template-columns: 1fr 440px;
  gap: 18px;
  align-items: stretch;
}

.auth-hero {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  display: grid;
  align-content: center;
  gap: 10px;
}

.auth-hero h1 {
  margin-top: 6px;
}

.auth-main-card {
  margin-bottom: 0;
  padding: 16px;
  box-shadow: var(--shadow);
  background: #ffffff;
}

.dashboard-shell {
  max-width: 1240px;
  margin: 0 auto;
}

.app {
  max-width: 1240px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 18px;
  animation: fadeIn 450ms ease;
}

.sidebar {
  background: #ffffff;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  position: sticky;
  top: 18px;
  height: fit-content;
}

.brand-wrap {
  border-bottom: 1px solid var(--line);
  margin-bottom: 12px;
  padding-bottom: 12px;
}

.brand-home {
  display: block;
}

.brand-logo {
  display: block;
  width: 100%;
  max-width: 210px;
  border-radius: 8px;
  border: 1px solid var(--line);
  margin-bottom: 9px;
}

.portal-link {
  font-size: 0.82rem;
  color: var(--brand);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}

.portal-link:hover {
  border-bottom-color: var(--brand);
}

.brand {
  font-family: "Cormorant Garamond", "freight-text-pro", Georgia, serif;
  font-size: 1.32rem;
  letter-spacing: 0.01em;
  margin-bottom: 4px;
}

.sub {
  font-size: 0.84rem;
  opacity: 0.92;
  margin-bottom: 16px;
}

.auth-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  margin-bottom: 14px;
  background: #fafaf8;
}

.account-card {
  background: #fafaf8;
}

.profile-row {
  display: grid;
  grid-template-columns: 68px 1fr;
  gap: 10px;
  align-items: center;
  margin: 2px 0 8px;
}

.profile-photo,
.profile-photo-fallback {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  border: 1px solid #cdcdc8;
}

.profile-photo {
  object-fit: cover;
  display: block;
}

.profile-photo-fallback {
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 1.3rem;
  background: #ecebe6;
  color: #2d2d2d;
}

.profile-actions {
  display: grid;
  gap: 7px;
}

.upload-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  border-radius: 10px;
  padding: 10px 12px;
  background: #efefec;
  color: #1a1a1a;
  font-weight: 700;
  cursor: pointer;
}

.upload-label:hover {
  transform: translateY(-1px);
}

.auth-title {
  margin: 0 0 6px;
  font-size: 0.9rem;
  font-family: "Cormorant Garamond", Georgia, serif;
}

.auth-state {
  margin: 0 0 8px;
  font-size: 0.8rem;
  color: var(--ink-muted);
}

.auth-form {
  display: grid;
  gap: 8px;
}

.auth-divider {
  border-top: 1px dashed #d3d3cf;
  margin-top: 10px;
  padding-top: 10px;
}

.auth-help {
  margin: 8px 0 0;
  color: #5d5d5d;
  font-size: 0.73rem;
  line-height: 1.35;
}

.recovery {
  margin-top: 10px;
  border-top: 1px dashed #d3d3cf;
  padding-top: 8px;
}

.recovery summary {
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
}

.recovery[open] summary {
  margin-bottom: 8px;
}

.recovery-form {
  margin-top: 4px;
}

.role {
  display: grid;
  gap: 6px;
  margin-bottom: 14px;
}

.role label {
  font-size: 0.8rem;
  opacity: 0.9;
}

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

.nav button {
  border: 1px solid #dbdbdb;
  border-radius: 10px;
  text-align: left;
  padding: 10px 11px;
  color: var(--ink);
  background: #f7f7f5;
  cursor: pointer;
  transition: 140ms ease;
}

.nav button.active,
.nav button:hover {
  background: #111111;
  color: #ffffff;
  border-color: #111111;
  transform: translateX(2px);
}

.footer-note {
  margin-top: 12px;
  color: var(--ink-muted);
  font-size: 0.82rem;
  line-height: 1.45;
}

.pane {
  display: none;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}

.pane.active {
  display: block;
}

.top {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  align-items: center;
}

.top-actions {
  display: grid;
  justify-items: end;
  gap: 6px;
}

h1,
h2,
h3 {
  margin: 0;
}

h1 {
  font-size: clamp(1.4rem, 3vw, 2rem);
}

h2 {
  font-size: 1.15rem;
  margin-bottom: 12px;
}

h3 {
  font-size: 1rem;
  margin-bottom: 8px;
}

h1,
h2,
h3,
.brand,
.auth-title {
  font-family: "Cormorant Garamond", "freight-text-pro", Georgia, serif;
}

.meta {
  color: var(--ink-muted);
  font-size: 0.92rem;
  line-height: 1.5;
}

.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.kpi {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
}

.kpi .label {
  color: var(--ink-muted);
  font-size: 0.8rem;
  margin-bottom: 4px;
}

.kpi .value {
  font-size: 1.3rem;
  font-weight: 700;
  color: #111111;
}

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  padding: 13px;
}

.tag {
  display: inline-block;
  font-size: 0.74rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border-radius: 999px;
  padding: 4px 10px;
  font-weight: 700;
  background: #f0efe9;
  color: #1d1d1d;
  margin-bottom: 9px;
}

input,
textarea,
select,
button {
  font: inherit;
}

input,
textarea,
select {
  border: 1px solid #cbcbc9;
  border-radius: 10px;
  padding: 10px;
  background: #fff;
  color: #1e1e1e;
  width: 100%;
}

select:disabled,
input:disabled,
textarea:disabled {
  opacity: 0.8;
  cursor: not-allowed;
}

form {
  display: grid;
  gap: 8px;
}

.row {
  display: grid;
  gap: 8px;
  grid-template-columns: 1fr 1fr;
}

.inline-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.inline-actions.wrap {
  flex-wrap: wrap;
}

button.primary,
button.secondary,
button.danger-btn {
  border: none;
  border-radius: 10px;
  padding: 10px 12px;
  cursor: pointer;
  font-weight: 700;
  transition: transform 120ms ease, filter 120ms ease;
}

button:hover {
  transform: translateY(-1px);
}

button.primary {
  background: var(--brand);
  color: #fff;
}

button.primary:hover {
  background: var(--brand-dark);
}

button.secondary {
  background: #efefec;
  color: #1a1a1a;
}

button.danger-btn {
  background: var(--danger);
  color: #fff;
}

button.danger-btn:hover {
  background: var(--danger-dark);
}

button.full {
  width: 100%;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--line);
}

th,
td {
  padding: 9px;
  font-size: 0.86rem;
  border-bottom: 1px solid #ecece9;
  text-align: left;
  vertical-align: top;
}

th {
  background: #f6f6f3;
  color: #202020;
  font-weight: 700;
}

td.actions {
  width: 1%;
  white-space: nowrap;
}

button.table-btn {
  border: 1px solid #cdcdcb;
  background: #fff;
  color: #222222;
  border-radius: 8px;
  padding: 5px 8px;
  font-size: 0.76rem;
  margin-right: 4px;
}

button.table-btn.warn {
  color: #8e5d12;
}

button.table-btn.danger {
  color: #8f2424;
}

.empty {
  padding: 12px;
  border: 1px dashed #cfcfcb;
  border-radius: 10px;
  color: var(--ink-muted);
  background: #fafaf8;
  font-size: 0.9rem;
}

.timeline {
  display: grid;
  gap: 10px;
}

.milestone {
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 8px solid #4f6f2a;
  border-radius: 12px;
  padding: 12px;
}

.milestone.next {
  border-left-color: #f1b426;
}

.milestone.later {
  border-left-color: #c5892d;
}

.status {
  font-size: 0.77rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #424242;
  margin-bottom: 7px;
}

.success {
  min-height: 1.2em;
  font-size: 0.84rem;
  color: var(--ok);
  font-weight: 600;
}

.sidebar .success {
  color: var(--ok);
}

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

.ok {
  color: var(--ok);
}

@media (max-width: 980px) {
  body {
    padding: 14px;
  }

  .auth-layout {
    grid-template-columns: 1fr;
  }

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

  .sidebar {
    position: static;
  }

  .grid,
  .row {
    grid-template-columns: 1fr;
  }

  .top-actions {
    justify-items: start;
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}
