/* Atlas Day 4.9.2: personal finance discipline and consent-based messaging. */

/* Branding must not depend on the JavaScript release number.  The previous
   selector was tied to 4.8.5, so after an upgrade the intrinsic image size
   could cover the whole sidebar and intercept every navigation click. */
.brand .brand-mark[data-atlas-logo] {
  background: #fff;
  border: 1px solid rgba(96, 239, 255, .42);
  border-radius: 13px;
  box-shadow: 0 5px 18px rgba(0, 131, 176, .2);
  flex: 0 0 42px;
  height: 42px;
  overflow: hidden;
  width: 42px;
}

.brand .brand-mark[data-atlas-logo] > img {
  display: block;
  height: 100%;
  max-height: 42px;
  max-width: 42px;
  object-fit: cover;
  pointer-events: none;
  width: 100%;
}

.creator-credit[data-atlas-credit] {
  align-items: center;
  color: rgba(255, 255, 255, .78);
  display: flex;
  font-family: Inter, sans-serif;
  font-size: 10px;
  font-weight: 650;
  gap: 8px;
  letter-spacing: .035em;
  line-height: 1.25;
  min-height: 42px;
  padding: 7px 9px;
}

.creator-credit[data-atlas-credit] > img {
  background: #fff;
  border-radius: 9px;
  display: block;
  flex: 0 0 34px;
  height: 34px;
  max-height: 34px;
  max-width: 34px;
  object-fit: cover;
  pointer-events: none;
  width: 34px;
}

.atlas-messenger-tools {
  display: grid;
  gap: 6px;
  grid-template-columns: 1fr 82px;
  margin-top: 7px;
}

.atlas-messenger-tool {
  background: rgba(255, 255, 255, .055);
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 9px;
  color: #c8d1e2;
  font-size: 9px;
  min-height: 32px;
  padding: 6px 8px;
}

