:root {
  --bg: #eef4f5;
  --card: #ffffff;
  --text: #172026;
  --muted: #5f6b75;
  --line: #d6dee4;
  --accent: #1f7a8c;
  --accent-dark: #14505e;
  --good: #13795b;
  --good-bg: #eaf7f1;
  --bad: #b42318;
  --bad-bg: #fff1f0;
  --warn: #9a6700;
  --warn-bg: #fff7df;
  --gold: #a66c00;
  --gold-bg: #fff3cf;
  --info-bg: #eaf5ff;
  --info: #155e9f;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background: var(--bg);
  direction: rtl;
  text-align: right;
  font-family: "BCN Arabic Rounded", "DIN Next LT Arabic", "Segoe UI", Tahoma, Arial, sans-serif;
}

a {
  color: var(--accent-dark);
  font-weight: 700;
  text-decoration: none;
}

button,
input {
  font: inherit;
}

button {
  min-height: 44px;
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  cursor: pointer;
}

button:hover {
  background: var(--accent-dark);
}

button.danger {
  background: var(--bad);
}

button.danger:hover {
  background: #7a1710;
}

button:disabled {
  cursor: not-allowed;
  opacity: .45;
}

header {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0;
  padding: 18px 24px;
  border-bottom: 1px solid #dfe6ea;
  background: #f6f8fb;
}

header nav,
header form {
  display: flex;
  align-items: center;
  margin: 0;
}

header nav {
  width: min(100%, 980px);
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  padding: 10px;
  border: 1px solid #e1e7ee;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 14px 34px rgba(11, 31, 58, .08);
}

header a {
  display: inline-flex;
  position: relative;
  min-height: 48px;
  align-items: center;
  gap: 8px;
  padding: 0 18px;
  border-radius: 10px;
  color: #0B1F3A;
  font-size: 1rem;
  font-weight: 900;
}

header a.active {
  background: #fff8df;
  color: #0B1F3A;
}

header a.active::after {
  position: absolute;
  right: 18px;
  bottom: -9px;
  left: 18px;
  height: 4px;
  border-radius: 999px;
  background: #D4AF37;
  content: "";
}

.nav-icon {
  display: inline-grid;
  width: 24px;
  height: 24px;
  place-items: center;
  color: currentColor;
  font-size: 1.25rem;
  line-height: 1;
}

header button {
  min-height: 48px;
  padding: 0 16px;
  border-radius: 10px;
  background: #0B1F3A;
  color: #fff;
  font-weight: 900;
}

header button:hover {
  background: #123C69;
}

.nav-meta {
  flex-basis: 100%;
  margin-top: 2px;
  color: var(--muted);
  font-size: .72rem;
  font-weight: 700;
  text-align: center;
}

.nav-meta .freshness {
  padding: 0;
  border: 0;
  background: transparent;
  font-size: inherit;
}

