:root {
  --premium-brown: #4b281b;
  --premium-gold: #d3aa6d;
  --premium-paper: #fffdf9;
}

.shell {
  min-height: 100vh;
  background:
    radial-gradient(circle at 85% 0, rgba(211, 170, 109, .16), transparent 30%),
    linear-gradient(150deg, #f4eee6, #fffdf9 58%, #ede2d3);
}

header.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(280px, 1fr) auto minmax(330px, 1fr);
  align-items: center;
  width: 100%;
  height: 72px;
  padding: 0 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, .97);
  box-shadow: 0 5px 22px rgba(73, 43, 27, .06);
  backdrop-filter: blur(14px);
}

.app-header .brand {
  display: flex;
  align-items: center;
  justify-self: start;
  gap: 15px;
  color: inherit;
  text-decoration: none;
}

.app-header .brand .logo {
  width: 128px;
  height: 42px;
  object-fit: contain;
}

.app-header .brand > i {
  width: 1px;
  height: 34px;
  background: var(--line);
}

.app-header .brand > span {
  display: flex;
  flex-direction: column;
  line-height: 1.05;
}

.app-header .brand b {
  color: var(--premium-brown);
  font-family: "Playfair Display", Georgia, serif;
  font-size: 17px;
  letter-spacing: 0;
}

.app-header .brand small {
  margin-top: 5px;
  color: #b8894c;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 1.8px;
  text-transform: uppercase;
}

.header-sync {
  display: inline-flex;
  align-items: center;
  justify-self: center;
  gap: 7px;
  min-height: 34px;
  padding: 0 13px;
  border: 1px solid #d9eadf;
  border-radius: 999px;
  background: #f2f7f3;
  color: #3d765c;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .2px;
}

.header-sync i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #55a77d;
  box-shadow: 0 0 0 4px rgba(85, 167, 125, .12);
}

.app-header .account {
  justify-self: end;
  gap: 10px;
  min-width: 0;
}

.app-header .avatar {
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  background: #f1dfc1;
  color: var(--premium-brown);
  font-size: 14px;
  font-weight: 850;
}

.app-header .account > div:nth-child(2) {
  min-width: 0;
}

.app-header .account b,
.app-header .account small {
  display: block;
  max-width: 175px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-header .account b {
  color: var(--premium-brown);
  font-size: 11px;
}

.app-header .account small {
  margin-top: 2px;
  color: #8d7d73;
  font-size: 8px;
}

.logout-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  margin-left: 3px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--brown);
  font-size: 9px;
  font-weight: 800;
}

.logout-button svg {
  width: 16px;
  height: 16px;
}

.content {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 22px 24px 72px;
}

.app-tabs {
  position: sticky;
  top: 82px;
  z-index: 8;
  display: flex;
  justify-content: center;
  width: max-content;
  max-width: 100%;
  margin: 0 auto 22px;
  padding: 5px;
  border: 1px solid rgba(90, 48, 31, .1);
  border-radius: 13px;
  background: rgba(255, 253, 249, .92);
  box-shadow: 0 8px 28px rgba(73, 43, 27, .07);
  backdrop-filter: blur(12px);
}

.app-tabs button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  padding: 0 13px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #7b6b61;
  font-size: 10px;
  font-weight: 800;
}

