:root {
  color-scheme: light;
  --bg: #eef9fc;
  --bg-warm: #fffdf5;
  --surface: #ffffff;
  --surface-soft: #f7fbff;
  --text: #061637;
  --muted: #66758d;
  --line: #d9e5f0;
  --line-strong: #c5d5e4;
  --blue: #0478df;
  --blue-strong: #005fc8;
  --navy: #071d3f;
  --orange: #ff9a63;
  --pink: #ffa5be;
  --green: #50c7a8;
  --violet: #8d7cf6;
  --yellow: #ffd45c;
  --shadow: 0 18px 44px rgba(32, 61, 94, 0.12);
  --soft-shadow: 0 10px 24px rgba(32, 61, 94, 0.09);
  --radius: 8px;
  font-family: "Noto Sans JP", "Hiragino Kaku Gothic ProN", "Yu Gothic", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background:
    linear-gradient(135deg, rgba(255, 245, 207, 0.75), rgba(226, 248, 255, 0.86) 44%, rgba(232, 249, 255, 0.95));
  color: var(--text);
  font-size: 15px;
  line-height: 1.55;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
}

.boot-screen,
.login-page,
.tg-app {
  min-height: 100vh;
}

.boot-screen {
  display: grid;
  place-items: center;
  color: var(--muted);
}

.icon {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: 0 0 auto;
}

.login-page {
  display: grid;
  place-items: center;
  padding: 34px;
}

.login-card {
  width: min(840px, calc(100vw - 64px));
  padding: 46px 62px 26px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-lockup.login {
  justify-content: flex-start;
  margin-bottom: 30px;
}

.brand-lockup strong {
  display: block;
  color: #071d3f;
  font-size: 1.35rem;
  font-weight: 900;
  line-height: 1.1;
}

.brand-lockup small {
  display: block;
  margin-top: 4px;
  color: #59677c;
  font-weight: 800;
}

.brand-logo {
  position: relative;
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 2px solid #091a3a;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(235, 247, 255, 0.96));
  box-shadow: 0 8px 18px rgba(5, 25, 58, 0.12);
}

.brand-logo span {
  color: #071d3f;
  font-size: 1.3rem;
  font-weight: 900;
}

.login-form {
  display: grid;
  gap: 18px;
}

.loading-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid #cfe6ff;
  border-radius: 8px;
  background: #edf7ff;
  color: #134f72;
  font-weight: 900;
}

.loading-banner .icon {
  animation: spin 0.9s linear infinite;
}

.login-options {
  display: grid;
  gap: 8px;
  color: #526176;
  font-size: 0.86rem;
  font-weight: 800;
}

.login-options label {
  display: flex;
  gap: 8px;
  align-items: center;
}

.auth-mode-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 18px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f5faff;
}

.auth-mode-tabs button {
  min-height: 42px;
  border-radius: 6px;
  background: transparent;
  color: #24415f;
  cursor: pointer;
  font-weight: 900;
}

.auth-mode-tabs button.active {
  background: #fff;
  color: var(--blue);
  box-shadow: var(--soft-shadow);
}

.auth-title {
  margin: 0 0 16px;
  color: #071d3f;
  font-size: 1.4rem;
  line-height: 1.25;
}

.auth-form-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.auth-form-grid .auth-policy-note,
.auth-form-grid .login-button,
.auth-form-grid .status-message {
  grid-column: 1 / -1;
}

.auth-policy-note {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 14px 16px;
  border: 1px solid #cfe6ff;
  border-radius: 8px;
  background: #f2f9ff;
  color: #173252;
  font-weight: 800;
}

.reset-help {
  padding-top: 4px;
}

.field {
  display: grid;
  gap: 8px;
}

.field span,
.field-caption,
.design-grid-field > span {
  color: #0a1a37;
  font-size: 0.92rem;
  font-weight: 900;
}

.field input,
.field select,
.field textarea,
.soft-select {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  outline: none;
}

.field input,
.field select,
.soft-select {
  height: 46px;
  padding: 0 14px;
}

.field textarea {
  min-height: 132px;
  padding: 13px 14px;
  resize: vertical;
}

.field small {
  color: var(--muted);
  font-size: 0.78rem;
}

.field.with-icon > div {
  display: flex;
  align-items: center;
  gap: 9px;
  height: 46px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #fff;
}

.field.with-icon input {
  height: auto;
  padding: 0;
  border: 0;
}

.primary-button,
.secondary-button,
.ghost-button,
.icon-button,
.link-button,
.send-button,
.user-menu-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
}

.primary-button {
  padding: 0 18px;
  background: linear-gradient(135deg, #08a8e9, #005ed0);
  color: #fff;
  font-weight: 900;
  box-shadow: 0 10px 22px rgba(0, 104, 216, 0.24);
}

.secondary-button,
.ghost-button {
  padding: 0 16px;
  border: 1px solid var(--line-strong);
  background: #fff;
  color: var(--text);
  font-weight: 900;
}

.ghost-button {
  background: transparent;
}

.icon-button {
  width: 42px;
  padding: 0;
  border: 1px solid var(--line-strong);
  background: #fff;
  color: #0b2147;
}

.primary-button:disabled,
.secondary-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.login-button {
  width: 100%;
  min-height: 58px;
  font-size: 1.04rem;
}

.login-links {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  align-items: center;
  padding: 4px 0 8px;
  border-bottom: 1px solid #e8eef5;
}

.link-button {
  min-height: 34px;
  background: transparent;
  color: var(--blue);
  font-weight: 900;
}

.first-use-title {
  text-align: center;
  color: #0b1e42;
  font-weight: 900;
}

.role-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

.role-grid button {
  display: grid;
  min-height: 74px;
  place-items: center;
  gap: 6px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  color: #0d2a57;
  cursor: pointer;
  font-weight: 900;
}

.status-message {
  min-height: 22px;
  color: #d22f4c;
  font-weight: 900;
}

.login-support {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 16px;
  color: #7a8797;
  font-weight: 800;
}

.tg-app {
  width: min(1440px, calc(100vw - 52px));
  min-height: calc(100vh - 52px);
  margin: 26px auto;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 252, 238, 0.9), rgba(238, 251, 255, 0.96) 45%, rgba(236, 249, 255, 0.92));
  box-shadow: var(--shadow);
}

.app-topbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto minmax(300px, 1fr);
  gap: 20px;
  align-items: center;
  min-height: 86px;
  padding: 0 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
}

