:root {
  --ap-forest: #163a2a;
  --ap-forest-2: #20543d;
  --ap-mint: #e9f4ed;
  --ap-cream: #f8f7f1;
  --ap-ink: #18251f;
  --ap-muted: #607068;
  --ap-line: #d8e2dc;
  --ap-danger: #9d2f2f;
  --ap-warning: #8a5c00;
  --ap-shadow: 0 18px 55px rgba(12, 34, 24, .24);
}

#acreplan-account-launcher {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 4200;
  min-height: 44px;
  padding: 9px 14px;
  border: 1px solid rgba(255,255,255,.32);
  border-radius: 13px;
  background: var(--ap-forest);
  color: #fff;
  font: 700 14px/1.15 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  box-shadow: 0 8px 26px rgba(0,0,0,.24);
  cursor: pointer;
  touch-action: manipulation;
}
#acreplan-account-launcher:hover { background: var(--ap-forest-2); }
#acreplan-account-launcher .ap-status-dot {
  display: inline-block; width: 8px; height: 8px; margin-right: 7px;
  border-radius: 50%; background: #f2bd52; vertical-align: 1px;
}
#acreplan-account-launcher[data-authenticated="true"] .ap-status-dot { background: #69d48b; }

#acreplan-account-shell {
  position: fixed;
  inset: 0;
  z-index: 5000;
  display: none;
  background: rgba(7, 17, 12, .45);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ap-ink);
}
#acreplan-account-shell.ap-open { display: block; }
#acreplan-account-panel {
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: min(470px, 94vw);
  background: var(--ap-cream);
  box-shadow: var(--ap-shadow);
  overflow: hidden;
  display: grid;
  grid-template-rows: auto auto 1fr;
}
.ap-account-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 18px 18px 14px;
  color: #fff; background: linear-gradient(135deg, var(--ap-forest), #27714e);
}
.ap-account-title { margin: 0; font-size: 22px; letter-spacing: -.02em; }
.ap-account-subtitle { margin: 3px 0 0; font-size: 12px; opacity: .82; }
.ap-icon-button, .ap-button {
  min-height: 42px; border: 0; border-radius: 11px; cursor: pointer;
  font: 700 14px/1 system-ui, sans-serif; touch-action: manipulation;
}
.ap-icon-button { min-width: 42px; background: rgba(255,255,255,.16); color: #fff; font-size: 20px; }
.ap-button { padding: 0 15px; background: var(--ap-forest); color: #fff; }
.ap-button:hover { filter: brightness(1.08); }
.ap-button.ap-secondary { color: var(--ap-forest); background: #e2ece6; }
.ap-button.ap-quiet { color: var(--ap-ink); background: #fff; border: 1px solid var(--ap-line); }
.ap-button.ap-danger { background: var(--ap-danger); }
.ap-button[disabled] { opacity: .55; cursor: not-allowed; }
.ap-tabs {
  display: flex; gap: 4px; padding: 8px 10px; overflow-x: auto;
  border-bottom: 1px solid var(--ap-line); background: #fff;
}
.ap-tab {
  flex: 0 0 auto; min-height: 40px; padding: 0 12px; border: 0; border-radius: 10px;
  color: var(--ap-muted); background: transparent; font-weight: 750; cursor: pointer;
}
.ap-tab[aria-selected="true"] { color: var(--ap-forest); background: var(--ap-mint); }
.ap-tab[data-admin-only="true"] { display: none; }
#acreplan-account-panel[data-role="admin"] .ap-tab[data-admin-only="true"] { display: inline-block; }
.ap-account-body { overflow-y: auto; padding: 16px 18px 38px; overscroll-behavior: contain; }
.ap-view[hidden] { display: none !important; }
.ap-card {
  padding: 15px; margin: 0 0 13px; border: 1px solid var(--ap-line);
  border-radius: 14px; background: #fff; box-shadow: 0 4px 15px rgba(24,57,41,.05);
}
.ap-card h3 { margin: 0 0 8px; font-size: 16px; }
.ap-card p { margin: 6px 0; color: var(--ap-muted); font-size: 13px; line-height: 1.45; }
.ap-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ap-stack { display: grid; gap: 10px; }
.ap-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.ap-field { display: grid; gap: 5px; }
.ap-field label { font-size: 12px; font-weight: 800; color: var(--ap-muted); }
.ap-field input, .ap-field textarea, .ap-field select {
  width: 100%; min-height: 43px; box-sizing: border-box; padding: 10px 11px;
  border: 1px solid #cdd9d2; border-radius: 10px; background: #fff; color: var(--ap-ink);
  font: 15px/1.3 system-ui, sans-serif;
}
.ap-field textarea { min-height: 82px; resize: vertical; }
.ap-message { padding: 10px 12px; border-radius: 10px; font-size: 13px; line-height: 1.35; }
.ap-message.ap-info { background: #e8f1f7; color: #234e68; }
.ap-message.ap-success { background: #e5f5e9; color: #1f6737; }
.ap-message.ap-warning { background: #fff4d7; color: #744d00; }
.ap-message.ap-error { background: #fbe7e7; color: #842424; }
.ap-kpi-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 9px; }
.ap-kpi { padding: 12px; border-radius: 12px; background: var(--ap-mint); }
.ap-kpi strong { display: block; font-size: 23px; color: var(--ap-forest); }
.ap-kpi span { font-size: 11px; color: var(--ap-muted); }
.ap-list { display: grid; gap: 9px; }
.ap-list-item { padding: 12px; border: 1px solid var(--ap-line); border-radius: 12px; background: #fff; }
.ap-list-item strong { display: block; margin-bottom: 3px; }
.ap-list-item small { color: var(--ap-muted); }
.ap-badge { display: inline-block; padding: 4px 8px; border-radius: 999px; background: #e7eee9; color: var(--ap-forest); font-size: 11px; font-weight: 800; text-transform: capitalize; }
.ap-badge[data-status="pending"] { background: #fff0c4; color: #745000; }
.ap-badge[data-status="verified"] { background: #dbf3e2; color: #206036; }
.ap-badge[data-status="rejected"] { background: #f8dddd; color: #822727; }
.ap-badge[data-status="needs_more_information"] { background: #e5e8f8; color: #3e477c; }
.ap-divider { height: 1px; margin: 14px 0; background: var(--ap-line); }
.ap-user-line { font-size: 13px; word-break: break-word; }
.ap-private-owner {
  margin-top: 10px; padding: 10px 11px; border-left: 4px solid #7049a8;
  border-radius: 8px; background: #f0eafa; color: #4e2e79; font-size: 12px;
}
.ap-config-code { padding: 9px; border-radius: 8px; background: #15231c; color: #dbece2; font: 12px/1.45 ui-monospace, SFMono-Regular, Menlo, monospace; overflow-wrap: anywhere; }
.ap-sr-only { position: absolute!important; width: 1px!important; height: 1px!important; padding: 0!important; margin: -1px!important; overflow: hidden!important; clip: rect(0,0,0,0)!important; white-space: nowrap!important; border: 0!important; }

@media (max-width: 720px) {
  #acreplan-account-launcher { top: auto; right: 10px; bottom: calc(11px + env(safe-area-inset-bottom)); min-height: 48px; }
  #acreplan-account-panel {
    top: max(7vh, 46px); left: 0; right: 0; bottom: 0; width: 100%;
    border-radius: 18px 18px 0 0;
  }
  .ap-account-body { padding-bottom: calc(30px + env(safe-area-inset-bottom)); }
  .ap-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: no-preference) {
  #acreplan-account-panel { animation: ap-slide .17s ease-out; }
  @keyframes ap-slide { from { transform: translateX(16px); opacity: .75; } to { transform: none; opacity: 1; } }
  @media (max-width: 720px) { @keyframes ap-slide { from { transform: translateY(22px); opacity: .75; } to { transform: none; opacity: 1; } } }
}