.login {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.login form,
.login section {
  display: grid;
  gap: 14px;
  width: min(100%, 390px);
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
}

.portal-login {
  background:
    radial-gradient(circle at top right, rgba(212, 175, 55, .16), transparent 34%),
    linear-gradient(135deg, #f6f8fb, #eef4f5);
}

.login .login-choice {
  width: min(1220px, 100%);
  max-width: calc(100vw - 48px);
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
  justify-items: center;
  gap: 34px;
  padding: 40px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, .72);
  box-shadow: 0 18px 52px rgba(11, 31, 58, .08);
}

.portal-login-card {
  width: 100% !important;
  min-width: 0;
  max-width: 460px;
  min-height: 500px;
  align-content: start;
  justify-items: stretch;
  gap: 20px;
  padding: 34px;
  border-radius: 8px;
  box-shadow: 0 18px 42px rgba(11, 31, 58, .12);
  text-align: center;
}

.portal-login-card h1 {
  color: #0B1F3A;
  font-size: clamp(2.3rem, 4vw, 3.15rem);
  line-height: 1.05;
  word-break: normal;
  overflow-wrap: normal;
  white-space: nowrap;
}

.portal-login-card p {
  line-height: 1.35;
  text-align: center;
}

.portal-login-card label {
  gap: 10px;
  color: #12181f;
  font-size: 1.25rem;
  text-align: center;
}

.portal-login-card input {
  min-height: 58px;
  text-align: center;
}

.portal-login-card button,
.portal-login-card .external-link {
  width: 100%;
  min-height: 52px;
  font-size: 1.05rem;
  line-height: 1.25;
  white-space: nowrap;
}

.family-login-card {
  direction: rtl;
}

.shiftlync-login-card {
  direction: ltr;
}

.external-link {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  padding: 10px 14px;
  border: 1px solid rgba(212, 175, 55, .48);
  border-radius: 8px;
  background: #fff8df;
  color: #0B1F3A;
  font-weight: 900;
}

.external-link:hover {
  background: #f8edbf;
}

.login p,
.title p {
  margin: 0;
  color: var(--accent-dark);
  font-size: .78rem;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
}

.login span,
.login small {
  color: var(--muted);
}

label {
  display: grid;
  gap: 7px;
  font-weight: 800;
}

input,
select {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid #b9c4cc;
  border-radius: 6px;
  background: #fff;
  text-align: right;
}

input[type="checkbox"] {
  width: auto;
  min-height: auto;
}

.error {
  padding: 10px 12px;
  border-left: 4px solid #9f1d1d;
  background: #fff1f1;
  color: #9f1d1d;
  font-weight: 700;
}

.shiftlync-page {
  direction: ltr;
  text-align: left;
}

.shift-hero {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
  padding: 28px;
  border: 0;
  background: linear-gradient(135deg, #0B1F3A, #123C69);
  box-shadow: 0 18px 42px rgba(11, 31, 58, .14);
  color: #fff;
  text-align: left;
}

.shift-hero span {
  color: #F8E8A0;
  font-weight: 900;
}

.shift-hero h1 {
  margin: 8px 0;
  font-size: clamp(2rem, 4vw, 3.2rem);
}

.shift-hero p {
  margin: 0;
  color: rgba(255, 255, 255, .76);
  font-weight: 700;
}

.shift-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.shift-actions .admin-link {
  background: #fff;
}

.shift-summary {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 22px;
}

.shift-contracts {
  display: grid;
  gap: 18px;
  margin-bottom: 22px;
}

.shift-contract-card {
  display: grid;
  gap: 16px;
  padding: 22px;
  border: 1px solid #E5E7EB;
  border-top: 4px solid #D4AF37;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 12px 28px rgba(11, 31, 58, .08);
}

.contract-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
}

.contract-head span,
.shift-card-grid span {
  color: #6B7280;
  font-size: .82rem;
  font-weight: 900;
}

.contract-head h2 {
  margin-top: 4px;
  color: #0B1F3A;
}

.shift-card-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.shift-card-grid div {
  padding: 14px;
  border: 1px solid #E5E7EB;
  border-radius: 8px;
  background: #FAFBFD;
}

.shift-card-grid strong {
  display: block;
  margin-top: 6px;
  color: #0B1F3A;
  font-size: 1.15rem;
}

.shift-progress {
  height: 12px;
}

.empty-state {
  padding: 24px;
}

.inline-upload {
  display: grid;
  grid-template-columns: minmax(170px, 1fr) auto;
  gap: 8px;
  margin-top: 8px;
}

.wrap {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 56px;
}

.title {
  margin-bottom: 18px;
  border: 0;
  background: transparent;
}

.home-hero,
.admin-title {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
  border: 0;
  background: transparent;
}

.home-hero p,
.admin-title p {
  margin: 0 0 6px;
  color: var(--accent-dark);
  font-size: .78rem;
  font-weight: 800;
}

.home-hero h1,
.admin-title h1 {
  font-size: clamp(2rem, 4vw, 3.2rem);
}

.home-hero span {
  display: block;
  margin-top: 8px;
  color: var(--muted);
}

.freshness {
  width: fit-content;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-size: .86rem;
  font-weight: 800;
}

.compact-countdown {
  display: flex;
  width: fit-content;
  max-width: 100%;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin: 0 0 18px;
  padding: 10px 14px;
  border: 1px solid #e4bd5c;
  border-radius: 999px;
  background: #fffaf0;
  color: var(--gold);
  font-weight: 800;
}

.compact-countdown span {
  color: var(--text);
}

.compact-countdown b {
  color: var(--gold);
}

.primary-metric {
  border: 0;
  background: transparent;
}

.primary-metric .metric {
  min-height: 150px;
  border: 1px solid var(--line);
}

.primary-metric .metric strong {
  font-size: clamp(2.2rem, 6vw, 4rem);
}

.home-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.overview-premium {
  --premium-navy: #0B1F3A;
  --premium-blue: #123C69;
  --premium-gold: #D4AF37;
  --premium-green: #1F8A5B;
  --premium-bg: #F6F8FB;
  --premium-card: #FFFFFF;
  --premium-text: #1F2937;
  --premium-muted: #6B7280;
  --premium-red: #B91C1C;
  direction: rtl;
  text-align: right;
  color: var(--premium-text);
}

.overview-premium section {
  border-radius: 8px;
}

.overview-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 22px;
  margin-bottom: 18px;
  padding: 28px;
  border: 0;
  background:
    linear-gradient(135deg, rgba(11, 31, 58, .96), rgba(18, 60, 105, .94)),
    #0B1F3A;
  box-shadow: 0 18px 42px rgba(11, 31, 58, .16);
  color: #fff;
}