.top-metrics,
.top-actions,
.badge-row,
.form-actions,
.dialog-actions,
.filter-tabs,
.load-more-row,
.row-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.top-metric {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 140px;
  min-height: 54px;
  padding: 0 16px;
  border: 1px solid #dce8f3;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 16px rgba(37, 77, 116, 0.06);
}

.top-metric .icon {
  color: var(--blue);
}

.top-metric span,
.top-metric small {
  display: block;
  color: #526176;
  font-size: 0.75rem;
  font-weight: 800;
}

.top-metric strong {
  display: block;
  font-size: 1.02rem;
  font-weight: 900;
}

.top-actions {
  justify-content: flex-end;
}

.notification-button {
  position: relative;
}

.notification-button span {
  position: absolute;
  top: 8px;
  right: 8px;
  min-width: 9px;
  height: 16px;
  padding: 0 4px;
  border: 2px solid #fff;
  border-radius: 999px;
  background: #ff1d32;
  color: #fff;
  font-size: 0.63rem;
  font-weight: 900;
  line-height: 12px;
}

.notification-button span:empty {
  display: none;
}

.user-menu-button {
  min-width: 168px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  background: #fff;
  color: #071d3f;
  font-weight: 900;
}

.logout-button .icon {
  transform: rotate(180deg);
}

.app-body {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr) 306px;
  min-height: calc(100vh - 138px);
}

.workspace-mode .app-body {
  grid-template-columns: 112px minmax(0, 1fr);
}

.side-nav {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  padding: 30px 14px;
  border-right: 1px solid rgba(205, 220, 235, 0.7);
}

.side-nav-list {
  display: grid;
  gap: 14px;
}

.nav-button {
  display: grid;
  width: 76px;
  height: 76px;
  place-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: #082044;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(46, 78, 110, 0.06);
  font-size: 0.78rem;
  font-weight: 900;
}

.nav-button.active {
  border-color: #05254f;
  background: linear-gradient(145deg, #083561, #001b3e);
  color: #fff;
}

.mobile-label {
  display: none;
}

.support-tile {
  display: grid;
  width: 76px;
  min-height: 150px;
  margin-top: auto;
  place-items: center;
  gap: 10px;
  padding: 12px 8px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.68);
  color: #09224a;
  text-align: center;
  font-size: 0.75rem;
  font-weight: 900;
}

.support-tile .icon {
  color: var(--blue);
}

.content-stage {
  min-width: 0;
  padding: 34px 30px;
}

.insight-column {
  display: grid;
  align-content: start;
  gap: 18px;
  padding: 34px 24px 28px 0;
}

.page-section {
  display: grid;
  gap: 18px;
}

.page-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.page-heading h1 {
  margin: 0;
  color: #071d3f;
  font-size: 1.75rem;
  line-height: 1.18;
}

.page-heading p {
  margin: 8px 0 0;
  color: #526176;
  font-weight: 800;
}

.soft-select {
  max-width: 132px;
}

.filter-tabs {
  flex-wrap: wrap;
}

.filter-tabs button {
  min-height: 42px;
  padding: 0 18px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  color: #0b254f;
  cursor: pointer;
  font-weight: 900;
}

.filter-tabs button.active {
  border-color: var(--blue);
  background: linear-gradient(135deg, #0aa8e8, #046fd5);
  color: #fff;
}

.field-error {
  color: #b42318;
  font-weight: 900;
}

.letter-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.letter-list.compact {
  display: grid;
  gap: 14px;
}

.letter-card {
  position: relative;
  min-height: 266px;
  overflow: hidden;
  padding: 24px 20px 16px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--soft-shadow);
  contain: layout paint;
}