.app-tabs button:hover { background: #f4ece3; color: var(--brown); }
.app-tabs button.active { background: var(--brown); color: white; box-shadow: 0 4px 12px rgba(90, 48, 31, .18); }
.app-tabs svg { width: 16px; height: 16px; }

.welcome-panel {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 190px;
  margin-bottom: 20px;
  overflow: hidden;
  padding: 35px 40px;
  border: 1px solid rgba(211, 170, 109, .45);
  border-radius: 24px;
  background:
    radial-gradient(circle at 88% 18%, rgba(211, 170, 109, .24), transparent 24%),
    linear-gradient(135deg, #482519, #683822 72%, #77482e);
  color: white;
  box-shadow: 0 20px 55px rgba(73, 43, 27, .19);
}

.welcome-panel::after {
  content: "";
  position: absolute;
  right: -70px;
  bottom: -125px;
  width: 280px;
  height: 280px;
  border: 1px solid rgba(255, 255, 255, .11);
  border-radius: 50%;
}

.welcome-panel > div { position: relative; z-index: 1; }
.welcome-panel small { color: #e2bd83; font-size: 10px; font-weight: 800; letter-spacing: 1.6px; text-transform: uppercase; }
.welcome-panel h1 { margin: 8px 0 5px; font-size: clamp(35px, 5vw, 52px); line-height: 1.05; }
.welcome-panel p { margin: 0; color: #eaded6; font-size: 14px; }
.welcome-mark { position: relative; z-index: 1; display: grid; place-items: center; width: 88px; height: 88px; border: 1px solid rgba(255,255,255,.24); border-radius: 50%; color: #e2bd83; }
.compass-rose { width: 62px; height: 62px; overflow: visible; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.compass-rose .compass-major { fill: currentColor; fill-opacity: .17; stroke-width: 1.4; }
.compass-rose .compass-minor { fill: currentColor; fill-opacity: .08; stroke-width: 1.2; }
.compass-rose .compass-needle { fill: currentColor; stroke: none; }

.account-notice {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0 0 18px;
  padding: 13px 16px;
  border: 1px solid #ead6af;
  border-radius: 12px;
  background: #fff8e9;
  color: #725238;
  font-size: 11px;
}

.portal-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.portal-card {
  --card-accent: #8f6138;
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 17px;
  min-height: 168px;
  overflow: hidden;
  padding: 24px;
  border: 1px solid rgba(90, 48, 31, .12);
  border-radius: 20px;
  background: rgba(255, 255, 255, .94);
  color: var(--ink, #29231f);
  text-align: left;
  box-shadow: 0 13px 38px rgba(73, 43, 27, .08);
  transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
}

.portal-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--card-accent);
}

.portal-card:hover,
.portal-card:focus-visible {
  transform: translateY(-3px);
  border-color: rgba(143, 97, 56, .36);
  outline: 0;
  box-shadow: 0 19px 48px rgba(73, 43, 27, .13);
}

.portal-planning { --card-accent: #b8894c; }
.portal-clock { --card-accent: #3d765c; }
.portal-plans { --card-accent: #673521; }
.portal-admin { --card-accent: #8a6a54; }

.portal-icon {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border-radius: 16px;
  background: color-mix(in srgb, var(--card-accent) 12%, white);
  color: var(--card-accent);
}

.portal-icon svg { width: 30px; height: 30px; }
.portal-copy { display: flex; min-width: 0; flex-direction: column; }
.portal-copy small { margin-bottom: 7px; color: var(--card-accent); font-size: 8px; font-weight: 850; letter-spacing: 1.2px; text-transform: uppercase; }
.portal-copy strong { color: var(--premium-brown); font-family: "Playfair Display", Georgia, serif; font-size: 24px; line-height: 1.1; }
.portal-copy > span { max-width: 320px; margin-top: 8px; color: var(--muted); font-size: 11px; line-height: 1.55; }
.portal-open { align-self: end; color: var(--card-accent); font-size: 9px; font-weight: 850; white-space: nowrap; }
.portal-open b { margin-left: 3px; font-size: 14px; }

.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  padding: 13px 4px 7px;
}

.page-heading small { color: #b8894c; font-size: 9px; font-weight: 850; letter-spacing: 1.5px; }
.page-heading h1 { margin: 4px 0 3px; color: var(--premium-brown); font-size: 34px; }
.page-heading p { margin: 0; color: var(--muted); font-size: 12px; }
.admin-heading > span { padding: 7px 11px; border-radius: 999px; background: #e8f5ed; color: #286743; font-size: 10px; font-weight: 800; }

.planning-card { padding-top: 8px; }
.planning-card .week-row:first-child { border-top: 0; }
.empty-state { display: grid; justify-items: center; padding: 45px 20px; color: var(--muted); text-align: center; }
.empty-state svg { width: 42px; height: 42px; color: #b8894c; }
.empty-state h2 { margin: 13px 0 4px; color: var(--brown); }
.empty-state p { margin: 0; }

@media (max-width: 820px) {
  header.app-header { grid-template-columns: 1fr auto; padding-inline: 16px; }
  .header-sync { position: absolute; top: 77px; right: 16px; min-height: 28px; box-shadow: 0 4px 14px rgba(73,43,27,.08); }
  .content { padding-top: 42px; }
  .portal-grid { grid-template-columns: 1fr; }
  .app-tabs { justify-content: flex-start; overflow-x: auto; }
}

@media (max-width: 560px) {
  header.app-header { height: 66px; padding-inline: 12px; }
  .app-header .brand { gap: 9px; }
  .app-header .brand .logo { width: 96px; height: 38px; }
  .app-header .brand > i,
  .app-header .brand > span { display: none; }
  .app-header .account > div:nth-child(2),
  .logout-button span { display: none; }
  .logout-button { width: 36px; padding: 0; justify-content: center; }
  .header-sync { top: 71px; right: 12px; }
  .content { padding: 40px 13px 55px; }
  .app-tabs { top: 76px; width: 100%; margin-bottom: 14px; }
  .app-tabs button { flex: 1 0 auto; justify-content: center; padding-inline: 10px; }
  .welcome-panel { min-height: 176px; padding: 27px 24px; border-radius: 20px; }
  .welcome-panel h1 { font-size: 34px; }
  .welcome-panel p { font-size: 12px; }
  .welcome-mark { display: none; }
  .portal-card { grid-template-columns: auto minmax(0, 1fr); min-height: 148px; padding: 19px; }
  .portal-icon { width: 50px; height: 50px; border-radius: 14px; }
  .portal-icon svg { width: 26px; height: 26px; }
  .portal-copy strong { font-size: 22px; }
  .portal-open { grid-column: 2; align-self: start; }
  .page-heading h1 { font-size: 29px; }
  .week-row { grid-template-columns: 72px 1fr; }
  .week-row > span:last-child { grid-column: 2; }
}

@media (prefers-reduced-motion: reduce) {
  .portal-card { transition: none; }
}