.overview-header h1 {
  margin: 8px 0 8px;
  font-size: clamp(2rem, 4vw, 3.4rem);
  letter-spacing: 0;
}

.overview-header p {
  margin: 0;
  color: rgba(255, 255, 255, .78);
  font-size: 1rem;
}

.eyebrow,
.updated-pill span,
.section-title span,
.wealth-card > span,
.fund-hero-card span,
.formula-card span,
.target-card span,
.deposit-comparison span {
  color: var(--premium-muted);
  font-size: .78rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.eyebrow {
  display: inline-flex;
  padding: 7px 11px;
  border: 1px solid rgba(212, 175, 55, .46);
  border-radius: 999px;
  background: rgba(212, 175, 55, .12);
  color: #F8E8A0;
}

.updated-pill {
  min-width: 220px;
  padding: 14px 16px;
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 8px;
  background: rgba(255, 255, 255, .08);
  text-align: left;
}

.updated-pill span {
  display: block;
  color: rgba(255, 255, 255, .68);
}

.updated-pill strong {
  display: block;
  margin-top: 4px;
  color: #fff;
  font-size: .95rem;
}

.fund-hero-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 22px;
  align-items: stretch;
  margin-bottom: 22px;
  padding: 28px;
  border: 1px solid rgba(212, 175, 55, .42);
  border-right: 6px solid var(--premium-gold);
  background:
    linear-gradient(135deg, rgba(212, 175, 55, .13), rgba(255, 255, 255, 0) 42%),
    var(--premium-card);
  box-shadow: 0 16px 34px rgba(11, 31, 58, .12);
}

.hero-copy h2 {
  margin: 10px 0 8px;
  color: var(--premium-navy);
  font-size: clamp(2.6rem, 7vw, 5.2rem);
  line-height: 1;
  letter-spacing: 0;
}

.hero-copy p,
.formula-card small,
.wealth-card small,
.target-card small {
  margin: 0;
  color: var(--premium-muted);
  font-weight: 700;
}

.formula-card {
  display: grid;
  align-content: center;
  gap: 8px;
  padding: 20px;
  border: 1px solid #E5E7EB;
  border-radius: 8px;
  background: #FAFBFD;
}

.formula-card strong {
  color: var(--premium-blue);
  font-size: 1.45rem;
}

.dashboard-section {
  margin-bottom: 22px;
  padding: 24px;
  border: 1px solid #E5E7EB;
  background: var(--premium-card);
  box-shadow: 0 12px 28px rgba(11, 31, 58, .08);
}

.section-title {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid #E5E7EB;
}

.section-title p {
  max-width: 520px;
  margin: 0;
  color: var(--premium-muted);
  font-weight: 700;
}

.section-title h2 {
  margin: 0;
  color: var(--premium-navy);
  font-size: clamp(1.35rem, 2.5vw, 2rem);
}

.section-title span {
  color: var(--premium-gold);
}

.wealth-grid,
.target-grid,
.deposits-layout {
  display: grid;
  gap: 16px;
}

.wealth-grid.four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.wealth-grid.three,
.target-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.wealth-grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

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

.deposits-layout .deposit-total {
  grid-column: 1 / -1;
}

.wealth-card,
.target-card {
  display: grid;
  gap: 10px;
  min-height: 160px;
  padding: 20px;
  border: 1px solid #E5E7EB;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 10px 22px rgba(11, 31, 58, .06);
}

.wealth-card {
  border-top: 4px solid var(--premium-blue);
}

.wealth-card.positive {
  border-top-color: var(--premium-green);
}