.letter-card.sunrise { background: linear-gradient(154deg, #fff0da, #fffaf2 54%, #eefaff); border-color: #f3ccb0; }
.letter-card.bouquet { background: linear-gradient(154deg, #fff0f3, #fff 54%, #effcff); border-color: #f3c5d1; }
.letter-card.aurora { background: linear-gradient(154deg, #f0edff, #fff 56%, #eafcff); border-color: #cbc8ff; }
.letter-card.sky { background: linear-gradient(154deg, #e1f8ff, #fff 55%, #edf7ff); border-color: #b7dff1; }
.letter-card.starry { background: linear-gradient(154deg, #f2ecff, #fff 55%, #f6f0ff); border-color: #d2c0f3; }
.letter-card.note { background: linear-gradient(154deg, #e8fff8, #fff 54%, #f4fffb); border-color: #bce9db; }

.letter-glow {
  position: absolute;
  inset: 0 0 auto;
  height: 82px;
  background: linear-gradient(90deg, rgba(255, 132, 88, 0.68), rgba(255, 215, 102, 0.45), rgba(95, 200, 225, 0.25));
  pointer-events: none;
}

.letter-card.sky .letter-glow { background: linear-gradient(90deg, rgba(73, 193, 226, 0.68), rgba(227, 250, 255, 0.7)); }
.letter-card.note .letter-glow { background: linear-gradient(90deg, rgba(78, 207, 178, 0.64), rgba(235, 255, 248, 0.75)); }
.letter-card.starry .letter-glow { background: linear-gradient(90deg, rgba(183, 105, 219, 0.6), rgba(246, 233, 255, 0.7)); }

.stamp-orb,
.preview-stamp,
.preview-sparkle {
  position: absolute;
  display: grid;
  place-items: center;
  border-radius: 50%;
}

.stamp-orb {
  top: 34px;
  right: 22px;
  width: 58px;
  height: 58px;
  border: 5px solid #fff;
  background: linear-gradient(145deg, #ffb875, #ffdf7a);
  color: #fff;
  box-shadow: var(--soft-shadow);
  z-index: 1;
}

.letter-card.sky .stamp-orb { background: linear-gradient(145deg, #6dd8f6, #7877ff); }
.letter-card.note .stamp-orb { background: linear-gradient(145deg, #6ddfc8, #5fb7e8); }
.letter-card.starry .stamp-orb { background: linear-gradient(145deg, #bb8df6, #8c70df); }

.letter-from,
.letter-to {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 10px;
}

.letter-from strong,
.letter-to strong {
  display: block;
  color: #071d3f;
  font-weight: 900;
}

.letter-from span,
.letter-to span,
.letter-card footer,
.empty,
.form-note {
  color: #607086;
}

.letter-to {
  margin-top: 22px;
}

.letter-to span {
  color: var(--blue);
  font-weight: 900;
}

.letter-message {
  position: relative;
  z-index: 1;
  min-height: 78px;
  margin: 14px 0 16px;
  padding: 14px;
  border: 1px solid rgba(222, 199, 180, 0.95);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.58);
  color: #082044;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.letter-card footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.86rem;
  font-weight: 800;
}

.letter-card footer button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  color: #314767;
  cursor: pointer;
}

.load-more-row {
  justify-content: center;
}

.pill-button {
  border-radius: 999px;
}

.floating-send {
  display: none;
}

.insight-card,
.profile-hero,
.small-panel,
.account-menu-panel,
.settings-card,
.password-card,
.report-list-panel,
.summary-tile {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--soft-shadow);
}

.insight-card {
  padding: 20px;
}

.insight-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.insight-card h2,
.small-panel h2,
.account-menu-panel h2,
.settings-card h2,
.password-card h2,
.report-list-panel h2 {
  margin: 0 0 14px;
  color: #071d3f;
  font-size: 1rem;
}

.activity-list {
  display: grid;
  gap: 14px;
}

.activity-list article {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: center;
}

.activity-list strong,
.activity-list span {
  display: block;
}

.activity-list strong {
  font-size: 0.9rem;
}

.activity-list span {
  color: #64748b;
  font-size: 0.78rem;
  font-weight: 700;
}

.center {
  margin: 12px auto 0;
}

.donut-layout {
  display: flex;
  align-items: center;
  gap: 18px;
}

.donut {
  display: grid;
  width: 108px;
  height: 108px;
  place-items: center;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, #fff 0 44%, transparent 45%),
    conic-gradient(#0b85ee calc(var(--value) * 1%), #ff9b67 0 70%, #e8eff6 0);
}

.donut strong {
  grid-area: 1 / 1;
  font-size: 1.45rem;
  font-weight: 900;
}

.donut span {
  grid-area: 1 / 1;
  align-self: center;
  justify-self: end;
  margin: 26px 23px 0 0;
  font-size: 0.75rem;
  font-weight: 900;
}

.legend {
  display: grid;
  gap: 9px;
  color: #526176;
  font-weight: 800;
}

.legend span {
  display: flex;
  align-items: center;
  gap: 8px;
}

.blue-dot,
.orange-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.blue-dot { background: #0b85ee; }
.orange-dot { background: #ff9b67; }

.connection-card {
  position: relative;
  min-height: 174px;
  overflow: hidden;
}

.connection-card p,
.security-hint p {
  margin: 0 0 12px;
  color: #5e6d83;
}

.mini-illustration {
  position: relative;
  min-height: 70px;
}

.mini-illustration.solo::before,
.mini-illustration.people::before,
.portrait-photo::before {
  content: "";
  display: block;
  width: 92px;
  height: 92px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 36%, #ffe3c4 0 21%, transparent 22%),
    radial-gradient(circle at 50% 56%, #f38da0 0 30%, transparent 31%),
    linear-gradient(145deg, #eaf6ff, #fff1f4);
}

.mini-illustration.solo::before {
  position: absolute;
  right: 6px;
  bottom: -18px;
}

.mini-illustration.people::before {
  width: 126px;
  height: 86px;
  margin: 0 auto 12px;
  border-radius: 8px;
  background:
    radial-gradient(circle at 32% 42%, #ffe0bf 0 13%, transparent 14%),
    radial-gradient(circle at 68% 42%, #ffe0bf 0 13%, transparent 14%),
    linear-gradient(135deg, #eaf6ff, #fff0ec);
}

.profile-hero {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 26px;
  align-items: center;
  padding: 28px;
}

.mypage-top-grid {
  display: grid;
  grid-template-columns: minmax(360px, 0.9fr) minmax(420px, 1.1fr);
  gap: 16px;
  align-items: stretch;
}

.compact-profile {
  grid-template-columns: auto minmax(0, 1fr);
  gap: 20px;
  padding: 22px;
}

.rank-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.profile-avatar-wrap {
  position: relative;
  width: fit-content;
}

.camera-badge {
  position: absolute;
  right: -4px;
  bottom: 2px;
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: #fff;
  color: #0a2b60;
  box-shadow: var(--soft-shadow);
}

.profile-main h2 {
  margin: 0 0 8px;
  font-size: 1.75rem;
}

.profile-main p {
  margin: 0;
  color: #102549;
  font-weight: 900;
}

.profile-main .profile-note {
  margin-top: 12px;
  color: #526176;
  font-weight: 800;
}

.rank-badge,
.team-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  background: #fff7dc;
  color: #6d4b00;
  font-size: 0.8rem;
  font-weight: 900;
}

.team-badge {
  background: #eaf4ff;
  color: #0873df;
}

.achievement-panel,
.lower-grid {
  display: grid;
  gap: 16px;
}

.achievement-panel h2 {
  margin: 0;
  font-size: 1.05rem;
}

.summary-card-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.summary-tile {
  position: relative;
  min-height: 96px;
  padding: 16px;
}

.summary-tile span {
  color: #526176;
  font-size: 0.84rem;
  font-weight: 900;
}

.summary-tile strong {
  display: block;
  margin-top: 8px;
  color: #061637;
  font-size: 1.8rem;
  font-weight: 900;
}

.summary-tile .icon {
  position: absolute;
  right: 16px;
  bottom: 16px;
  color: #0b85ee;
}

.score-strip {
  display: grid;
  grid-template-columns: 1fr 1fr 220px;
  gap: 14px;
  align-items: stretch;
}

.score-strip > div {
  padding: 18px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.66);
}

.score-strip span,
.score-strip strong {
  display: block;
}

.score-strip span {
  color: #607086;
  font-weight: 900;
}

.score-strip strong {
  margin-top: 6px;
  font-weight: 900;
}

.donut-card {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.donut-card .donut {
  width: 88px;
  height: 88px;
}

.achievement-compact-panel {
  display: grid;
  grid-template-columns: 170px minmax(260px, 1fr) minmax(240px, 0.9fr) auto;
  gap: 12px;
  align-items: stretch;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--soft-shadow);
}

.score-card,
.rank-progress-card,
.mini-metrics {
  min-height: 96px;
  padding: 14px;
  border: 1px solid #e0ecf6;
  border-radius: 8px;
  background: #fff;
}

.score-card span,
.score-card small,
.rank-progress-card p,
.mini-metrics span {
  color: #5e6d83;
  font-size: 0.8rem;
  font-weight: 800;
}

.score-card strong {
  display: block;
  margin: 4px 0;
  color: #071d3f;
  font-size: 2rem;
  font-weight: 900;
}

.panel-title-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.panel-title-row h2 {
  margin: 0;
}

.panel-title-row span {
  color: var(--blue);
  font-weight: 900;
}

.progress-bar {
  height: 10px;
  margin: 12px 0 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #dfeaf4;
}

.progress-bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #0b85ee, #28c7a4);
}

.rank-progress-card p {
  margin: 0;
}

.mini-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.mini-metrics article {
  display: grid;
  align-content: center;
  gap: 4px;
  min-width: 0;
}

.mini-metrics .icon {
  color: var(--blue);
}

.mini-metrics strong {
  color: #071d3f;
  font-weight: 900;
}

.lower-grid {
  grid-template-columns: minmax(240px, 0.8fr) minmax(0, 1.4fr);
}

.small-panel,
.account-menu-panel,
.settings-card,
.password-card,
.report-list-panel {
  padding: 20px;
}

.system-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.8fr);
  gap: 16px;
  align-items: start;
  margin-top: 16px;
}

.provision-result {
  margin-top: 16px;
  border: 2px solid var(--blue);
}

.provision-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.provision-grid input {
  font-weight: 800;
}

.avatar.has-photo {
  overflow: hidden;
}

.avatar-photo {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  object-fit: cover;
}

.portrait-photo .avatar-photo {
  border-radius: 12px;
}

.attachment-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  color: var(--blue);
  font-size: 0.86rem;
  font-weight: 800;
  text-decoration: none;
}

.attachment-link:hover {
  text-decoration: underline;
}

.eye-toggle {
  display: inline-flex;
  align-items: center;
  margin-left: auto;
  padding: 0;
  border: 0;
  background: none;
  color: #5e6d83;
  cursor: pointer;
}

.eye-toggle:hover {
  color: var(--blue);
}

.company-list {
  display: grid;
  gap: 10px;
}

.company-list article {
  display: grid;
  gap: 4px;
  min-height: 64px;
  padding: 12px;
  border: 1px solid #e0ecf6;
  border-radius: 8px;
  background: #fff;
}

.company-list strong {
  color: #071d3f;
  font-weight: 900;
}

.company-list span {
  color: #5e6d83;
  font-size: 0.86rem;
  font-weight: 800;
}

.monthly-note {
  text-align: left;
}

.monthly-note strong {
  display: block;
  color: #071d3f;
  margin-bottom: 12px;
}

.monthly-note p {
  margin: 0;
  color: #526176;
  font-weight: 800;
}

.account-menu-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.account-menu-grid.compact {
  gap: 10px;
}

.account-menu-item {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 18px;
  gap: 12px;
  align-items: center;
  min-height: 72px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: #071d3f;
  cursor: pointer;
  text-align: left;
}

.account-menu-item > .icon:first-child {
  width: 38px;
  height: 38px;
  padding: 9px;
  border-radius: 50%;
  background: #eef7ff;
  color: #0873df;
}

.account-menu-item strong,
.account-menu-item small {
  display: block;
}

.account-menu-item small {
  margin-top: 4px;
  color: #607086;
  font-size: 0.78rem;
  font-weight: 800;
}

.monthly-note {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.compose-surface {
  display: grid;
  gap: 18px;
}

.compose-grid,
.incident-compose-grid {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) minmax(300px, 0.86fr);
  gap: 18px;
  align-items: start;
}

.compose-form-panel,
.compose-preview-panel {
  display: grid;
  gap: 14px;
  min-width: 0;
  box-sizing: border-box;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--soft-shadow);
}

.compose-preview-panel {
  position: sticky;
  top: 110px;
}

.compose-preview-panel h2 {
  margin: 0;
  color: #071d3f;
  font-size: 1rem;
}

.checklist-card {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid #d5e8fb;
  border-radius: 8px;
  background: #f2f9ff;
}

.checklist-card p {
  margin: 0;
  color: #34506e;
  font-weight: 800;
}

.compose-actions {
  z-index: 4;
  display: grid;
  grid-template-columns: minmax(160px, 0.34fr) minmax(220px, 0.66fr);
  gap: 12px;
  padding: 14px 0 0;
  background: linear-gradient(180deg, rgba(245, 251, 255, 0), rgba(245, 251, 255, 0.98) 34%);
}

.severity-control {
  display: grid;
  gap: 10px;
  color: #0a224a;
  font-weight: 900;
}

.severity-options {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.severity-options label {
  position: relative;
  display: grid;
  gap: 4px;
  min-height: 74px;
  place-items: center;
  padding: 10px 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: #0a224a;
  cursor: pointer;
  text-align: center;
}

.severity-options input {
  position: absolute;
  opacity: 0;
}

.severity-options label:has(input:checked) {
  border-color: var(--blue);
  background: #eef7ff;
  color: var(--blue);
  box-shadow: 0 0 0 3px rgba(4, 120, 223, 0.14);
}

.severity-options small {
  color: #607086;
  font-size: 0.72rem;
}

.severity-chip {
  display: inline-flex;
  margin-left: 8px;
  padding: 3px 8px;
  border-radius: 999px;
  background: #eef7ff;
  color: #075db8;
  font-size: 0.74rem;
  font-weight: 900;
}

.severity-4 {
  background: #fff0f0;
  color: #c62828;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.toggle-row span,
.toggle-row strong,
.toggle-row small {
  display: block;
}

.toggle-row small {
  margin-top: 4px;
  color: #607086;
  font-weight: 800;
}

.toggle-row input {
  width: 42px;
  height: 24px;
  accent-color: var(--blue);
}

.help-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.settings-grid {
  display: grid;
  grid-template-columns: minmax(320px, 0.95fr) minmax(360px, 1.05fr);
  gap: 18px;
}

.profile-preview-card {
  display: flex;
  align-items: center;
  gap: 24px;
  min-height: 160px;
  margin-bottom: 20px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.profile-preview-card h3 {
  margin: 0 0 8px;
  font-size: 1.35rem;
}

.profile-preview-card p {
  margin: 0 0 12px;
  font-weight: 900;
}

.segmented-control {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin-bottom: 18px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  overflow: hidden;
}

.segmented-control button {
  min-height: 42px;
  background: #fff;
  color: #0a2b60;
  cursor: pointer;
  font-weight: 900;
}

.segmented-control .active {
  background: linear-gradient(135deg, #0aa8e8, #046fd5);
  color: #fff;
}

.photo-upload-grid {
  display: grid;
  grid-template-columns: 126px minmax(0, 1fr);
  gap: 18px;
  align-items: stretch;
  margin-bottom: 18px;
}

.portrait-photo {
  min-height: 126px;
  border-radius: 8px;
  background:
    radial-gradient(circle at 50% 30%, #ffe0bd 0 23%, transparent 24%),
    radial-gradient(circle at 50% 58%, #f38e9a 0 35%, transparent 36%),
    linear-gradient(145deg, #fff4ea, #eaf8ff);
}

.portrait-photo::before {
  display: none;
}

.upload-drop {
  display: grid;
  place-items: center;
  gap: 8px;
  min-height: 126px;
  padding: 14px;
  border: 2px dashed #9dccff;
  border-radius: 8px;
  background: #fbfdff;
  color: #0873df;
  text-align: center;
  font-weight: 900;
  cursor: pointer;
}

.upload-drop.drag-active {
  border-color: var(--blue);
  background: #eef7ff;
}

.upload-drop small {
  color: #607086;
}

.upload-drop input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.avatar-choice-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.avatar-choice {
  display: grid;
  place-items: center;
  gap: 6px;
  min-height: 82px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  color: #183152;
  font-size: 0.72rem;
  font-weight: 900;
}

.avatar-choice.selected {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(4, 120, 223, 0.14);
}

.form-panel {
  display: grid;
  align-content: start;
  gap: 16px;
}

.hint-card,
.warning-card,
.point-card {
  display: grid;
  gap: 10px;
  padding: 16px;
  border: 1px solid #f2e2b7;
  border-radius: 8px;
  background: #fff8e4;
  color: #173252;
  font-weight: 800;
}

.hint-card {
  grid-template-columns: auto 1fr;
}

.form-actions,
.dialog-actions {
  justify-content: flex-end;
  margin-top: 8px;
}

.dialog-actions {
  position: sticky;
  bottom: -24px;
  z-index: 2;
  padding-top: 12px;
  padding-bottom: 2px;
  background: #fff;
}

.password-card {
  display: grid;
  max-width: 810px;
  gap: 18px;
}

.password-help-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.condition-card {
  min-height: 140px;
  padding: 20px;
  border-radius: 8px;
  background: #f4f9ff;
}

.condition-card p {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 8px 0 0;
  font-weight: 800;
}

.condition-card .icon {
  color: #39ad38;
}

.condition-card.protect {
  display: flex;
  gap: 18px;
  align-items: center;
}

.condition-card.protect > .icon {
  width: 70px;
  height: 70px;
  color: #0873df;
}

.report-list {
  display: grid;
  gap: 12px;
}

.report-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.report-row p {
  margin: 8px 0;
}

.report-row small {
  color: #607086;
}

.status-submitted { color: #da7d00; font-weight: 900; }
.status-reviewed { color: #15803d; font-weight: 900; }
.status-archived { color: #64748b; font-weight: 900; }

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 28px;
  background: rgba(5, 16, 32, 0.52);
}

.dialog {
  position: relative;
  width: min(920px, calc(100vw - 48px));
  max-height: calc(100vh - 56px);
  overflow: auto;
  padding: 24px;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 28px 72px rgba(0, 0, 0, 0.28);
}

.incident-dialog {
  width: min(950px, calc(100vw - 48px));
}

.dialog-close {
  position: absolute;
  top: 22px;
  right: 22px;
}

.dialog-heading h1 {
  margin: 0;
  font-size: 1.35rem;
}

.dialog-heading p {
  margin: 6px 0 0;
  color: #526176;
  font-weight: 800;
}

.praise-dialog-grid,
.incident-dialog-grid {
  display: grid;
  grid-template-columns: minmax(300px, 0.95fr) minmax(360px, 1.05fr);
  gap: 28px;
}

.preview-column,
.form-column {
  display: grid;
  align-content: start;
  gap: 12px;
}

.praise-preview-card {
  position: relative;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  min-height: 208px;
  overflow: hidden;
  padding: 88px 22px 18px;
  border: 1px solid #f4c59f;
  border-radius: 8px;
  background: linear-gradient(160deg, #ff744d, #ffd76e 45%, #fff3d7 46%, #fff);
}

.praise-preview-card.bouquet { background: linear-gradient(160deg, #ff9bb5, #ffd9e2 45%, #fff5f7 46%, #fff); border-color: #f3c5d1; }
.praise-preview-card.aurora  { background: linear-gradient(160deg, #b48eff, #9fd6ff 45%, #f0edff 46%, #fff); border-color: #cbc8ff; }
.praise-preview-card.sky     { background: linear-gradient(160deg, #49c1e2, #bcefff 45%, #e9f8ff 46%, #fff); border-color: #b7dff1; }
.praise-preview-card.starry  { background: linear-gradient(160deg, #8d7cf6, #bb8df6 45%, #f2ecff 46%, #fff); border-color: #d2c0f3; }
.praise-preview-card.note    { background: linear-gradient(160deg, #4ecfb2, #b7f4e7 45%, #ebfff8 46%, #fff); border-color: #bce9db; }

.praise-preview-card.bouquet .preview-stamp { background: linear-gradient(145deg, #ff9bb5, #ff8a87); }
.praise-preview-card.aurora .preview-stamp { background: linear-gradient(145deg, #b48eff, #7877ff); }
.praise-preview-card.sky .preview-stamp { background: linear-gradient(145deg, #6dd8f6, #7877ff); }
.praise-preview-card.starry .preview-stamp { background: linear-gradient(145deg, #bb8df6, #8c70df); }
.praise-preview-card.note .preview-stamp { background: linear-gradient(145deg, #6ddfc8, #5fb7e8); }

.preview-hills {
  position: absolute;
  inset: 66px -8px auto;
  height: 76px;
  background:
    radial-gradient(120px 42px at 25% 55%, #fff 0 70%, transparent 72%),
    radial-gradient(150px 50px at 60% 60%, rgba(255, 255, 255, 0.82) 0 70%, transparent 72%),
    radial-gradient(130px 42px at 88% 55%, #fff 0 70%, transparent 72%);
}

.preview-sparkle {
  top: 22px;
  right: 22px;
  width: 58px;
  height: 58px;
  border: 5px solid #fff;
  background: rgba(255, 255, 255, 0.36);
  color: #fff;
}

.preview-recipient {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.praise-preview-card p {
  position: relative;
  z-index: 1;
  margin: 0;
  padding: 16px;
  border: 1px solid rgba(10, 34, 74, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.68);
  font-weight: 900;
}

.preview-stamp {
  right: 20px;
  bottom: 26px;
  width: 52px;
  height: 52px;
  border: 5px solid #fff;
  background: linear-gradient(145deg, #ffb576, #ff8a87);
  color: #fff;
}

.stamp-grid,
.design-grid,
.incident-type-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.stamp-choice-card,
.design-choice,
.incident-type-card {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 62px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: #0a224a;
  cursor: pointer;
  text-align: center;
  font-weight: 900;
}

.stamp-choice-card input,
.design-choice input,
.incident-type-card input {
  position: absolute;
  opacity: 0;
}

.stamp-choice-card span {
  display: grid;
  place-items: center;
  gap: 6px;
}

.stamp-choice-card input:checked + span,
.design-choice:has(input:checked),
.incident-type-card:has(input:checked),
.stamp-choice-card.is-selected span,
.design-choice.is-selected,
.incident-type-card.is-selected {
  color: var(--blue);
}

.stamp-choice-card:has(input:checked),
.design-choice:has(input:checked),
.incident-type-card:has(input:checked),
.stamp-choice-card.is-selected,
.design-choice.is-selected,
.incident-type-card.is-selected {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(4, 120, 223, 0.14);
}

.design-grid-field {
  display: grid;
  gap: 8px;
}

.design-thumb {
  width: 74px;
  height: 34px;
  border-radius: 6px;
  background: linear-gradient(135deg, #ff704f, #ffe17b);
}

.design-thumb.bouquet { background: linear-gradient(135deg, #fff0f2, #ff9bb5); }
.design-thumb.aurora { background: linear-gradient(135deg, #9fd6ff, #b48eff); }
.design-thumb.sky { background: linear-gradient(135deg, #bcefff, #fff); }
.design-thumb.starry { background: linear-gradient(135deg, #8d7cf6, #f5ecff); }
.design-thumb.note { background: linear-gradient(135deg, #fff9e8, #b7f4e7); }

.counter {
  justify-self: end;
  color: #0a1a37;
  font-weight: 900;
}

.upload-drop.wide {
  min-height: 74px;
}

.incident-type-card {
  padding: 12px 8px;
  min-height: 132px;
}

.incident-type-card .icon {
  width: 34px;
  height: 34px;
  color: #ffad2d;
}

.incident-type-card strong {
  font-size: 0.84rem;
  line-height: 1.2;
  white-space: nowrap;
}

.incident-type-card small {
  color: #526176;
  font-size: 0.75rem;
  font-weight: 800;
}

.point-card {
  background: #f2f9ff;
  border-color: #cfe6ff;
}

.point-card p {
  display: flex;
  gap: 8px;
  margin: 0;
  color: #225587;
}

.severity-row {
  display: grid;
  gap: 10px;
  margin-top: 4px;
  color: #526176;
  font-weight: 900;
}

.severity-row div {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  align-items: center;
}

.severity-row i {
  height: 2px;
  background: #cad8e6;
}

.severity-row i::before {
  content: "";
  display: block;
  width: 18px;
  height: 18px;
  margin-top: -8px;
  border: 2px solid #cad8e6;
  border-radius: 50%;
  background: #fff;
}

.severity-row i.active::before {
  border-color: var(--blue);
  background: var(--blue);
}

.warning-card {
  grid-template-columns: auto 1fr;
  align-items: center;
  margin-top: 16px;
}

.desktop-only {
  display: inline-flex;
}

.avatar {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  flex: 0 0 auto;
  border: 3px solid #fff;
  border-radius: 50%;
  box-shadow: 0 8px 16px rgba(34, 65, 96, 0.14);
  font-weight: 900;
  overflow: hidden;
  position: relative;
}

.avatar-art {
  position: absolute;
  inset: 10% 14% 0;
}

.avatar-face,
.avatar-hair,
.avatar-neck,
.avatar-shoulders,
.avatar-letter,
.avatar-eye,
.avatar-smile {
  position: absolute;
}

.avatar-face {
  left: 18%;
  top: 23%;
  width: 64%;
  height: 56%;
  border-radius: 48% 48% 45% 45%;
  background: #ffd8bc;
  box-shadow: inset 0 -3px 0 rgba(173, 97, 67, 0.12);
  z-index: 3;
}

.avatar-hair {
  left: 9%;
  top: 10%;
  width: 82%;
  height: 62%;
  border-radius: 50% 50% 38% 38%;
  background: #7b4636;
  z-index: 2;
}

.avatar-neck {
  left: 39%;
  bottom: 13%;
  width: 22%;
  height: 20%;
  border-radius: 0 0 8px 8px;
  background: #f7bf9f;
  z-index: 1;
}

.avatar-shoulders {
  left: 8%;
  bottom: -7%;
  width: 84%;
  height: 34%;
  border-radius: 50% 50% 0 0;
  background: rgba(255, 255, 255, 0.72);
  z-index: 1;
}

.avatar-eye {
  left: 25%;
  top: 44%;
  width: 10%;
  height: 12%;
  border-radius: 50%;
  background: #0a224a;
}

.avatar-eye.right {
  left: 65%;
}

.avatar-smile {
  left: 37%;
  top: 67%;
  width: 27%;
  height: 14%;
  border-bottom: 2px solid #d94f4f;
  border-radius: 0 0 999px 999px;
}

.avatar-letter {
  right: 1%;
  bottom: 1%;
  display: grid;
  width: 33%;
  height: 33%;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  color: currentColor;
  font-size: 0.48em;
  line-height: 1;
  z-index: 4;
}

.avatar.large { width: 72px; height: 72px; }
.avatar.hero { width: 136px; height: 136px; font-size: 2.2rem; }
.avatar.profile { width: 112px; height: 112px; font-size: 1.8rem; }
.avatar.choice { width: 48px; height: 48px; }
.avatar.mini { width: 34px; height: 34px; border-width: 2px; }
.avatar.tiny { width: 42px; height: 42px; border-width: 2px; }
.avatar.micro { width: 28px; height: 28px; border-width: 2px; font-size: 0.72rem; }

.avatar-rose { background: linear-gradient(145deg, #ffd5da, #f58f9b); color: #81333c; }
.avatar-orange { background: linear-gradient(145deg, #ffe2a8, #f5ad52); color: #7b460f; }
.avatar-green { background: linear-gradient(145deg, #b8f3df, #54cfac); color: #0f5c50; }
.avatar-pink { background: linear-gradient(145deg, #ffd9ec, #ff9dc7); color: #7b315a; }
.avatar-lavender { background: linear-gradient(145deg, #eee7ff, #bda8ff); color: #4f3a91; }
.avatar-slate { background: linear-gradient(145deg, #dfe8f2, #9aaabc); color: #28394d; }
.avatar-mint { background: linear-gradient(145deg, #d9fff4, #9ee6cf); color: #0d5c52; }
.avatar-sky { background: linear-gradient(145deg, #d9f5ff, #8ed6f6); color: #0a4e7a; }

.avatar-orange .avatar-hair { background: #9a6231; }
.avatar-green .avatar-hair,
.avatar-mint .avatar-hair { background: #3e756b; }
.avatar-pink .avatar-hair,
.avatar-rose .avatar-hair { background: #7e4637; }
.avatar-lavender .avatar-hair,
.avatar-sky .avatar-hair { background: #49577c; }
.avatar-slate .avatar-hair { background: #303d4f; }

.toast {
  position: fixed;
  right: 28px;
  bottom: 28px;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: min(420px, calc(100vw - 32px));
  padding: 12px 16px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
  font-weight: 900;
}

.toast.success {
  border-color: #9bd8c8;
  background: #effaf6;
  color: #116149;
}

.toast .icon-button {
  width: 28px;
  height: 28px;
}

.notification-popover {
  position: fixed;
  top: 78px;
  right: 24px;
  z-index: 35;
  width: min(360px, calc(100vw - 32px));
  max-height: min(520px, calc(100vh - 112px));
  overflow: auto;
  padding: 16px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.notification-list {
  display: grid;
  gap: 10px;
}

.notification-list article {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 10px;
  padding: 10px;
  border-radius: 8px;
  background: #f6f9fc;
}

.notification-list article.unread {
  background: #edf7ff;
}

.notification-list strong,
.notification-list span {
  display: block;
}

.notification-list span {
  margin-top: 2px;
  color: #526176;
  font-size: 0.78rem;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 1180px) {
  .tg-app {
    width: 100%;
    min-height: 100vh;
    margin: 0;
    border-radius: 0;
  }

  .app-topbar {
    grid-template-columns: 1fr auto;
  }

  .top-metrics {
    display: none;
  }

  .app-body {
    grid-template-columns: 96px minmax(0, 1fr);
  }

  .insight-column {
    display: none;
  }
}

@media (max-width: 760px) {
  body {
    background: #f4fbff;
    font-size: 14px;
  }

  .login-page {
    display: block;
    padding: 0;
    background: #fff;
  }

  .login-card {
    width: 100%;
    min-height: 100vh;
    padding: 58px 24px 24px;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .brand-lockup.login {
    margin-bottom: 28px;
  }

  .auth-form-grid {
    grid-template-columns: 1fr;
  }

  .role-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .role-grid button:nth-last-child(-n + 2) {
    grid-column: span 1;
  }

  .tg-app {
    min-height: 100vh;
    border: 0;
    background: #f5fbff;
  }

  .app-topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    min-height: 76px;
    padding: 8px 16px;
  }

  .app-topbar .brand-lockup strong {
    font-size: 1rem;
  }

  .top-actions {
    margin-left: auto;
    gap: 8px;
  }

  .send-button,
  .logout-button,
  .user-menu-button span,
  .user-menu-button > .icon:last-child {
    display: none;
  }

  .user-menu-button {
    min-width: auto;
    padding: 0;
    border: 0;
    background: transparent;
  }

  .app-body {
    display: block;
    min-height: auto;
  }

  .side-nav {
    position: fixed;
    inset: auto 0 0 0;
    z-index: 24;
    display: block;
    padding: 8px 12px env(safe-area-inset-bottom);
    border-top: 1px solid var(--line);
    border-right: 0;
    background: rgba(255, 255, 255, 0.96);
  }

  .side-nav-list {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
  }

  .nav-button {
    width: 100%;
    height: 58px;
    border: 0;
    box-shadow: none;
    background: transparent;
    font-size: 0.72rem;
  }

  .nav-button.active {
    background: #eef6ff;
    color: var(--blue);
  }

  .desktop-label {
    display: none;
  }

  .mobile-label {
    display: inline;
  }

  .support-tile {
    display: none;
  }

  .content-stage {
    padding: 20px 14px 96px;
  }

  .page-heading {
    display: block;
  }

  .page-heading h1 {
    font-size: 1.35rem;
  }

  .soft-select {
    display: none;
  }

  .letter-grid,
  .summary-card-grid,
  .lower-grid,
  .mypage-top-grid,
  .achievement-compact-panel,
  .compose-grid,
  .incident-compose-grid,
  .settings-grid,
  .system-grid,
  .password-help-grid,
  .account-menu-grid,
  .score-strip,
  .help-grid {
    grid-template-columns: 1fr;
  }

  .letter-card {
    min-height: 250px;
    padding: 22px 16px 14px;
  }

  .floating-send {
    position: fixed;
    right: 18px;
    bottom: 96px;
    z-index: 22;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 70px;
    padding: 0 18px;
    border-radius: 999px;
    background: linear-gradient(145deg, #0aa8e8, #005ed0);
    color: #fff;
    box-shadow: var(--shadow);
    font-weight: 900;
  }

  .profile-hero,
  .profile-preview-card {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .profile-hero {
    justify-items: center;
  }

  .compact-profile {
    text-align: center;
  }

  .rank-summary,
  .monthly-note,
  .panel-title-row {
    justify-content: center;
  }

  .achievement-compact-panel {
    padding: 12px;
  }

  .mini-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .compose-preview-panel {
    position: static;
  }

  .compose-actions {
    position: sticky;
    bottom: 82px;
    grid-template-columns: 1fr 1fr;
    padding: 12px;
    margin: 0 -14px;
    border-top: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.96);
  }

  .severity-options {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .edit-profile-button {
    width: 100%;
  }

  .photo-upload-grid,
  .praise-dialog-grid,
  .incident-dialog-grid {
    grid-template-columns: 1fr;
  }

  .avatar-choice-grid,
  .stamp-grid,
  .design-grid,
  .incident-type-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .modal-backdrop {
    display: block;
    padding: 0;
    background: #fff;
  }

  .dialog {
    width: 100%;
    max-height: none;
    min-height: 100vh;
    padding: 22px 16px 90px;
    border-radius: 0;
    box-shadow: none;
  }

  .dialog-close {
    top: 18px;
    right: 16px;
  }

  .dialog-actions {
    position: fixed;
    inset: auto 0 0;
    z-index: 31;
    display: grid;
    grid-template-columns: 1fr 1fr;
    padding: 12px 16px env(safe-area-inset-bottom);
    border-top: 1px solid var(--line);
    background: #fff;
  }

  .dialog-actions .desktop-only {
    display: none;
  }

  .warning-card {
    margin-bottom: 70px;
  }

  .toast {
    right: 16px;
    bottom: 90px;
  }
}

@media (max-width: 420px) {
  .login-links {
    grid-template-columns: 1fr 1fr;
  }

  .role-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .brand-logo {
    width: 36px;
    height: 36px;
  }

  .notification-button {
    display: none;
  }
}

/* --- Platform console (/system) --- */
.impersonation-banner {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 18px;
  background: #fff4e0;
  border: 1px solid #f0cf8e;
  border-radius: 12px;
  color: #7a4a00;
  font-weight: 600;
}

.impersonation-banner span {
  flex: 1;
}

.warning-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #fdecec;
  border: 1px solid #f2b6b6;
  color: #a12727;
  font-size: 0.72rem;
  font-weight: 700;
  vertical-align: middle;
}

.warning-badge.suspended {
  background: #eef1f6;
  border-color: #ccd6e4;
  color: #4a5a72;
}

.platform-login .auth-policy-note {
  margin-bottom: 8px;
}

.totp-qr {
  display: flex;
  justify-content: center;
  padding: 10px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.totp-qr svg {
  width: 200px;
  height: 200px;
}

.recovery-code-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin: 14px 0;
}

.recovery-code-grid code {
  padding: 8px 10px;
  background: #f4f8fc;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 0.92rem;
  letter-spacing: 0.06em;
  text-align: center;
}

.platform-admin-chip {
  cursor: default;
}

.filter-form {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 12px;
}

.filter-form .field {
  min-width: 170px;
  flex: 1;
}

.filter-form button {
  height: 46px;
}

.contract-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}

.audit-table-wrap {
  overflow-x: auto;
}

.audit-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.audit-table th,
.audit-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

.audit-table th {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.8rem;
}

.audit-table .result-failure {
  color: #a12727;
  font-weight: 700;
}

.audit-table .result-success {
  color: #1d7a44;
}

.bar-chart {
  display: grid;
  gap: 6px;
}

.bar-row {
  display: grid;
  grid-template-columns: 52px 1fr 40px;
  align-items: center;
  gap: 10px;
}

.bar-label {
  font-size: 0.78rem;
  color: var(--muted);
}

.bar-track {
  height: 14px;
  background: #eef3f9;
  border-radius: 7px;
  overflow: hidden;
}

.bar-track i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #0478df, #37a4f4);
  border-radius: 7px;
}

.bar-value {
  font-size: 0.8rem;
  font-weight: 700;
  text-align: right;
}

.company-list .row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

/* --- Platform growth dashboard (KGI/KPI) --- */
.kgi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.kgi-tile {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--soft-shadow);
}
.kgi-tile-head {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
}
.kgi-tile-head svg {
  width: 16px;
  height: 16px;
}
.kgi-tile-value {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-top: 6px;
  font-size: 1.7rem;
  font-weight: 700;
  color: var(--navy);
}
.kgi-delta {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
}
.kgi-delta svg { width: 14px; height: 14px; }
.kgi-delta.up { color: var(--green); }
.kgi-delta.down { color: #d64545; }
.kgi-tile-hint {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.4;
}
.dashboard-columns {
  display: grid;
  grid-template-columns: 3fr 2fr;
  gap: 16px;
  margin-bottom: 18px;
}
.chart-subhead {
  margin: 14px 0 4px;
  font-size: 0.8rem;
  color: var(--muted);
}
.chart-wrap { width: 100%; }
.line-chart, .bars-chart { width: 100%; height: auto; }
.chart-grid { stroke: var(--line); stroke-width: 1; }
.chart-axis { fill: var(--muted); font-size: 10px; }
.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 8px;
  font-size: 0.78rem;
  color: var(--muted);
}
.chart-legend.column { flex-direction: column; gap: 6px; }
.chart-legend-item { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend-item i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.chart-legend-note { font-style: italic; }
.donut-wrap {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}
.donut-chart { width: 160px; height: 160px; flex: 0 0 auto; }
.donut-total { font-size: 28px; font-weight: 700; fill: var(--navy); }
.donut-caption { font-size: 11px; fill: var(--muted); }
.sparkline { width: 72px; height: 22px; vertical-align: middle; }
.health-table td { vertical-align: middle; }
.health-badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 600;
  color: #fff;
}
.health-badge.healthy { background: #2fa36b; }
.health-badge.watch { background: #e0a100; }
.health-badge.at-risk { background: #d64545; }
.health-badge.onboarding { background: #6b7fd6; }
.score-pill {
  display: inline-block;
  min-width: 34px;
  text-align: center;
  padding: 2px 8px;
  border-radius: 6px;
  font-weight: 700;
  color: var(--navy);
  background: linear-gradient(90deg, rgba(80, 199, 168, 0.25), rgba(80, 199, 168, calc(var(--score) / 100 * 0.55)));
}
.flag-chip {
  display: inline-block;
  padding: 1px 7px;
  margin-right: 3px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
}
.flag-chip.upsell { background: rgba(80, 199, 168, 0.18); color: #1c7f65; }
.flag-chip.risk { background: rgba(214, 69, 69, 0.15); color: #b5352f; }
.flag-chip.dormant { background: rgba(102, 117, 141, 0.16); color: #4a5a72; }
.trend-up { color: #2fa36b; font-weight: 600; }
.trend-down { color: #d64545; font-weight: 600; }
.retention-cell {
  display: inline-block;
  min-width: 40px;
  padding: 2px 6px;
  border-radius: 5px;
  text-align: center;
  color: var(--navy);
  background: linear-gradient(90deg, rgba(4, 120, 223, 0.08), rgba(4, 120, 223, calc(var(--v) / 100 * 0.5)));
}
@media (max-width: 760px) {
  .dashboard-columns { grid-template-columns: 1fr; }
}
