:root {
  color-scheme: light;
  --brown: #5b3a29;
  --brown-dark: #3f291f;
  --brown-soft: #8a5d45;
  --cream: #f8f5f2;
  --white: #ffffff;
  --border: #dfd1c7;
  --muted: #746963;
  --success: #2f6b49;
  --danger: #9f3131;
  --shadow: 0 24px 70px rgba(63, 41, 31, 0.12);
  font-family: "Avenir Next", Avenir, "Segoe UI", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--cream);
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 8% 0%, rgba(138, 93, 69, 0.11), transparent 28rem),
    var(--cream);
  color: #211c19;
}

a {
  color: inherit;
}

button,
input,
select {
  font: inherit;
}

.auth-page {
  display: grid;
  place-items: center;
  padding: 28px 18px;
}

.auth-shell {
  width: min(100%, 470px);
}

.auth-shell-wide {
  width: min(100%, 620px);
}

.auth-card,
.panel {
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: clamp(26px, 6vw, 46px);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
}

.brand-block {
  margin-bottom: 28px;
  text-align: center;
}

.brand-logo {
  display: block;
  width: min(250px, 75%);
  max-height: 105px;
  margin: 0 auto 20px;
  object-fit: contain;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--brown-soft);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 10px;
  font-size: clamp(1.9rem, 5vw, 2.55rem);
  line-height: 1.08;
}

.muted,
.portal-heading > p:last-child {
  color: var(--muted);
  line-height: 1.55;
}

.form-stack {
  display: grid;
  gap: 12px;
}

.form-stack label {
  margin-top: 4px;
  color: #3f342f;
  font-size: 0.86rem;
  font-weight: 750;
}

.form-stack input,
.form-stack select {
  width: 100%;
  min-height: 48px;
  border: 1px solid #cdb8aa;
  border-radius: 12px;
  padding: 10px 13px;
  background: var(--white);
  color: #211c19;
}

.form-stack input:focus,
.form-stack select:focus {
  border-color: var(--brown-soft);
  outline: 3px solid rgba(138, 93, 69, 0.15);
}

.field-help {
  margin-top: -7px;
  color: var(--muted);
}

.button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 10px 16px;
  font-weight: 750;
  text-decoration: none;
  cursor: pointer;
}

.button-primary {
  margin-top: 10px;
  background: var(--brown);
  color: var(--white);
  box-shadow: 0 9px 24px rgba(91, 58, 41, 0.2);
}

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

.button-full {
  width: 100%;
}

.button-light {
  border-color: var(--border);
  background: var(--white);
  color: var(--brown);
}

.button-ghost {
  background: transparent;
  color: var(--brown);
}

.alert {
  margin: 0 0 18px;
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 0.92rem;
  line-height: 1.4;
}

.alert-error {
  border: 1px solid #efb9b9;
  background: #fff0f0;
  color: var(--danger);
}

.alert-success {
  border: 1px solid #bad8c6;
  background: #effaf3;
  color: var(--success);
}

.security-note {
  margin: 24px 0 0;
  color: #8b817b;
  font-size: 0.78rem;
  text-align: center;
}

.account-box {
  display: grid;
  gap: 10px;
  margin: 8px 0;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px;
  background: #fbf8f6;
}

.account-box h2 {
  margin-bottom: 2px;
  color: var(--brown);
  font-size: 1.05rem;
}

.topbar {
  display: flex;
  min-height: 78px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--border);
  padding: 12px clamp(18px, 4vw, 54px);
  background: rgba(255, 255, 255, 0.94);
}

.brand-link {
  display: inline-flex;
  align-items: center;
  gap: 13px;
  color: var(--brown);
  text-decoration: none;
}

.brand-link img {
  width: 86px;
  height: 48px;
  object-fit: contain;
}

.brand-link span {
  display: grid;
}

.brand-link small {
  margin-top: 1px;
  color: var(--muted);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar-actions form {
  margin: 0;
}

.role-badge,
.status-pill {
  display: inline-flex;
  width: fit-content;
  border-radius: 999px;
  padding: 6px 10px;
  background: #efe4dd;
  color: var(--brown);
  font-size: 0.75rem;
  font-weight: 800;
}

.portal-shell {
  width: min(1180px, calc(100% - 36px));
  margin: 0 auto;
  padding: clamp(42px, 7vw, 88px) 0;
}

.portal-heading {
  max-width: 720px;
  margin-bottom: 36px;
}

.app-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
  gap: 22px;
}

.app-card {
  position: relative;
  display: flex;
  min-height: 310px;
  flex-direction: column;
  align-items: flex-start;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 28px;
  background: var(--white);
  box-shadow: 0 16px 44px rgba(63, 41, 31, 0.08);
  text-decoration: none;
}

.app-card-active {
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.app-card-active:hover {
  transform: translateY(-3px);
  box-shadow: 0 22px 54px rgba(63, 41, 31, 0.14);
}

.app-icon {
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  margin-bottom: 25px;
  border-radius: 16px;
  background: var(--brown);
  color: var(--white);
  font-size: 1.55rem;
  font-weight: 800;
}

.app-card .status-pill {
  position: absolute;
  top: 28px;
  right: 28px;
}

.status-muted {
  background: #efeeed;
  color: var(--muted);
}

.app-card h2 {
  margin-bottom: 9px;
  color: var(--brown-dark);
  font-size: 1.35rem;
}

.app-card p {
  color: var(--muted);
  line-height: 1.55;
}

.app-action {
  margin-top: auto;
  color: var(--brown);
  font-weight: 800;
}

.app-card-coming {
  border-style: dashed;
  background: rgba(255, 255, 255, 0.55);
}

.app-card-coming .app-icon {
  background: #c7b8ae;
}

.admin-shell {
  width: min(720px, calc(100% - 36px));
  margin: 0 auto;
  padding: clamp(38px, 7vw, 72px) 0;
}

@media (max-width: 760px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

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

  .role-badge {
    margin-right: auto;
  }

  .brand-link span {
    display: none;
  }

  .app-card {
    min-height: 280px;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