.wealth-card.gold,
.wealth-card.best {
  border-top-color: var(--premium-gold);
  background: linear-gradient(180deg, #FFFCF2, #fff 48%);
}

.wealth-card.warning {
  border-top-color: var(--premium-red);
}

.wealth-card.deposit-month {
  border-top-color: var(--premium-blue);
  background: linear-gradient(180deg, #EFF6FF, #fff 50%);
}

.wealth-card.deposit-best {
  border-top-color: var(--premium-gold);
  background: linear-gradient(180deg, #FFFCF2, #fff 48%);
}

.wealth-card.deposit-total {
  min-height: 138px;
  border-top-color: var(--premium-green);
  background: linear-gradient(180deg, #F0FAF5, #fff 50%);
}

.wealth-card strong {
  color: var(--premium-navy);
  font-size: clamp(1.55rem, 3vw, 2.25rem);
  line-height: 1.08;
}

.wealth-card.warning strong {
  color: var(--premium-red);
}

.card-icon {
  display: inline-grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 999px;
  background: #EEF2F7;
  color: var(--premium-blue);
  font-size: .9rem;
  font-weight: 900;
}

.wealth-card.positive .card-icon {
  background: rgba(31, 138, 91, .12);
  color: var(--premium-green);
}

.wealth-card.gold .card-icon,
.wealth-card.best .card-icon {
  background: rgba(212, 175, 55, .16);
  color: #946C10;
}

.badge-gold {
  width: fit-content;
  padding: 7px 11px;
  border-radius: 999px;
  background: rgba(212, 175, 55, .18);
  color: #8A640D;
  font-size: .78rem;
  font-weight: 900;
}

.deposit-comparison {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  margin-top: 18px;
  padding: 14px 16px;
  border: 1px solid #E5E7EB;
  border-radius: 8px;
  background: #FAFBFD;
}

.deposit-comparison div,
.progress-track {
  overflow: hidden;
  height: 10px;
  border-radius: 999px;
  background: #E5E7EB;
}

.deposit-comparison b,
.progress-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--premium-gold), var(--premium-green));
}

.target-card {
  min-height: 220px;
  border-top: 4px solid var(--premium-gold);
  background: linear-gradient(180deg, #FFFCF2, #fff 42%);
}

.target-card.ready {
  border-top-color: var(--premium-green);
  background: linear-gradient(180deg, #F0FAF5, #fff 42%);
}

.target-card-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
}

.target-card-head strong {
  display: block;
  margin-top: 6px;
  color: var(--premium-navy);
  font-size: clamp(1.55rem, 3vw, 2.3rem);
}

.target-card-head em {
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(212, 175, 55, .16);
  color: #8A640D;
  font-size: .78rem;
  font-style: normal;
  font-weight: 900;
  white-space: nowrap;
}

.target-card.ready .target-card-head em {
  background: rgba(31, 138, 91, .13);
  color: var(--premium-green);
}

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

.target-rows div {
  padding: 12px;
  border: 1px solid #E5E7EB;
  border-radius: 8px;
  background: #fff;
}

.target-rows span {
  display: block;
  margin-bottom: 4px;
}

.target-rows strong {
  color: var(--premium-navy);
  font-size: 1.05rem;
}

.target-card:not(.ready) .target-rows div:last-child strong {
  color: var(--premium-red);
}

.contest-title {
  border: 0;
  background: transparent;
}

.rtl-page {
  direction: rtl;
  text-align: right;
}

.rtl-page .cards article.metric {
  border-right: 5px solid var(--accent);
  border-left: 1px solid var(--line);
}

.rtl-page .cards article.metric.good {
  border-right-color: var(--good);
}

.rtl-page .cards article.metric.bad {
  border-right-color: var(--bad);
}

.rtl-page .cards article.metric.warn {
  border-right-color: var(--warn);
}

.rtl-page .cards article.metric.gold {
  border-right-color: var(--gold);
}

.rtl-page .cards article.metric.info {
  border-right-color: var(--info);
}

.rtl-page th,
.rtl-page td {
  text-align: right;
}

.cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}

.cards article,
section {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
}

.cards article {
  display: grid;
  gap: 8px;
  min-height: 105px;
  padding: 18px;
}

.cards article.metric {
  position: relative;
  border-right: 5px solid var(--accent);
}

.cards article.metric.good {
  border-right-color: var(--good);
  background: linear-gradient(270deg, var(--good-bg), #fff 34%);
}

.cards article.metric.bad {
  border-right-color: var(--bad);
  background: linear-gradient(270deg, var(--bad-bg), #fff 34%);
}

.cards article.metric.warn {
  border-right-color: var(--warn);
  background: linear-gradient(270deg, var(--warn-bg), #fff 34%);
}

.cards article.metric.gold {
  border-right-color: var(--gold);
  background: linear-gradient(270deg, var(--gold-bg), #fff 34%);
}

.cards article.metric.info {
  border-right-color: var(--info);
  background: linear-gradient(270deg, var(--info-bg), #fff 34%);
}

.cards span {
  color: var(--muted);
}

.cards strong {
  font-size: 1.6rem;
}

.cards small {
  color: var(--muted);
}

.cards.mini {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0;
  padding: 18px;
}

.cards.mini article {
  min-height: 92px;
  box-shadow: none;
}

.cards.mini.one-col {
  grid-template-columns: 1fr;
}

.filter-box {
  display: grid;
  gap: 18px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.filter-box form {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(180px, 280px) auto;
  gap: 14px;
  align-items: end;
}

.filter-box form.single-filter {
  grid-template-columns: minmax(220px, 360px);
}

.admin-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.admin-form button {
  align-self: end;
}

.check-row {
  display: flex;
  gap: 10px;
  align-items: center;
  align-self: end;
  min-height: 44px;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.action-row form {
  margin: 0;
}

.action-row button {
  min-height: 34px;
  padding: 0 10px;
  font-size: .86rem;
}

.edit-transaction {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.edit-transaction summary {
  padding: 12px 14px;
  color: #0B1F3A;
  font-weight: 900;
  cursor: pointer;
}

.edit-transaction .admin-form {
  border-top: 1px solid var(--line);
  border-bottom: 0;
}

section {
  margin-top: 18px;
  overflow: hidden;
}

section h2 {
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.panel-clean h2 {
  padding: 0;
  border: 0;
}

.section-head {
  display: grid;
  gap: 6px;
  padding: 18px 18px 0;
}

.section-head p {
  margin: 0;
  color: var(--muted);
}

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

.chart-card {
  display: grid;
  gap: 14px;
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfe;
  color: var(--accent);
}

.chart-card div {
  display: flex;
  gap: 12px;
  align-items: baseline;
  justify-content: space-between;
}

.chart-card span {
  color: var(--muted);
}

.chart-card strong {
  color: var(--text);
  font-size: 1.25rem;
}

.chart-card svg {
  display: block;
  width: 100%;
  height: auto;
}

.chart-card circle {
  fill: var(--accent);
}

.status-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 18px;
}

.badge {
  display: inline-flex;
  width: fit-content;
  min-height: 28px;
  align-items: center;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f7fafb;
  color: var(--muted);
  font-size: .86rem;
  font-weight: 800;
  white-space: nowrap;
}

.badge.good {
  border-color: #9ed8c2;
  background: var(--good-bg);
  color: var(--good);
}

.badge.bad {
  border-color: #f2aaa5;
  background: var(--bad-bg);
  color: var(--bad);
}

.badge.warn {
  border-color: #f2d27d;
  background: var(--warn-bg);
  color: var(--warn);
}

.badge.gold {
  border-color: #e4bd5c;
  background: var(--gold-bg);
  color: var(--gold);
}

.gold-panel {
  box-shadow: inset 0 4px 0 var(--gold);
}

.contest-hero {
  box-shadow: inset 0 4px 0 var(--gold);
}

.podium {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  border: 0;
  background: transparent;
}

.podium-card {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  grid-template-areas: "info visual";
  gap: 14px;
  align-items: center;
  min-height: 112px;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  direction: rtl;
}

.podium-card.place-1 {
  border-color: #e4bd5c;
  background: linear-gradient(90deg, #fff7df, #fff);
}

.podium-info {
  display: grid;
  grid-area: info;
  gap: 6px;
  justify-items: start;
  direction: rtl;
  text-align: right;
}

.podium-visual {
  display: grid;
  grid-area: visual;
  place-items: center;
  justify-self: end;
}

.podium-card:not(.place-1) .podium-visual {
  visibility: hidden;
}

.podium-card.place-2 {
  background: linear-gradient(180deg, #f2f6f8, #fff);
}

.podium-card.place-3 {
  background: linear-gradient(180deg, #fff1e8, #fff);
}

.podium-card span,
.podium-card small {
  color: var(--muted);
  font-weight: 800;
}

.podium-card strong {
  font-size: 1.05rem;
}

.podium-crown {
  width: 48px;
  height: auto;
  object-fit: contain;
}

.countdown-box {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(320px, 1.4fr);
  gap: 18px;
  align-items: center;
  margin-top: 0;
  padding: 20px;
  border-color: #e4bd5c;
  background: linear-gradient(270deg, #fff7df, #ffffff 44%);
}

.countdown-box > div:first-child {
  display: grid;
  gap: 7px;
}

.countdown-box span {
  color: var(--muted);
  font-weight: 800;
}

.countdown-box > div:first-child > span {
  color: var(--gold);
  font-size: .78rem;
  text-transform: uppercase;
}

.countdown-box > div:first-child > strong {
  font-size: 1.3rem;
}

.countdown-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.countdown-grid article {
  display: grid;
  min-height: 86px;
  place-items: center;
  padding: 12px;
  border: 1px solid #e4bd5c;
  border-radius: 8px;
  background: #fff;
}

.countdown-grid strong {
  color: var(--gold);
  font-size: 2rem;
  line-height: 1;
}

.countdown-grid span {
  font-size: .78rem;
  text-transform: uppercase;
}

.contest-member {
  display: flex;
  min-width: 240px;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.leader-trophy {
  width: 54px;
  height: 34px;
  object-fit: contain;
}

.winner-row td {
  background: #fffaf0;
  font-weight: 800;
}

.rank-first td {
  background: #fff7df;
}

.rank-second td {
  background: #f2f6f8;
}

.rank-third td {
  background: #fff1e8;
}

.contest-progress {
  width: min(180px, 100%);
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e4ebef;
}

.contest-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--gold), var(--good));
}

.split-panels {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(280px, .75fr);
  gap: 18px;
  border: 0;
  background: transparent;
}

.bar-list {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.bar-row {
  display: grid;
  gap: 7px;
}

.bar-row div:first-child {
  display: flex;
  gap: 10px;
  justify-content: space-between;
}

.bar-row span {
  color: var(--muted);
}

.bar-track {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #e4ebef;
}

.bar-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.table {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: right;
  white-space: nowrap;
}

th {
  color: var(--muted);
  font-size: .78rem;
  text-transform: uppercase;
}

@media (max-width: 850px) {
  .cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .home-hero,
  .admin-title {
    align-items: start;
    flex-direction: column;
  }

  .home-grid,
  .cards.mini,
  .login-choice,
  .shift-summary,
  .shift-card-grid,
  .fund-hero-card,
  .wealth-grid.four,
  .wealth-grid.three,
  .deposits-layout,
  .target-grid,
  .admin-form,
  .filter-box form,
  .charts,
  .countdown-box,
  .split-panels {
    grid-template-columns: 1fr;
  }

  .podium-card,
  .podium-card.place-1 {
    grid-template-columns: 52px minmax(0, 1fr);
  }

  .podium-crown {
    width: 42px;
  }

  .login .login-choice {
    grid-template-columns: 1fr;
    gap: 24px;
    padding: 18px;
  }

  .portal-login-card {
    min-height: auto;
    padding: 24px;
  }
}

@media (max-width: 520px) {
  header {
    align-items: center;
    flex-direction: column;
    gap: 12px;
    padding-inline: 12px;
  }

  .overview-header,
  .section-title,
  .target-card-head,
  .shift-hero,
  .contract-head {
    align-items: start;
    flex-direction: column;
  }

  .overview-header,
  .fund-hero-card,
  .dashboard-section {
    padding: 18px;
  }

  .updated-pill {
    width: 100%;
    text-align: left;
  }

  .deposit-comparison,
  .target-rows,
  .inline-upload {
    grid-template-columns: 1fr;
  }

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

/* SDM1337 third access panel */
.login .login-choice{grid-template-columns:repeat(3,minmax(0,1fr));max-width:calc(100vw - 48px)}
.sdm-entry{display:block;text-align:center;padding:15px 20px;background:#007e83;color:white;border-radius:6px;text-decoration:none;margin-top:auto}.sdm-login-card{border-top:4px solid #007e83}
@media(max-width:900px){.login .login-choice{grid-template-columns:1fr}}