.atlas-messenger-tool:hover { border-color: rgba(96, 239, 255, .32); color: #e7fcff; }
.atlas-conversation-items { height: calc(100% - 184px); }

.atlas-messenger-request,
.atlas-care-row {
  align-items: center;
  background: rgba(96, 239, 255, .06);
  border: 1px solid rgba(96, 239, 255, .12);
  border-radius: 12px;
  display: grid;
  gap: 8px;
  grid-template-columns: 34px minmax(0, 1fr);
  margin: 5px 0;
  padding: 8px;
}

.atlas-messenger-request .atlas-thread-avatar,
.atlas-care-row .atlas-thread-avatar { border-radius: 11px; flex-basis: 34px; height: 34px; width: 34px; }
.atlas-messenger-request .atlas-request-actions { grid-column: 1 / -1; }
.atlas-request-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.atlas-request-accept,
.atlas-request-decline {
  border-radius: 8px;
  font-size: 9px;
  min-height: 30px;
  padding: 6px 9px;
}
.atlas-request-accept { background: #087f68; border: 1px solid #19a68b; color: #fff; }
.atlas-request-decline { background: transparent; border: 1px solid rgba(255, 255, 255, .16); color: #c8d1e2; }

.atlas-messaging-settings { display: flex; flex-direction: column; gap: 10px; }
.atlas-privacy-toggle {
  align-items: flex-start;
  background: rgba(65, 88, 208, .13);
  border: 1px solid rgba(96, 239, 255, .16);
  border-radius: 12px;
  display: grid;
  gap: 9px;
  grid-template-columns: auto 1fr;
  padding: 10px;
}
.atlas-privacy-toggle input { margin-top: 2px; }
.atlas-privacy-toggle strong,
.atlas-privacy-toggle small,
.atlas-care-row strong,
.atlas-care-row small { display: block; }
.atlas-privacy-toggle small,
.atlas-care-row small { color: #8f9bb4; font-size: 9px; margin-top: 4px; }
.atlas-care-form { display: grid; gap: 7px; }
.atlas-care-form strong,
.atlas-care-form small { display: block; }
.atlas-care-form small { color: #8f9bb4; font-size: 9px; }
.atlas-care-form input { background: rgba(255,255,255,.07); border-color: rgba(255,255,255,.13); color: #fff; font-size: 16px; min-height: 40px; }
.atlas-support-warning { background: rgba(245, 158, 11, .12); border: 1px solid rgba(245, 158, 11, .28); border-radius: 10px; color: #ffdca0; font-size: 10px; line-height: 1.45; margin: 0 auto 8px; max-width: 720px; padding: 8px 10px; width: 100%; }

.atlas-personal-messenger-stage {
  margin-left: 256px;
  min-height: 100vh;
  padding: 28px 28px 28px 340px;
}
.atlas-personal-messenger-empty {
  align-items: center;
  background: linear-gradient(145deg, rgba(255,255,255,.82), rgba(240,248,250,.72));
  border: 1px solid #e2e8f0;
  border-radius: 18px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: calc(100vh - 56px);
  padding: 28px;
  text-align: center;
}
.atlas-personal-messenger-empty h1 { margin: 3px 0 8px; }
.atlas-personal-messenger-empty > p:last-child { color: #64748b; max-width: 460px; }
body.atlas-personal-messenger main.content { display: none !important; }
body.atlas-personal-messenger.atlas-messenger-direct .atlas-personal-messenger-empty { visibility: hidden; }

.atlas-finance-planner {
  background: linear-gradient(150deg, #fff, #f6fbfd);
  border: 1px solid #dbe7eb;
  border-radius: 18px;
  box-shadow: 0 12px 38px rgba(15, 23, 42, .06);
  margin: 18px 0 22px;
  overflow: hidden;
}

.atlas-finance-header {
  align-items: end;
  background: linear-gradient(135deg, #0f172a, #123953);
  color: #fff;
  display: flex;
  gap: 18px;
  justify-content: space-between;
  padding: 18px 20px;
}
.atlas-finance-header p { color: #79e8f5; font: 700 10px/1.2 Montserrat, sans-serif; letter-spacing: .1em; margin: 0 0 5px; text-transform: uppercase; }
.atlas-finance-header h2 { color: #fff; font-size: 20px; margin: 0; }
.atlas-finance-header label { color: #bed0dd; display: grid; font-size: 10px; gap: 4px; }
.atlas-finance-header input { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.22); color: #fff; min-height: 38px; }
.atlas-finance-loading { color: #64748b; padding: 24px; text-align: center; }
.atlas-finance-body { display: grid; gap: 16px; padding: 18px; }
.atlas-finance-kpis { display: grid; gap: 10px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.atlas-finance-kpi { border: 1px solid #e2e8f0; border-left: 4px solid #00b4db; border-radius: 13px; padding: 12px; }
.atlas-finance-kpi.expense { border-left-color: #ef4444; }
.atlas-finance-kpi.balance { border-left-color: #10b981; }
.atlas-finance-kpi.available { border-left-color: #7c3aed; }
.atlas-finance-kpi small { color: #64748b; display: block; font-size: 10px; }
.atlas-finance-kpi strong { color: #0f172a; display: block; font: 700 20px/1.2 Montserrat, sans-serif; margin-top: 5px; }

.atlas-finance-grid { display: grid; gap: 14px; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); }
.atlas-finance-card { background: #fff; border: 1px solid #e2e8f0; border-radius: 15px; padding: 15px; }
.atlas-finance-card h3 { font-size: 15px; margin: 0 0 12px; }
.atlas-finance-goals { display: grid; gap: 10px; grid-template-columns: 1fr 1fr; }
.atlas-finance-goals label,
.atlas-category-limit { color: #475569; display: grid; font-size: 10px; gap: 4px; }
.atlas-finance-goals input,
.atlas-category-limit input { min-height: 38px; }
.atlas-category-limits { display: grid; gap: 8px; grid-column: 1 / -1; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.atlas-category-limit { align-items: center; grid-template-columns: minmax(0, 1fr) 110px; }
.atlas-finance-save { background: linear-gradient(135deg, #00b4db, #0083b0); border: 0; border-radius: 10px; color: #fff; font-weight: 750; grid-column: 1 / -1; min-height: 40px; }
.atlas-finance-save-status { color: #64748b; font-size: 10px; grid-column: 1 / -1; margin: 0; }
.atlas-finance-progress { margin: 10px 0 0; }
.atlas-finance-progress div { align-items: center; display: flex; font-size: 10px; justify-content: space-between; }
.atlas-finance-progress i { background: #e8eef2; border-radius: 99px; display: block; height: 7px; margin-top: 5px; overflow: hidden; }
.atlas-finance-progress b { background: linear-gradient(90deg, #00b4db, #10b981); border-radius: inherit; display: block; height: 100%; max-width: 100%; }
.atlas-finance-progress.expense b { background: linear-gradient(90deg, #f59e0b, #ef4444); }
.atlas-finance-advice { background: #effbfd; border: 1px solid #c8eef3; border-radius: 12px; color: #24455a; line-height: 1.5; margin: 12px 0 0; padding: 11px; }
.atlas-finance-advice strong { color: #0f5c70; display: block; margin-bottom: 3px; }
.atlas-finance-disclaimer { color: #64748b; display: block; font-size: 9px; margin-top: 7px; }

.atlas-finance-chart { align-items: end; display: grid; gap: 9px; grid-template-columns: repeat(6, 1fr); height: 190px; padding-top: 20px; }
.atlas-finance-month-bar { align-items: stretch; display: flex; flex-direction: column; height: 100%; justify-content: end; min-width: 0; text-align: center; }
.atlas-finance-bars { align-items: end; display: flex; flex: 1; gap: 3px; justify-content: center; }
.atlas-finance-bars i { border-radius: 6px 6px 2px 2px; display: block; min-height: 2px; width: 38%; }
.atlas-finance-bars .income { background: #00b4db; }
.atlas-finance-bars .expense { background: #ef6b6b; }
.atlas-finance-month-bar small { color: #64748b; font-size: 9px; margin-top: 6px; }
.atlas-finance-legend { color: #64748b; display: flex; font-size: 9px; gap: 12px; margin-top: 8px; }
.atlas-finance-legend i { border-radius: 50%; display: inline-block; height: 7px; margin-right: 4px; width: 7px; }

.atlas-finance-history { overflow-x: auto; }
.atlas-finance-history table { min-width: 640px; width: 100%; }
.atlas-finance-history th,
.atlas-finance-history td { font-size: 10px; padding: 8px 6px; text-align: left; }
.atlas-finance-edit { background: transparent; border: 0; color: #007897; font-size: 10px; padding: 4px; text-decoration: underline; }
.atlas-finance-dialog { border: 0; border-radius: 17px; box-shadow: 0 22px 70px rgba(15,23,42,.28); max-width: 520px; padding: 0; width: calc(100% - 28px); }
.atlas-finance-dialog::backdrop { background: rgba(15,23,42,.5); }
.atlas-finance-dialog form { display: grid; gap: 10px; padding: 18px; }
.atlas-finance-dialog h3 { margin: 0 0 3px; }
.atlas-finance-dialog label { color: #475569; display: grid; font-size: 11px; gap: 4px; }
.atlas-finance-dialog menu { display: flex; gap: 8px; justify-content: flex-end; margin: 5px 0 0; padding: 0; }
.atlas-finance-dialog button { min-height: 38px; }

.kap-widget.atlas-finance-happy .kap-body { animation: atlas-kap-happy .65s ease 2; filter: drop-shadow(0 0 12px rgba(16,185,129,.72)); }
.kap-widget.atlas-finance-alert .kap-body { animation: atlas-kap-alert .42s ease 3; filter: drop-shadow(0 0 12px rgba(239,68,68,.7)); }
.atlas-kap-finance-speech { background: #fff; border: 1px solid #d7e9ed; border-radius: 14px; bottom: calc(100% + 8px); box-shadow: 0 10px 28px rgba(15,23,42,.16); color: #24455a; font-size: 11px; line-height: 1.4; padding: 9px 11px; position: absolute; right: 0; width: 220px; z-index: 4; }
@keyframes atlas-kap-happy { 50% { transform: translateY(-8px) scale(1.07); } }
@keyframes atlas-kap-alert { 25% { transform: rotate(-5deg); } 75% { transform: rotate(5deg); } }

@media (width <= 980px) {
  .atlas-personal-messenger-stage { margin-left: 244px; padding-left: 292px; }
  .atlas-finance-kpis { grid-template-columns: repeat(2, 1fr); }
}

@media (width <= 760px) {
  .atlas-personal-messenger-stage { display: none; }
  .atlas-messenger-tools { grid-template-columns: 1fr 78px; }
  .atlas-finance-planner { border-radius: 14px; margin-left: -4px; margin-right: -4px; }
  .atlas-finance-header { align-items: stretch; flex-direction: column; padding: 15px; }
  .atlas-finance-body { padding: 12px; }
  .atlas-finance-grid { grid-template-columns: 1fr; }
  .atlas-finance-kpis { grid-template-columns: 1fr 1fr; }
  .atlas-finance-kpi strong { font-size: 16px; }
  .atlas-category-limits { grid-template-columns: 1fr; }
  .atlas-finance-chart { gap: 5px; height: 160px; }
  .atlas-kap-finance-speech { bottom: auto; position: fixed; right: 8px; top: calc(58px + env(safe-area-inset-top)); }
}

@media (width <= 390px) {
  .atlas-finance-kpis { grid-template-columns: 1fr; }
  .atlas-finance-goals { grid-template-columns: 1fr; }
  .atlas-category-limits,
  .atlas-finance-save,
  .atlas-finance-save-status { grid-column: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .kap-widget.atlas-finance-happy .kap-body,
  .kap-widget.atlas-finance-alert .kap-body { animation: none; }
}
