@import url('https://fonts.googleapis.com/css2?family=Russo+One&family=Rubik:wght@400;500;600;700&display=swap');
/* Apple-grade-ish iOS web UI (light, soft, precise) */
:root {
  --display-weight: 500;
  --top-offset: 34px;
  --bg: #F6E4CB;
  --card: rgba(255, 250, 242, 0.92);
  --surface2: rgba(255, 244, 230, 0.9);
  --surface3: rgba(244, 224, 198, 0.9);
  --text: #2A1B10;
  --muted: #7A5A3A;
  --line: rgba(114, 76, 44, .2);
  --shadow: 0 6px 18px rgba(60, 35, 12, .18);
  --shadowBig: 0 24px 60px rgba(60, 35, 12, .28);
  --shadowSoft: 0 10px 32px rgba(60, 35, 12, .16);
  --primary: #F97316;
  --primaryPressed: #EA580C;

  --radius: 20px;
  /* Increased from 18px */
  --radius2: 16px;
  /* Increased from 14px */
  --radius3: 12px;
  /* Small elements */
  --field-radius: 14px;
  --field-height: 52px;
  --radius-card: 20px;
  --radius-surface: 16px;
  --radius-control: 14px;
  --toolbar-gap: 12px;

  --spacing: 20px;
  /* Standard spacing unit */
  --content-width: 900px;

  --goodPurple: #2563EB;
  --blue: #2563EB;
  --green: #16A34A;
  --orange: #F97316;
  --red: #EF4444;

  --wallpaper-image-light: url("assets/light bg.jpg");
  --wallpaper-image-dark: url("assets/dark bg.jpg");
  --wallpaper-overlay:
    linear-gradient(180deg, rgba(255, 240, 220, 0.78) 0%, rgba(255, 239, 220, 0.42) 55%, rgba(255, 244, 230, 0.88) 100%),
    radial-gradient(520px 340px at 12% 0%, rgba(249, 115, 22, 0.28), transparent 60%),
    radial-gradient(600px 360px at 90% 8%, rgba(59, 130, 246, 0.2), transparent 60%);
  --wallpaper-vignette:
    radial-gradient(1200px 700px at 50% -10%, rgba(255, 255, 255, 0.32), transparent 60%),
    radial-gradient(1400px 900px at 50% 120%, rgba(124, 86, 52, 0.22), transparent 70%);
  --wallpaper-vignette-opacity: 0.85;
  --wallpaper-blend: soft-light;

  --skill-bg-image-light: url("assets/light bg circle1.jpg");
  --skill-bg-image-dark: url("assets/dark bg circle.jpg");
  --skill-bg-overlay-light:
    linear-gradient(180deg, rgba(164, 198, 255, 0.18) 0%, rgba(210, 230, 255, 0.08) 55%, rgba(255, 255, 255, 0) 100%),
    radial-gradient(520px 320px at 50% -10%, rgba(255, 255, 255, 0.25), transparent 60%);
  --skill-bg-overlay-dark:
    radial-gradient(900px 600px at 55% -5%, rgba(56, 109, 255, 0.35), transparent 60%),
    radial-gradient(700px 420px at 15% 10%, rgba(20, 80, 220, 0.25), transparent 60%),
    radial-gradient(circle at 1px 1px, rgba(185, 210, 255, 0.18) 1px, transparent 2px),
    radial-gradient(circle at 2px 2px, rgba(90, 140, 255, 0.12) 1px, transparent 2px);
}

*, *::before, *::after {
  box-sizing: border-box;
}

input,
select,
textarea,
button {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background-color: var(--bg);
  background-image: var(--wallpaper-overlay), var(--wallpaper-image);
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  background-repeat: no-repeat;
  color: var(--text);
  font-family: "Rubik", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.app {
  min-height: 100%;
  padding: calc(var(--top-offset) + env(safe-area-inset-top)) 20px calc(100px + env(safe-area-inset-bottom));
  max-width: var(--content-width);
  margin: 0 auto;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 4px 24px;
  margin-bottom: var(--top-offset);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.icon {
  width: 44px;
  height: 44px;
  border-radius: var(--field-radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  letter-spacing: -0.02em;
  background: linear-gradient(180deg, #FFFFFF, #EAEAF2);
  box-shadow: var(--shadow);
}

.brandText {
  min-width: 0;
}

.brandTitle {
  font-size: 16px;
  font-weight: 900;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.brandSubtitle {
  font-size: 14px;
  color: var(--muted);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbarRight {
  display: flex;
  align-items: center;
  gap: 10px;
}

.chip {
  padding: 10px 12px;
  border-radius: var(--field-radius);
  background: rgba(255, 255, 255, .72);
  border: 1px solid var(--line);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--muted);
  font-size: 14px;
  white-space: nowrap;
}

#auditMonthLabel,
#auditPrev,
#auditNext {
  height: 36px;
  min-height: 36px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--field-radius);
}

#auditMonthLabel {
  width: auto;
  min-width: 150px;
  padding: 0 12px;
  flex: 1 1 auto;
  text-align: center;
}

#auditPrev,
#auditNext {
  width: 36px;
}

.main {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.screen {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.isHidden {
  display: none !important;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--field-radius);
  padding: 24px;
  box-shadow: var(--shadow);
}

.cardInset {
  background: rgba(242, 242, 247, .6);
  border: 1px solid var(--line);
  border-radius: var(--field-radius);
  padding: 20px;
}

.cardHeader {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.cardTitle {
  font-size: 16px;
  font-weight: 900;
  letter-spacing: -0.01em;
}

.cardHint {
  margin-top: 4px;
  font-size: 14px;
  color: var(--muted);
  line-height: 1.45;
  max-width: 70ch;
}

.subTitle {
  font-size: 16px;
  font-weight: 900;
  margin-bottom: 8px;
  letter-spacing: -0.01em;
}

.divider {
  height: 1px;
  background: var(--line);
  margin: 12px 0;
}

.grid2 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  align-items: start;
}

.taskForm {
  gap: 14px;
}

.ninjaInputsSection {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ninjaInputsSection .row {
  justify-content: flex-start;
}

.settingsCol {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

#screen-settings .settingsGrid {
  display: grid;
  gap: 18px;
  align-items: stretch;
}

#screen-settings .settingsGrid > .cardInset {
  height: 100%;
}

#screen-settings .settingsNotesCard {
  display: flex;
  flex-direction: column;
}

#screen-settings .settingsNotesCard .notes {
  min-height: 220px;
}

#screen-settings .authUserLabel {
  margin-top: 6px;
}

@media (min-width: 860px) {
  #screen-settings .settingsGrid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-areas:
      "logo import"
      "notes tests"
      "bgLightMain bgDarkMain"
      "bgLightMap bgDarkMap";
  }
  #screen-settings .settingsLogoCard { grid-area: logo; }
  #screen-settings .settingsTestsCard { grid-area: tests; }
  #screen-settings .settingsNotesCard { grid-area: notes; }
  #screen-settings .settingsImportCard { grid-area: import; }
  #screen-settings .settingsBgLightMainCard { grid-area: bgLightMain; }
  #screen-settings .settingsBgDarkMainCard { grid-area: bgDarkMain; }
  #screen-settings .settingsBgLightMapCard { grid-area: bgLightMap; }
  #screen-settings .settingsBgDarkMapCard { grid-area: bgDarkMap; }
}


.field span {
  display: block;
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 6px;
}

input[type="text"],
input[type="password"],
input[type="date"],
input[type="number"],
select,
.search {
  width: 100%;
  padding: 10px 16px;
  /* Reduced padding for 50px height */
  height: var(--field-height);
  /* Reduced from 60px */
  border-radius: var(--field-radius);
  border: 1px solid var(--line);
  background: var(--card);
  outline: none;
  font-size: 15px;
  transition: border-color .15s ease, box-shadow .15s ease;
}

textarea {
  width: 100%;
  padding: 18px 20px;
  min-height: 140px;
  border-radius: var(--field-radius);
  border: 1px solid var(--line);
  background: var(--card);
  outline: none;
  font-size: 15px;
  resize: vertical;
  line-height: 1.5;
  transition: border-color .15s ease, box-shadow .15s ease;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(0, 122, 255, .15);
}

.row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

#screen-audit .cardHeader .row {
  gap: 6px;
  flex-wrap: nowrap;
}

#screen-audit > .card:first-child {
  padding-bottom: 7px;
}

#screen-audit > .card:first-child.isAuditCalendarOpen {
  padding-bottom: 15px;
}

.auditHeader {
  align-items: center;
  margin-bottom: 0;
}

#auditToggleCalendar {
  height: 36px;
  min-height: 36px;
  padding: 0 14px;
}

.auditDayStepRow {
  margin-left: auto;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: var(--toolbar-gap);
  flex-wrap: wrap;
}

.btn {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .8);
  padding: 0 20px;
  /* Center text vertically with flex */
  height: var(--field-height);
  /* Fixed height matching inputs */
  border-radius: var(--field-radius);
  font-weight: 700;
  cursor: pointer;
  transition: transform .1s cubic-bezier(0.34, 1.56, 0.64, 1), background .15s ease, border-color .15s ease, box-shadow .15s ease;
  user-select: none;
  font-size: 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn:active {
  transform: scale(.96);
}

.btn.primary {
  border-color: transparent;
  background: var(--primary);
  color: #fff;
  box-shadow: 0 4px 12px rgba(0, 122, 255, .25);
}

.btn.primary:active {
  background: var(--primaryPressed);
  box-shadow: none;
}

.btn.ghost {
  background: transparent;
  border-color: transparent;
  color: var(--muted);
  box-shadow: none;
}

.btn.ghost:hover {
  background: rgba(0, 0, 0, .04);
  color: var(--text);
}

.seg {
  display: flex;
  background: rgba(142, 142, 147, .14);
  border: 1px solid var(--line);
  border-radius: var(--field-radius);
  padding: 4px;
  gap: 4px;
}

.segBtn {
  border: none;
  background: transparent;
  padding: 10px 10px;
  border-radius: var(--field-radius);
  font-weight: 900;
  cursor: pointer;
  color: var(--muted);
}

.segBtn.isActive {
  background: #fff;
  color: var(--text);
  box-shadow: 0 2px 10px rgba(0, 0, 0, .08);
}

.list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.item {
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: var(--field-radius);
  padding: 18px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  transition: transform .2s ease, box-shadow .2s ease;
}

.meta {
  flex: 1;
  min-width: 0;
}

.topLine {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.title {
  font-size: 16px;
  font-weight: 900;
  letter-spacing: -0.01em;
}

.sub {
  margin-top: 4px;
  font-size: 14px;
  color: var(--muted);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.badge {
  font-size: 14px;
  padding: 4px 8px;
  border-radius: var(--field-radius);
  border: 1px solid var(--line);
  background: rgba(242, 242, 247, .85);
  color: var(--muted);
}

.badge.mand {
  color: #B45309;
  background: rgba(245, 158, 11, .12);
  border-color: rgba(245, 158, 11, .25);
}

.badge.mission {
  color: #6D28D9;
  background: rgba(124, 58, 237, 0.12);
  border-color: rgba(124, 58, 237, 0.28);
}

.badge.done {
  color: #047857;
  background: rgba(16, 185, 129, .12);
  border-color: rgba(16, 185, 129, .25);
}

.badge.dim {
  opacity: .7;
}

.actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.actions .iconBtn.iconOnly {
  width: 40px;
  height: 40px;
  min-width: 40px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  line-height: 1;
}

.iconBtn .weekMark {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: #7b2f2a;
}

body.dark .iconBtn .weekMark {
  color: #ffffff;
}

#libExpectedPoints {
  margin-top: 18px;
  width: 100%;
  max-width: none;
  box-sizing: border-box;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--glass2);
  border: 1px solid var(--hairline);
  font-size: 13px;
  line-height: 1.4;
  color: var(--text);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.04);
}

#libExpectedPoints .expectedNum {
  color: inherit;
}

body.dark #libExpectedPoints {
  background: rgba(17, 24, 39, 0.55);
  border-color: rgba(148, 163, 184, 0.25);
  color: rgb(230, 236, 254);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

body.dark #libExpectedPoints .expectedNum {
  color: rgb(230, 236, 254);
}

.iconBtn {
  border: 1px solid var(--line);
  background: rgba(242, 242, 247, .85);
  padding: 10px 10px;
  border-radius: var(--field-radius);
  cursor: pointer;
  font-weight: 900;
  min-width: 42px;
}

.iconBtn.primary {
  background: rgba(0, 122, 255, .12);
  border-color: rgba(0, 122, 255, .25);
  color: var(--primary);
}

.iconBtn.danger {
  background: rgba(239, 68, 68, .10);
  border-color: rgba(239, 68, 68, .20);
  color: var(--red);
}

.ninRestoreRow {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.summary {
  margin-top: 10px;
  padding: 12px;
  border-radius: var(--field-radius);
  border: 1px solid var(--line);
  background: rgba(242, 242, 247, .85);
  font-weight: 900;
}

.chartWrap {
  padding: 10px;
  border-radius: var(--field-radius);
  border: 1px solid var(--line);
  background: rgba(242, 242, 247, .75);
}

.yearMeta {
  margin-top: 10px;
  font-size: 14px;
  color: var(--muted);
  line-height: 1.5;
}

.skillWrap {
  border-radius: var(--field-radius);
  overflow: hidden;
  background: rgba(242, 242, 247, .75);
}

/* Tabbar */
.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  display: flex;
  gap: 10px;
  background: rgba(255, 255, 255, .72);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.tabBtn {
  flex: 1;
  border: 1px solid transparent;
  background: transparent;
  padding: 10px 8px;
  border-radius: var(--field-radius);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--muted);
  cursor: pointer;
  font-weight: 900;
}

.tabBtn.isActive {
  background: rgba(0, 122, 255, .10);
  border-color: rgba(0, 122, 255, .18);
  color: var(--primary);
}

.tabIco {
  font-size: 14px;
  line-height: 1;
}

.tabLbl {
  font-size: 14px;
}

/* Modal */
.modalBackdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(17, 24, 39, .35);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px 14px;
}

.modal {
  width: min(360px, 92vw);
  height: min(360px, 92vw);
  background: var(--card);
  border-radius: var(--field-radius);
  border: 1px solid var(--line);
  box-shadow: var(--shadowBig);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.modal.modalLarge {
  width: min(520px, 92vw);
  height: min(720px, 92vh);
}

.modal.modalTall {
  height: min(720px, 92vh);
}

.modal.modalWeekAssign {
  width: min(520px, 94vw);
  height: auto;
  max-height: 94vh;
}

.modalHeader {
  padding: 14px 14px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
}

.modalTitle {
  font-weight: 900;
  font-size: 16px;
}

.modalHint {
  margin-top: 4px;
  font-size: 14px;
  color: var(--muted);
  line-height: 1.45;
}

.modalBody {
  padding: 14px;
  overflow: auto;
  color: var(--text);
  flex: 1;
}

.modalHeader .iconBtn {
  min-width: 36px;
  padding: 6px 8px;
  border-radius: var(--field-radius);
  font-size: 16px;
  line-height: 1;
}

.modalFooter {
  padding: 12px 14px 14px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.modalBackdrop.isHidden {
  display: none;
}

/* === Task modal (Новая задача) === */
.task-modal .modalHeader {
  padding: 18px 22px 14px;
  align-items: flex-start;
  background: linear-gradient(180deg, #E07C2E 0%, #C65A18 100%);
  border-bottom: 1px solid rgba(0, 0, 0, 0.15);
}

.task-modal .modalTitle {
  font-size: 17px;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.01em;
}

.task-modal .modalHint {
  margin-top: 6px;
  font-size: 13.5px;
  line-height: 1.4;
  color: rgba(255, 255, 255, 0.85);
}

.task-modal .modalHeader .iconBtn {
  min-width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.35);
  color: #fff;
}

.task-modal .modalBody {
  padding: 20px 22px 22px;
}

.task-modal .task-modal__form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.task-modal .task-modal__row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.task-modal .field {
  margin: 0;
}

.task-modal .field > span {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.task-modal .task-modal__label {
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.task-modal .task-modal__typeRow {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.task-modal .task-modal__chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 42px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--card);
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  text-align: center;
  padding: 0 10px;
  user-select: none;
}

.task-modal .task-modal__chip input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.task-modal .task-modal__chip input:checked + span {
  color: #fff;
}

.task-modal .task-modal__chip input:checked {
  border-color: transparent;
}

.task-modal .task-modal__chip input:checked ~ span,
.task-modal .task-modal__chip input:checked + span {
  color: #fff;
}

.task-modal .task-modal__chip input:checked {
  outline: none;
}

.task-modal .task-modal__chip:has(input:checked) {
  background: #C65A18;
  border-color: #C65A18;
  color: #fff;
}

.task-modal .task-modal__chip:has(input:focus-visible) {
  box-shadow: 0 0 0 3px rgba(194, 90, 24, 0.2);
}

.task-modal .task-modal__typeSelect {
  display: none;
}

.task-modal input[type="text"],
.task-modal input[type="number"],
.task-modal select {
  height: 46px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--card);
  padding: 0 12px;
  font-size: 15px;
  color: var(--text);
}

.task-modal input[type="text"]:disabled,
.task-modal input[type="number"]:disabled,
.task-modal select:disabled {
  background: var(--surface2);
  color: rgba(90, 60, 35, 0.6);
  cursor: not-allowed;
}

body.dark .task-modal input[type="text"]:disabled,
body.dark .task-modal input[type="number"]:disabled,
body.dark .task-modal select:disabled {
  background: rgba(28, 28, 35, 0.5);
  color: rgba(235, 235, 245, 0.55);
}

.task-modal textarea {
  min-height: 120px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--card);
  padding: 12px;
  font-size: 15px;
  color: var(--text);
  resize: vertical;
}

.task-modal input::placeholder,
.task-modal textarea::placeholder {
  color: rgba(90, 60, 35, 0.55);
}

.task-modal input[type="text"]:focus,
.task-modal input[type="number"]:focus,
.task-modal select:focus,
.task-modal textarea:focus {
  outline: none;
  border-color: #C65A18;
  box-shadow: 0 0 0 3px rgba(194, 90, 24, 0.2);
}

@media (max-width: 420px) {
  .task-modal .modalBody {
    padding: 18px;
  }

  .task-modal .task-modal__row {
    grid-template-columns: 1fr;
  }

  .task-modal .task-modal__typeRow {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 860px) {
  .grid2 {
    grid-template-columns: 1fr 1fr;
  }
}

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


/* --- Pretty pass --- */
:root {
  --glass: rgba(255, 255, 255, .70);
  --glass2: rgba(255, 255, 255, .55);
  /* Shadows inherited from top :root */
  --shadowLift: 0 20px 60px rgba(0, 0, 0, .2);
  --ring: 0 0 0 4px rgba(0, 122, 255, .15);
  --ring2: 0 0 0 6px rgba(124, 58, 237, .15);

  --gradA: radial-gradient(1200px 700px at 15% 0%, rgba(0, 122, 255, .08), transparent 55%);
  --gradCard: linear-gradient(180deg, rgba(255, 255, 255, .95), rgba(255, 255, 255, .85));
  --hairline: rgba(17, 24, 39, .06);
}

body {
  background: var(--bg);
  /* background-image: var(--gradA); Removed to avoid "hanging oval" confusion */
}

.card {
  background: var(--gradCard);
  border: 1px solid var(--hairline);
  box-shadow: var(--shadowSoft);
}

.topbar {
  padding-top: calc(6px + env(safe-area-inset-top));
}

.icon {
  background: linear-gradient(180deg, #FFFFFF, #EBEBF5);
  position: relative;
  overflow: hidden;
}

.icon::after {
  content: '';
  position: absolute;
  inset: -40%;
  background: transparent;
  transform: rotate(18deg);
  opacity: 0;
}

.icon>* {
  position: relative;
  z-index: 1;
}

.chip {
  background: var(--glass);
  border: 1px solid var(--hairline);
  box-shadow: 0 2px 14px rgba(0, 0, 0, .06);
}

.tabbar {
  background: rgba(255, 255, 255, .62);
  border-top: 1px solid var(--hairline);
}

.btn {
  border: 1px solid var(--hairline);
  box-shadow: 0 1px 0 rgba(0, 0, 0, .02);
}

.btn.primary {
  background: linear-gradient(180deg, rgba(0, 122, 255, 1), rgba(0, 92, 230, 1));
  box-shadow: 0 10px 22px rgba(0, 122, 255, .22);
}

.btn.primary:active {
  background: linear-gradient(180deg, rgba(0, 92, 230, 1), rgba(0, 82, 206, 1));
}

.btn:focus-visible {
  outline: none;
  box-shadow: var(--ring);
}

.item {
  border: 1px solid var(--hairline);
  box-shadow: 0 2px 14px rgba(0, 0, 0, .05);
  transition: transform .14s ease, box-shadow .14s ease, border-color .14s ease;
}

.item:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 28px rgba(0, 0, 0, .08);
  border-color: rgba(17, 24, 39, .10);
}

.item:active {
  transform: translateY(0px) scale(.995);
}

/* Smooth screen transitions */
.screen {
  animation: screenIn .22s ease;
}

@keyframes screenIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Skill map background logic moved below for better override control */

#skillMap {
  width: 100%;
  height: auto;
}

.ltNode {
  filter: drop-shadow(0 12px 18px rgba(0, 0, 0, .16));
  transform-origin: center;
  transition: transform .14s ease, filter .14s ease;
}

.ltNode:hover {
  transform: translateY(-1px) scale(1.02);
  filter: drop-shadow(0 18px 30px rgba(0, 0, 0, .18));
}

.ltPulse {
  animation: pulse 1.8s ease-in-out infinite;
}

@keyframes pulse {

  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.035);
  }
}

.ltFloat {
  animation: none !important;
}

@keyframes floaty {

  0%,
  100% {
    transform: translateY(0px);
  }

  50% {
    transform: translateY(-2px);
  }
}

.ltGlowPurple {
  filter: drop-shadow(0 14px 26px rgba(124, 58, 237, .26));
}

.ltGlowBlue {
  filter: drop-shadow(0 14px 26px rgba(37, 99, 235, .22));
}

.ltGlowGreen {
  filter: drop-shadow(0 14px 26px rgba(22, 163, 74, .22));
}

.ltGlowOrange {
  filter: drop-shadow(0 14px 26px rgba(245, 158, 11, .20));
}

.ltGlowRed {
  filter: drop-shadow(0 14px 26px rgba(239, 68, 68, .20));
}

.modal {
  background: rgba(255, 255, 255, .82);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.modalHeader {
  background: rgba(255, 255, 255, .55);
}


/* SF Pro everywhere (best effort) */
body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
    "Segoe UI", Roboto, Inter, Arial, sans-serif;
}

#skillMap,
#skillMap text {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
    "Segoe UI", Roboto, Inter, Arial, sans-serif;
}


/* --- SkillMap visual tweaks requested --- */
body {
  /* clean light with subtle dots like your screenshot */
  background: #F2F2F7;
  background-image:
    radial-gradient(circle at 1px 1px, rgba(17, 24, 39, .05) 1px, transparent 1.6px);
  background-size: 18px 18px;
  background-position: 0 0;
}

/* lighter typography */
.brandTitle,
.cardTitle,
.btn,
.title,
.subTitle {
  letter-spacing: -0.01em;
}

/* reduce overall “boldness” a bit */
.title {
  font-weight: 800;
}

.btn {
  font-weight: 800;
}

/* make outlines a touch thinner */
.ltNode {
  filter: drop-shadow(0 10px 16px rgba(0, 0, 0, .14));
}


/* --- Spacing tweaks --- */
.main {
  gap: 18px;
}

.screen {
  gap: 18px;
}

.card {
  padding: 16px;
}

.cardHeader {
  margin-bottom: 12px;
}

/* --- Audit calendar --- */
.auditCal {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
}

.auditMonthNav {
  justify-content: flex-start;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
}

.auditMonthNav #auditMonthLabel {
  flex: 0 0 auto;
  justify-content: center;
  text-align: center;
}

.auditMonthNav #auditPrev {
  margin-left: auto;
}

.auditDow {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  font-size: 14px;
  color: #6B7280;
  font-weight: 600;
  text-align: center;
  user-select: none;
}

.auditGrid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
}

.auditDay {
  border: 1px solid rgba(17, 24, 39, .10);
  background: rgba(255, 255, 255, .72);
  border-radius: var(--field-radius);
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  cursor: pointer;
  user-select: none;
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
}

.auditDay:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(0, 0, 0, .08);
  border-color: rgba(17, 24, 39, .16);
}

.auditDay:active {
  transform: translateY(0) scale(.99);
}

.auditDay.isEmpty {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  cursor: default;
}

.auditDayNum {
  font-weight: 700;
  color: #111827;
  font-size: 14px;
}

.auditDay.isToday {
  border-color: rgba(0, 122, 255, .35);
  box-shadow: 0 0 0 4px rgba(0, 122, 255, .10);
}

.auditDay.isSelected {
  border-color: rgba(124, 58, 237, .45);
  box-shadow: 0 0 0 5px rgba(124, 58, 237, .12);
}

.auditBadge {
  position: absolute;
  right: 8px;
  bottom: 7px;
  font-size: 14px;
  font-weight: 700;
  color: rgba(17, 24, 39, .75);
  background: rgba(255, 255, 255, .80);
  border: 1px solid rgba(17, 24, 39, .08);
  border-radius: var(--field-radius);
  padding: 2px 6px;
}

/* --- Planner: mini calendar + controls (Calendar screen) --- */
.planner {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 14px;
  align-items: start;
  margin-top: 6px;
}

.planner.isCollapsed {
  display: none;
}

.cardHeaderActions {
  margin-left: auto;
  align-items: flex-start;
  flex-wrap: wrap;
}

#btnNewTaskCal {
  height: 36px;
  min-height: 36px;
  padding: 0 14px;
}

#calendarPlannerToggle {
  height: 36px;
  min-height: 36px;
  min-width: 46px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  line-height: 1;
}

.miniCal {
  border: 1px solid rgba(17, 24, 39, .10);
  background: rgba(255, 255, 255, .72);
  border-radius: var(--field-radius);
  padding: 24px;
  position: relative;
}

.miniCalTop {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  /* Reduced from 10px */
  margin-bottom: 10px;
  flex-wrap: nowrap;
  padding: 0;
  width: 100%;
}

.skillWeekNav {
  flex-wrap: nowrap;
  gap: 6px;
}

.skillWeekLabel {
  min-width: 170px;
}

/* mini calendar header: prev | Month YYYY | next | Today (Today styled like month pill) */
/* mini calendar header: prev | Month YYYY | next | Today (Today styled like month pill) */
.miniNavBtn {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .8);
  width: 36px;
  /* Reduced from 44px */
  height: 36px;
  /* Reduced from 44px */
  padding: 0;
  border-radius: var(--field-radius);
  /* Reduced radius */
  font-weight: 800;
  /* Slightly less bold */
  font-size: 14px;
  /* Reduced font */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
  transition: transform .1s cubic-bezier(0.34, 1.56, 0.64, 1), background .15s ease, border-color .15s ease, box-shadow .15s ease;
  flex-shrink: 0;
}

.miniNavBtn:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(0, 0, 0, .08);
  border-color: rgba(17, 24, 39, .16);
}

/* Dark mode modal header tint */
body.dark .modalHeader {
  background: rgba(35, 35, 42, .95);
  /* Dark gray with slight blue tint */
}

.miniMonthChip,
.miniTodayChip {
  color: var(--text);
  font-weight: 800;
  font-size: 14px;
  /* Reduced from 15px */
  letter-spacing: -0.01em;
  line-height: 1;
  height: 36px;
  /* Match arrow height (was 44px) */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--field-radius);
  /* Reduced radius */
}

.miniMonthChip {
  padding: 0 12px;
  /* Reduced padding */
  min-width: 150px;
  /* Fixed width for stability (hold longest month) */
  text-align: center;
  background: rgba(255, 255, 255, .5);
  flex: 0 0 auto;
}

.miniTodayChip {
  padding: 0 10px;
  /* Reduced padding */
  cursor: pointer;
  background: rgba(255, 255, 255, .8);
  border: 1px solid var(--line);
  margin-left: auto;
}



.miniTodayChip:hover {
  border-color: rgba(0, 122, 255, .35);
  box-shadow: 0 10px 22px rgba(0, 122, 255, .10);
}

body.dark .miniNavBtn {
  background: rgba(28, 28, 30, .70);
  border-color: rgba(255, 255, 255, .10);
  color: var(--text);
}

body.dark .miniNavBtn:hover {
  border-color: rgba(0, 122, 255, .35);
  box-shadow: 0 10px 22px rgba(0, 122, 255, .10);
}

.miniDow {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  font-size: 14px;
  color: #6B7280;
  font-weight: 700;
  text-align: center;
  user-select: none;
  margin-bottom: 6px;
}

.miniGrid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}

.miniDay {
  border: 1px solid rgba(17, 24, 39, .10);
  background: rgba(255, 255, 255, .85);
  border-radius: var(--field-radius);
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  cursor: pointer;
  user-select: none;
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
}

.miniDay:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(0, 0, 0, .08);
  border-color: rgba(17, 24, 39, .16);
}

.miniDay.isEmpty {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  cursor: default;
}

.miniDayNum {
  font-weight: 800;
  color: #111827;
  font-size: 14px;
}

.miniDay.isToday {
  border-color: rgba(0, 122, 255, .35);
  box-shadow: 0 0 0 4px rgba(0, 122, 255, .10);
}

.miniDay.isSelected {
  border-color: rgba(0, 122, 255, .65);
  box-shadow: 0 0 0 5px rgba(0, 122, 255, .14);
}

.miniDot {
  position: absolute;
  right: 4px;
  /* Moved from 7px */
  bottom: 4px;
  /* Moved from 7px */
  width: 5px;
  /* Reduced from 7px */
  height: 5px;
  /* Reduced from 7px */
  border-radius: var(--field-radius);
  background: rgba(0, 122, 255, .75);
}

.miniSelected {
  margin-top: 10px;
  display: flex;
  gap: 8px;
  align-items: baseline;
}

.miniSelectedLabel {
  font-size: 14px;
  color: #6B7280;
  font-weight: 700;
}

.miniSelectedText {
  font-size: 14px;
  font-weight: 800;
}

.plannerControls {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  justify-items: start;
  min-width: 0;
  padding: 24px;
  align-self: start;
}

.plannerControls .field,
.plannerControls .selectBtn,
.plannerControls .btn {
  width: 100%;
  max-width: none;
  min-width: 0;
}

.plannerControls .selectBtn {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.plannerControls .field span {
  margin-bottom: 10px;
}

.plannerControls .plannerFieldTpl span {
  margin-bottom: 14px;
}

/* hide the native input (it is just the source of truth for the selected date) */
.miniCal .dateNativeInput {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  height: 0;
  width: 0;
}

@media (max-width: 820px) {
  .planner {
    grid-template-columns: 1fr;
  }
}

/* --- Library filters on one line --- */
/* --- Library filters stacked to match left column --- */
.toolbar.toolbarInline {
  align-items: stretch;
  flex-direction: column;
  gap: 10px;
}

.toolbar.toolbarInline select {
  flex: 1;
  width: 100%;
}

.toolbar.toolbarInline input {
  flex: 1;
  width: 100%;
}

/* Library: keep search height identical to calendar search */
#screen-library .toolbar.toolbarInline .search,
#screen-library .toolbar.toolbarInline .selectBtn,
#screen-library .toolbar.toolbarInline .btn {
  height: var(--field-height);
}


#screen-library .toolbar.toolbarInline .search {
  height: var(--field-height);
  font-size: 17px;
}

.libraryCatRow {
  margin-top: 10px;
}

.libraryCatSwitch {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  flex-wrap: nowrap;
  overflow-x: auto;
  padding-bottom: 2px;
}

.libraryCatBtn {
  flex: 0 0 auto;
  white-space: nowrap;
}

.toolbar.quickToolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--toolbar-gap);
}

.toolbar.quickToolbar .search {
  min-width: 0;
}

.quickMissingBtn {
  white-space: nowrap;
}

.quickCatSwitch {
  min-width: 0;
  grid-column: 1 / -1;
}

.quickCatBtn {
  flex: 0 0 auto;
  white-space: nowrap;
}

@media (max-width: 980px) {
  .toolbar.quickToolbar {
    grid-template-columns: minmax(0, 1fr) auto;
  }
}


/* --- Dark theme: audit calendar like "шары" (черное + синяя обводка + белый текст) --- */
body.dark .auditDow {
  color: rgba(235, 235, 245, .55);
}

body.dark .auditDay {
  background: rgba(11, 11, 15, .85);
  border-color: rgba(0, 122, 255, .35);
}

body.dark .auditDayNum {
  color: #F2F2F7;
}

body.dark .auditDay:hover {
  border-color: rgba(0, 122, 255, .55);
  box-shadow: 0 14px 26px rgba(0, 122, 255, .16);
}

body.dark .auditDay.isToday {
  border-color: rgba(0, 122, 255, .70);
  box-shadow: 0 0 0 4px rgba(0, 122, 255, .18);
}

body.dark .auditDay.isSelected {
  border-color: rgba(0, 122, 255, .95);
  box-shadow: 0 0 0 5px rgba(0, 122, 255, .26);
}

body.dark .auditBadge {
  color: rgba(242, 242, 247, .82);
  background: rgba(28, 28, 30, .65);
  border-color: rgba(0, 122, 255, .22);
}

/* --- Dark theme: mini calendar matches audit style --- */
body.dark .miniCal {
  background: rgba(28, 28, 30, .65);
  border-color: rgba(255, 255, 255, .08);
}

body.dark .miniDow {
  color: rgba(235, 235, 245, .55);
}

body.dark .miniDay {
  background: rgba(11, 11, 15, .85);
  border-color: rgba(0, 122, 255, .28);
}

body.dark .miniDayNum {
  color: #F2F2F7;
}

body.dark .miniDay:hover {
  border-color: rgba(0, 122, 255, .55);
  box-shadow: 0 14px 26px rgba(0, 122, 255, .16);
}

body.dark .miniDay.isToday {
  border-color: rgba(0, 122, 255, .70);
  box-shadow: 0 0 0 4px rgba(0, 122, 255, .18);
}

body.dark .miniDay.isSelected {
  border-color: rgba(0, 122, 255, .95);
  box-shadow: 0 0 0 5px rgba(0, 122, 255, .26);
}

body.dark .miniSelectedLabel {
  color: rgba(235, 235, 245, .55);
}

@media (max-width: 390px) {
  .auditGrid {
    gap: 6px;
  }

  .auditDay {
    border-radius: var(--field-radius);
    min-height: 42px;
  }
}

@media (max-width: 520px) {
  .auditDay {
    align-items: flex-start;
    justify-content: flex-start;
    padding: 6px 7px;
    min-height: 46px;
  }

  .auditDayNum {
    font-size: 13px;
    line-height: 1;
  }

  .auditBadge {
    right: 5px;
    bottom: 5px;
    font-size: 11px;
    padding: 1px 4px;
  }
}

/* --- Layout spacing fixes --- */
.stack {
  gap: 16px;
}

.card {
  margin-bottom: 16px;
}

.card:last-child {
  margin-bottom: 0;
}

.screen .card {
  margin-bottom: 16px;
}

.section {
  margin-bottom: 16px;
}

.modalBody .row {
  gap: 14px;
}

/* --- Form sizing parity --- */
input[type="text"],
input[type="number"],
select,
textarea {
  font-size: 15px;
  line-height: 22px;
}

/* Remove number spinners for task points input */
#mPoints::-webkit-outer-spin-button,
#mPoints::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
#mPoints {
  -moz-appearance: textfield;
  appearance: textfield;
}

input[type="text"],
input[type="number"],
select {
  height: var(--field-height);
  padding: 10px 12px;
}

textarea {
  min-height: 120px;
  padding: 12px;
}

label {
  font-weight: 600;
}

body.dark {
  --bg: #0B0B0F;
  --card: rgba(28, 28, 30, .92);
  --muted: rgba(235, 235, 245, .60);
  --text: #F2F2F7;
  --border: rgba(255, 255, 255, .08);
  background: #0B0B0F;
  background-image:
    radial-gradient(circle at 1px 1px, rgba(255, 255, 255, .05) 1px, transparent 1.6px),
    radial-gradient(900px 700px at 60% -10%, rgba(0, 122, 255, .12), transparent 55%);
  background-size: 18px 18px, auto;
  background-repeat: repeat, no-repeat;
}

body.dark .card {
  border-color: rgba(255, 255, 255, .08);
}

body.dark .tabbar {
  background: rgba(28, 28, 30, .75);
  border-top-color: rgba(255, 255, 255, .08);
}

body.dark .chip {
  background: rgba(28, 28, 30, .70);
  border-color: rgba(255, 255, 255, .10);
}

body.dark .btn {
  border-color: rgba(255, 255, 255, .10);
}

body.dark .modal {
  background: rgba(28, 28, 30, .86);
}

/* === Dark theme contrast fix === */
body.dark {
  --bg: #0B0B0F;
  --card: #16161C;
  --cardSoft: #1C1C23;
  --surface2: rgba(255, 255, 255, .06);
  --surface3: rgba(255, 255, 255, .12);
  --text: #F2F2F7;
  --muted: rgba(235, 235, 245, .55);
  --border: rgba(255, 255, 255, .12);
}

body.dark .card,
body.dark .modal,
body.dark .sheet,
body.dark .item {
  background: var(--card);
  color: var(--text);
}

body.dark input,
body.dark select,
body.dark textarea {
  background: #1C1C23;
  color: var(--text);
  border-color: rgba(255, 255, 255, .14);
}

body.dark input::placeholder,
body.dark textarea::placeholder {
  color: rgba(235, 235, 245, .35);
}

/* === Library spacing cleaned up === */
.libraryHeader {
  margin-bottom: 24px;
}

.librarySearch {
  margin-bottom: 24px;
}

.libraryActions {
  margin-top: 32px;
}

.libraryCategories {
  margin-top: 32px;
}

/* Unified radius removed to respect global variables */

/* === Air pass (library + lists) === */
.grid2 {
  gap: 28px;
}

.toolbar {
  gap: var(--toolbar-gap);
  margin: 14px 0 18px 0;
}

.list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.item {
  padding: 18px 18px;
}

.item .topLine {
  margin-bottom: 8px;
}

.item .badges {
  margin-top: 12px;
  gap: 10px;
  flex-wrap: wrap;
}

.cardHeader .row {
  gap: 12px;
}

/* === Dark mode: readable badges & controls === */
body.dark .badge {
  background: rgba(255, 255, 255, .10);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, .12);
}

body.dark .badge.dim {
  background: rgba(255, 255, 255, .07);
  color: rgba(235, 235, 245, .62);
  border-color: rgba(255, 255, 255, .10);
}

body.dark .badge.mand {
  background: rgba(255, 159, 10, .14);
  color: rgba(255, 204, 128, .95);
  border-color: rgba(255, 159, 10, .25);
}

body.dark .chip {
  background: rgba(255, 255, 255, .08);
  color: var(--text);
  border-color: rgba(255, 255, 255, .10);
}

body.dark .btn {
  color: var(--text);
  background: rgba(255, 255, 255, .06);
  border-color: rgba(255, 255, 255, .12);
}

body.dark .btn.ghost {
  background: transparent;
  border-color: rgba(255, 255, 255, .14);
}

body.dark .iconBtn {
  background: rgba(255, 255, 255, .07);
  border-color: rgba(255, 255, 255, .14);
  color: var(--text);
}

body.dark .iconBtn.primary {
  background: rgba(10, 132, 255, .16);
  border-color: rgba(10, 132, 255, .30);
  color: #EAF4FF;
}

body.dark .iconBtn.danger {
  background: rgba(255, 69, 58, .12);
  border-color: rgba(255, 69, 58, .28);
  color: #FFE7E6;
}

body.dark .btn.primary {
  box-shadow: none;
}

body.dark .icon {
  background: rgba(255, 255, 255, .10);
}

/* === Align Library top fields === */
/* Removed specific overrides to respect global styles */
/* Inherit global input styles */

.grid2 {
  align-items: start;
}

#screen-library h2 {
  margin-bottom: 14px;
}

/* === Skill Map: neon surface in dark mode === */
body.dark #skillMapWrap {
  background: radial-gradient(900px 600px at 60% -10%, rgba(10, 132, 255, .12), transparent 55%),
    radial-gradient(circle at 1px 1px, rgba(255, 255, 255, .05) 1px, transparent 1.8px);
  background-size: auto, 18px 18px;
  background-repeat: no-repeat, repeat;
}

/* === Segmented control dark fix (white-on-white) === */
body.dark .seg {
  background: rgba(255, 255, 255, .06);
  border-color: rgba(255, 255, 255, .12);
}

body.dark .segBtn {
  color: rgba(235, 235, 245, .55);
  font-weight: 700;
}

body.dark .segBtn.isActive {
  background: rgba(255, 255, 255, .14);
  color: var(--text);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .35);
}

/* === Skill Map: dark cosmos background === */
.skillWrap {
  border-radius: var(--field-radius);
  overflow: hidden;
  background-color: #F2F2F7;
  background-image: radial-gradient(900px 600px at 60% -10%, rgba(10, 132, 255, .12), transparent 55%),
    radial-gradient(circle at 1px 1px, rgba(0, 0, 0, .10) 1px, transparent 1.8px);
  background-size: auto, 18px 18px;
  border: 1.5px solid rgba(0, 0, 0, .08);
}

body.dark .skillWrap {
  background: radial-gradient(900px 600px at 55% -5%, rgba(10, 132, 255, .12), transparent 60%),
    radial-gradient(circle at 1px 1px, rgba(255, 255, 255, .05) 1px, transparent 1.8px);
  background-size: auto, 18px 18px;
  background-repeat: no-repeat, repeat;
  box-shadow: none;
  border: 1.5px solid rgba(255, 255, 255, .1);
}

/* === Stats: air & dark consistency === */
#screen-stats .grid2 {
  gap: 22px;
}

#screen-stats .summary {
  margin: 16px 0 18px 0;
  padding: 18px 18px;
  border-radius: var(--field-radius);
}

#screen-stats .subTitle {
  margin: 10px 0 12px 0;
}

#screen-stats .cardInset {
  padding: 18px 18px;
  border-radius: var(--field-radius);
}

#screen-stats .chartWrap {
  margin-top: 16px;
  padding: 16px;
  border-radius: var(--field-radius);
}

#screen-stats .cardHeader .row {
  flex-wrap: nowrap;
  gap: 8px;
  width: 100%;
  flex: 0 0 100%;
  margin-top: 8px;
}

#screen-stats .cardHeader .row .btn {
  white-space: nowrap;
  flex: 1 1 0;
}



@media (max-width: 520px) {
  #screen-stats .cardHeader .row .btn {
    padding: 0 12px;
    font-size: 12px;
  }
}

body.dark #screen-stats .summary {
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .10);
}

body.dark #screen-stats .cardInset {
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .10);
}

body.dark #screen-stats .chartWrap {
  background: rgba(255, 255, 255, .05);
  border: 1px solid rgba(255, 255, 255, .10);
}

.statsTasksControls {
  margin-top: 10px;
  display: grid;
  gap: 10px;
}

.statsTasksTopRow {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

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

.statsTasksSelectRow .field {
  margin: 0;
}

.statsTasksSelect {
  width: 100%;
  height: var(--field-height);
}

.statsTasksMeta {
  margin-top: 10px;
}

.statsTasksList {
  margin-top: 8px;
  display: grid;
  gap: 8px;
}

.statsTaskRow {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface2);
  font-size: 13px;
}

.statsTaskTitle {
  font-weight: 700;
  color: var(--text);
}

.statsMissionRank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  padding: 1px 7px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  font-size: 12px;
  font-weight: 900;
}

.statsMissionRow .statsTaskTitle {
  margin-right: 2px;
}

.statsTaskMuted {
  color: var(--muted);
}

.statsTaskDot {
  color: color-mix(in srgb, var(--muted) 60%, transparent);
}

.statsTaskChip {
  margin-left: auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 1px 8px;
  font-size: 11px;
  color: var(--muted);
  background: var(--card);
}

.statsTaskChip.isMandatory {
  border-color: color-mix(in srgb, var(--primary) 45%, var(--line));
  color: color-mix(in srgb, var(--primaryPressed) 75%, var(--text));
  background: color-mix(in srgb, var(--primary) 14%, #fff);
}

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

@media (max-width: 640px) {
  .statsTasksSelectRow {
    grid-template-columns: 1fr;
  }

  .statsTaskRow {
    font-size: 12px;
    gap: 5px;
  }
}

/* === Settings screen === */
.notes {
  width: 100%;
  min-height: 180px;
  resize: vertical;
  border-radius: var(--field-radius);
  padding: 14px 14px;
  border: 1px solid var(--line);
  background: rgba(142, 142, 147, .10);
  color: var(--text);
  outline: none;
  font-size: 14px;
  line-height: 22px;
}

.notes::-webkit-resizer {
  background:
    transparent
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 14 14'%3E%3Ctext x='7' y='9.6' text-anchor='middle' font-size='11' font-family='Arial, sans-serif' fill='%23946A43'%3E%E2%86%95%3C/text%3E%3C/svg%3E")
    no-repeat
    calc(50% - 1px) calc(50% - 1px);
  background-size: 12px 12px;
}

body.dark .notes {
  background: rgba(255, 255, 255, .06);
  border-color: rgba(255, 255, 255, .12);
}

.tabsCfgRow {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

body.dark .tabsCfgRow {
  border-bottom-color: rgba(255, 255, 255, .10);
}

.tabsCfgRow:last-child {
  border-bottom: none;
}

.tabsCfgRow .lbl {
  min-width: 130px;
  color: var(--muted);
  font-weight: 600;
}

.tabsCfgRow input[type="text"] {
  width: 220px;
}

.bgRows {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 10px;
}

.bgRow .lbl {
  display: block;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
}

.iconPreview {
  width: 28px;
  height: 28px;
  border-radius: var(--field-radius);
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, .10);
  border: 1px solid rgba(255, 255, 255, .12);
}

.iconPreview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--field-radius);
}

/* Brand logo image */
.brand .icon {
  width: 44px;
  height: 44px;
  border-radius: var(--field-radius);
  background: rgba(142, 142, 147, .18);
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.brand .icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
}

.brand .icon.hasImg img {
  display: block;
}

.tabIco img.tabIconImg {
  width: 18px;
  height: 18px;
  object-fit: cover;
  border-radius: var(--field-radius);
  display: block;
}

/* === Settings: remove white panels in dark mode === */
body.dark #screen-settings .cardInset {
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .10);
}

body.dark #screen-settings .subTitle,
body.dark #screen-settings .cardTitle {
  color: var(--text);
}

body.dark #screen-settings .cardHint,
body.dark #screen-settings .lbl {
  color: rgba(235, 235, 245, .60);
}

/* File inputs (browser-limited but better) */
body.dark #screen-settings input[type="file"].search {
  background: rgba(255, 255, 255, .06);
  border-color: rgba(255, 255, 255, .12);
  color: rgba(235, 235, 245, .72);
}

body.dark #screen-settings input[type="text"].search {
  background: rgba(255, 255, 255, .06);
  border-color: rgba(255, 255, 255, .12);
  color: var(--text);
}

body.dark #screen-settings input::file-selector-button {
  background: rgba(255, 255, 255, .14);
  border: 1px solid rgba(255, 255, 255, .16);
  color: rgba(235, 235, 245, .92);
  border-radius: var(--field-radius);
  padding: 8px 12px;
  margin-right: 10px;
}

/* Notes in dark */
body.dark #screen-settings .notes {
  background: rgba(255, 255, 255, .06);
  border-color: rgba(255, 255, 255, .12);
  color: var(--text);
}

/* Card surface in dark */
body.dark #screen-settings .card {
  background: rgba(0, 0, 0, .18);
  border-color: rgba(255, 255, 255, .10);
}

/* === Field consistency: make <select> match .search inputs === */
select.search {
  -webkit-appearance: none;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, rgba(235, 235, 245, .65) 50%),
    linear-gradient(135deg, rgba(235, 235, 245, .65) 50%, transparent 50%);
  background-position: calc(100% - 18px) calc(50% - 3px), calc(100% - 12px) calc(50% - 3px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 34px;
}

body:not(.dark) select.search {
  background-image: linear-gradient(45deg, transparent 50%, rgba(17, 24, 39, .55) 50%),
    linear-gradient(135deg, rgba(17, 24, 39, .55) 50%, transparent 50%);
}

.selectModalList {
  display: grid;
  gap: 8px;
}

.selectOption {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .8);
  border-radius: var(--field-radius);
  padding: 12px 14px;
  font-weight: 600;
  font-size: 16px;
  text-align: left;
  color: var(--text);
  cursor: pointer;
  transition: transform .1s ease, box-shadow .15s ease, border-color .15s ease;
}

.selectOption:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(0, 0, 0, .08);
  border-color: rgba(17, 24, 39, .16);
}

.selectOption.isActive {
  border-color: rgba(0, 122, 255, .45);
  box-shadow: 0 0 0 4px rgba(0, 122, 255, .12);
}

body.dark .selectBtn {
  background: rgba(20, 20, 24, .9);
  border-color: rgba(255, 255, 255, .12);
}

body.dark .selectOption {
  background: rgba(20, 20, 24, .9);
  border-color: rgba(255, 255, 255, .12);
}

/* Align opposite fields */
.toolbar {
  display: flex;
  gap: var(--toolbar-gap);
  align-items: stretch;
}

.toolbar>* {
  height: var(--field-height);
}

.search {
  height: var(--field-height);
  box-sizing: border-box;
}

/* === Field system: unify radius/height and align paired fields === */
.search {
  width: 100%;
  height: var(--field-height);
  border-radius: var(--field-radius);
}

.selectBtn {
  width: 100%;
  height: var(--field-height);
  border-radius: var(--field-radius);
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  padding: 0 16px;
  font-size: 14px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  cursor: pointer;
  text-align: left;
}

.selectBtn::after {
  content: "▾";
  font-size: 14px;
  color: var(--muted);
}

.selectBtn:disabled {
  opacity: .5;
  cursor: not-allowed;
}

/* Buttons align with fields */
.btn {
  min-height: var(--field-height);
}

/* Library: make top inputs align in one row visually */
#screen-library .grid2 {
  align-items: start;
}

#screen-library .cardInset {
  padding: 18px;
}

select.search {
  width: 100%;
  height: var(--field-height);
  border-radius: var(--field-radius);
}

/* Custom file picker */
.fileHidden {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.fileRow {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.fileName {
  color: rgba(235, 235, 245, .65);
  font-weight: 600;
}

.fileHint {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  opacity: 0.8;
  white-space: nowrap;
}

body:not(.dark) .fileName {
  color: rgba(17, 24, 39, .6);
}

#screen-settings .fileRow {
  margin-top: 2px;
}

#screen-settings .btn {
  border-radius: var(--field-radius);
}

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

.select {
  appearance: none;
  -webkit-appearance: none;
  background-image: none;
}

#btnSchedule {
  height: var(--field-height);
  border-radius: var(--field-radius);
  align-self: end;
}

/* Standardized Library button styles */

/* === New SVG Icons === */
.tabIco svg {
  width: 24px;
  height: 24px;
  display: block;
}

.tabBtn:not(.isActive) .tabIco svg {
  opacity: 0.5;
}

.tabBtn.isActive .tabIco svg {
  opacity: 1;
}

/* === Image Cropper === */
.cropperModal {
  max-width: 500px;
  width: 90vw;
  height: auto;
  max-height: 90vh;
}

.cropperBody {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: 20px 0;
  overflow: auto;
}

.cropperViewport {
  width: 300px;
  height: 300px;
  position: relative;
  overflow: hidden;
  border-radius: var(--field-radius);
  background: #000;
  cursor: grab;
  touch-action: none;
  margin: 0 auto;
}

.cropperViewport:active {
  cursor: grabbing;
}

#cropperCanvas {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
}

.cropperOverlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  border: 2px solid rgba(255, 255, 255, 0.5);
  box-shadow: 0 0 0 1000px rgba(0, 0, 0, 0.5);
  border-radius: 50%;
}

.cropperModal.isRect .cropperOverlay {
  border-radius: 12px;
}

.cropperControls {
  width: 100%;
  padding: 0 20px;
}

.cropperControls input[type="range"] {
  width: 100%;
  cursor: pointer;
}

body.dark .cropperViewport {
  border-color: rgba(255, 255, 255, 0.1);
}

/* === Custom Picker & Selection UI === */
.pickerBtn {
  width: 100%;
  height: var(--field-height);
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--field-radius);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, transform .1s ease;
  user-select: none;
  color: var(--text);
  text-align: left;
}

.pickerBtn:active {
  transform: scale(.98);
  background: rgba(0, 0, 0, .02);
}

body.dark .pickerBtn:active {
  background: rgba(255, 255, 255, .03);
}

.pickerBtn .chevron {
  opacity: .4;
  font-size: 14px;
}

.pickerList {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 4px 0;
}

.pickerItem {
  width: 100%;
  padding: 14px 18px;
  border-radius: var(--field-radius);
  background: transparent;
  border: none;
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: background .15s ease, transform .1s ease;
  color: var(--text);
  text-align: left;
}

.pickerItem:hover {
  background: rgba(0, 122, 255, .05);
}

.pickerItem:active {
  transform: scale(.97);
}

.pickerItem.isSelected {
  background: rgba(0, 122, 255, .1);
  color: var(--primary);
}

.pickerItem.isSelected::after {
  content: '✓';
  font-weight: 900;
  font-size: 14px;
}

body.dark .pickerItem:hover {
  background: rgba(255, 255, 255, .05);
}

body.dark .pickerItem.isSelected {
  background: rgba(0, 122, 255, .2);
}

/* === Aesthetic pass: calmer sizing + layered radii === */
.card {
  border-radius: var(--radius-card);
}

.cardInset,
.item,
.summary,
.chartWrap,
.skillWrap,
.miniCal {
  border-radius: var(--radius-surface);
}

input[type="text"],
input[type="date"],
input[type="number"],
select,
textarea,
.search,
.selectBtn,
.btn,
.pickerBtn {
  height: var(--field-height);
  border-radius: var(--radius-control);
  font-size: 15px;
}

textarea {
  height: auto;
  min-height: 140px;
  padding: 14px 16px;
}

.btn {
  min-height: var(--field-height);
  font-weight: 700;
  letter-spacing: -0.01em;
}

.selectOption,
.pickerItem {
  border-radius: var(--radius-control);
  font-size: 15px;
}

.seg {
  border-radius: var(--radius-surface);
}

.segBtn {
  border-radius: var(--radius-control);
}

.tabBtn {
  border-radius: var(--radius-control);
}

.miniNavBtn,
.miniMonthChip,
.miniTodayChip,
.miniDay,
.auditDay,
.auditBadge {
  border-radius: var(--radius-control);
}

body.dark #screen-settings input::file-selector-button,
#screen-settings .btn,
#btnSchedule {
  border-radius: var(--radius-control);
}

/* Library overrides: keep search visually taller than adjacent controls */
#screen-library .toolbar.toolbarInline .search {
  height: var(--field-height);
}

#screen-library .toolbar.toolbarInline .selectBtn,
#screen-library .toolbar.toolbarInline .btn {
  height: var(--field-height);
}

/* === Naruto Theme Overhaul === */
:root {
  --bg: #F4E2C3;
  --card: #FFF3D9;
  --surface2: #F7E1BE;
  --surface3: #E9CFA2;
  --text: #2B1E12;
  --muted: #6C5537;
  --line: rgba(62, 44, 26, 0.22);
  --shadow: 0 10px 22px rgba(45, 27, 12, 0.12);
  --shadowBig: 0 28px 60px rgba(35, 20, 8, 0.28);
  --shadowSoft: 0 12px 28px rgba(48, 28, 13, 0.14);
  --primary: #F97316;
  --primaryPressed: #EA580C;

  /* Score colors (used in charts / skill map) */
  --goodPurple: #FBBF24;
  --blue: #38BDF8;
  --green: #22C55E;
  --orange: #F97316;
  --red: #DC2626;

  /* Naruto-inspired surfaces */
  --band: #1C1917;
  --bandEdge: rgba(255, 214, 170, 0.45);
  --bandText: #FDE68A;
  --metal: #CBB38D;
  --metalEdge: #8A6741;
  --paper-line: rgba(92, 62, 34, 0.08);

  --ring: 0 0 0 4px rgba(249, 115, 22, 0.22);
  --ring2: 0 0 0 6px rgba(220, 38, 38, 0.2);

  --radius-card: 16px;
  --radius-surface: 14px;
  --radius-control: 12px;
  --field-radius: 12px;
  --field-height: 50px;

  --map-core: #FFF3D9;
  --map-node: #F7E4C6;
  --map-arrow: rgba(122, 86, 48, 0.35);

  --toast-bg: rgba(43, 30, 18, 0.92);
  --toast-text: #FDE68A;
  --toast-shadow: 0 12px 30px rgba(30, 18, 10, 0.35);
}

body {
  font-family: "Rubik", "Segoe UI", sans-serif;
  background-color: var(--bg);
  background-image:
    radial-gradient(500px 300px at 8% 0%, rgba(249, 115, 22, 0.18), transparent 60%),
    radial-gradient(420px 280px at 92% 12%, rgba(239, 68, 68, 0.12), transparent 60%),
    repeating-linear-gradient(135deg, rgba(83, 58, 32, 0.07) 0 2px, transparent 2px 14px),
    radial-gradient(circle at 1px 1px, rgba(83, 58, 32, 0.07) 1px, transparent 1.8px);
  background-size: auto, auto, auto, 18px 18px;
  color: var(--text);
}

body,
input,
select,
textarea,
button {
  font-family: "Rubik", "Segoe UI", sans-serif;
}

.brandTitle,
.cardTitle,
.subTitle,
.tabLbl,
.modalTitle,
.title,
.segBtn,
.btn,
.chip,
.tabBtn,
.auditDayNum,
.miniDayNum,
.miniMonthChip,
.miniTodayChip {
  font-family: "Russo One", "Rubik", sans-serif;
  letter-spacing: 0.02em;
  font-weight: var(--display-weight);
}

/* Topbar: ninja headband */
.topbar {
  background: linear-gradient(90deg, rgba(28, 25, 23, 0.96), rgba(44, 32, 23, 0.98));
  border: 1px solid var(--bandEdge);
  border-radius: var(--radius-card);
  padding: 12px 16px;
  box-shadow: var(--shadowBig);
}

.topbar .brandTitle {
  color: var(--bandText);
}

.topbar .brandSubtitle {
  color: rgba(253, 230, 138, 0.7);
}

.topbar .chip,
.topbar .btn,
.topbar .iconBtn {
  background: rgba(253, 230, 138, 0.12);
  border-color: rgba(253, 230, 138, 0.35);
  color: var(--bandText);
}

/* Topbar controls: unify heights (chip + export button) */
.topbar .chip,
.topbar .btn {
  height: auto;
  min-height: 40px;
  padding: 10px 14px;
  display: inline-flex;
  align-items: center;
}

.topbar .iconBtn {
  height: 40px;
  min-height: 40px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  line-height: 1;
}

.topbar .btn.ghost {
  background: transparent;
}

.brand .icon {
  background: radial-gradient(circle at 40% 40%, #FCD34D 0 24%, #F97316 25% 58%, #1E1A16 59% 100%);
  border: 2px solid #FCD34D;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
}

.brand .icon.hasImg {
  background: #2A1D14;
  border-color: #FCD34D;
}

.chip {
  background: rgba(255, 240, 214, 0.85);
  border-color: rgba(124, 86, 52, 0.35);
  color: var(--muted);
  box-shadow: none;
}

.card {
  background:
    linear-gradient(180deg, rgba(255, 246, 224, 0.98), rgba(248, 227, 192, 0.98)),
    repeating-linear-gradient(90deg, rgba(92, 62, 34, 0.04) 0 1px, transparent 1px 28px);
  border: 1px solid rgba(124, 86, 52, 0.28);
  box-shadow: 0 18px 34px rgba(52, 32, 16, 0.16);
  position: relative;
}

.card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.45);
}

.cardInset,
.summary,
.chartWrap,
.miniCal,
.skillWrap {
  background: rgba(255, 243, 222, 0.82);
  border: 1px solid rgba(124, 86, 52, 0.22);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

.divider {
  background: rgba(124, 86, 52, 0.25);
}

.item {
  background: rgba(255, 245, 228, 0.95);
  border: 1px solid rgba(120, 84, 50, 0.28);
  box-shadow: 0 10px 22px rgba(52, 32, 16, 0.12);
  position: relative;
}

.item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 12px;
  bottom: 12px;
  width: 4px;
  border-radius: 999px;
  background: linear-gradient(180deg, #F97316, #DC2626);
  opacity: 0.7;
}

.item:hover {
  box-shadow: 0 18px 30px rgba(52, 32, 16, 0.18);
}

.badge {
  background: rgba(249, 115, 22, 0.12);
  border-color: rgba(249, 115, 22, 0.35);
  color: #8A4B0A;
}

.badge.mand {
  background: rgba(220, 38, 38, 0.14);
  border-color: rgba(220, 38, 38, 0.35);
  color: #991B1B;
}

.badge.done {
  background: rgba(34, 197, 94, 0.14);
  border-color: rgba(34, 197, 94, 0.35);
  color: #166534;
}

.badge.dim {
  opacity: 0.85;
}

input[type="text"],
input[type="date"],
input[type="number"],
select,
textarea,
.search,
.selectBtn,
.pickerBtn {
  background: #FFF4DE;
  border: 1px solid #C59A6A;
  color: var(--text);
}

input::placeholder,
textarea::placeholder {
  color: rgba(107, 77, 44, 0.65);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: var(--ring);
}

.selectBtn::after {
  color: rgba(107, 77, 44, 0.8);
}

.btn {
  background: linear-gradient(180deg, #FFE8C7, #F6D5A8);
  border: 1px solid #B98352;
  color: #3B2613;
  box-shadow: 0 3px 0 rgba(115, 74, 38, 0.5);
}

.btn:active {
  transform: translateY(1px) scale(0.99);
  box-shadow: 0 1px 0 rgba(115, 74, 38, 0.5);
}

.btn.primary {
  background: linear-gradient(180deg, #F97316, #EA580C);
  border: 1px solid #C2410C;
  color: #FFFFFF;
  box-shadow: 0 6px 0 rgba(120, 60, 16, 0.55), 0 14px 26px rgba(249, 115, 22, 0.35);
}

.btn.primary:active {
  box-shadow: 0 3px 0 rgba(120, 60, 16, 0.55), 0 8px 16px rgba(249, 115, 22, 0.3);
}

.btn.ghost {
  background: rgba(255, 236, 204, 0.5);
  border-color: rgba(124, 86, 52, 0.35);
  color: #5B3B1D;
}

.iconBtn {
  background: rgba(255, 236, 210, 0.9);
  border: 1px solid #C59A6A;
  color: #4A3219;
  box-shadow: 0 2px 0 rgba(124, 86, 52, 0.45);
}

.iconBtn.primary {
  background: rgba(249, 115, 22, 0.16);
  border-color: rgba(249, 115, 22, 0.45);
  color: #C2410C;
}

body:not(.dark) .iconBtn.primary.isDone {
  background: #16A34A;
  border-color: #15803D;
  color: #F0FDF4;
  box-shadow: 0 2px 0 rgba(20, 83, 45, 0.45);
}

.iconBtn.danger {
  background: rgba(220, 38, 38, 0.15);
  border-color: rgba(220, 38, 38, 0.35);
  color: #991B1B;
}

.seg {
  background: rgba(91, 59, 29, 0.1);
  border: 1px solid rgba(124, 86, 52, 0.35);
}

.segBtn {
  color: rgba(107, 77, 44, 0.8);
}

.segBtn.isActive {
  background: linear-gradient(180deg, #FDE68A, #F59E0B);
  color: #2B1E12;
  box-shadow: 0 4px 12px rgba(249, 115, 22, 0.25);
}

.tabbar {
  background: linear-gradient(180deg, #1B1917, #0E0D0B);
  border-top: 1px solid rgba(255, 214, 170, 0.25);
  box-shadow: 0 -8px 20px rgba(0, 0, 0, 0.3);
}

.tabBtn {
  color: rgba(253, 230, 138, 0.75);
}

.tabBtn.isActive {
  background: linear-gradient(180deg, #FCD34D, #F97316);
  border: 1px solid #F59E0B;
  color: #2B1E12;
  box-shadow: 0 8px 16px rgba(249, 115, 22, 0.35);
}

.modal {
  background: linear-gradient(180deg, rgba(255, 246, 224, 0.98), rgba(246, 225, 196, 0.98));
  border: 1px solid rgba(124, 86, 52, 0.28);
  box-shadow: var(--shadowBig);
}

.modalHeader {
  background: linear-gradient(90deg, rgba(28, 25, 23, 0.94), rgba(44, 32, 23, 0.94));
  border-bottom: 1px solid rgba(253, 230, 138, 0.18);
}

.modalHeader .modalTitle,
.modalHeader .modalHint {
  color: var(--bandText);
}

.modalHeader .iconBtn,
.modalHeader .btn {
  background: rgba(253, 230, 138, 0.12);
  border-color: rgba(253, 230, 138, 0.35);
  color: var(--bandText);
}

.auditDow,
.miniDow {
  color: rgba(107, 77, 44, 0.9);
}

.auditDay,
.miniDay {
  background: rgba(255, 245, 228, 0.95);
  border-color: rgba(120, 84, 50, 0.28);
}

.auditDay.isToday,
.miniDay.isToday {
  border-color: rgba(249, 115, 22, 0.75);
  box-shadow: 0 0 0 4px rgba(249, 115, 22, 0.15);
}

.auditDay.isSelected,
.miniDay.isSelected {
  border-color: rgba(220, 38, 38, 0.7);
  box-shadow: 0 0 0 5px rgba(220, 38, 38, 0.18);
}

.miniDot {
  background: rgba(249, 115, 22, 0.85);
}

.auditBadge {
  background: rgba(255, 236, 210, 0.9);
  border-color: rgba(124, 86, 52, 0.25);
  color: rgba(107, 77, 44, 0.9);
}

.notes {
  background:
    linear-gradient(180deg, rgba(255, 244, 222, 0.95), rgba(248, 227, 198, 0.95)),
    repeating-linear-gradient(0deg, rgba(124, 86, 52, 0.1) 0 1px, transparent 1px 24px);
  border-color: rgba(124, 86, 52, 0.35);
}

.skillWrap {
  background:
    radial-gradient(480px 320px at 50% 0%, rgba(249, 115, 22, 0.2), transparent 60%),
    radial-gradient(circle at 1px 1px, rgba(92, 62, 34, 0.08) 1px, transparent 1.8px);
  background-size: auto, 18px 18px;
  border: 1px solid rgba(124, 86, 52, 0.28);
}

#skillMap,
#skillMap text {
  font-family: "Russo One", "Rubik", sans-serif;
}

select.search {
  background-image:
    linear-gradient(45deg, transparent 50%, rgba(107, 77, 44, 0.8) 50%),
    linear-gradient(135deg, rgba(107, 77, 44, 0.8) 50%, transparent 50%);
}

.fileName {
  color: rgba(107, 77, 44, 0.8);
}

/* Dark mode: night mission */
body.dark {
  --bg: #0E0B08;
  --card: #1D1510;
  --surface2: #271B12;
  --surface3: #3A291B;
  --text: #FBEFDB;
  --muted: #D4B88E;
  --line: rgba(255, 214, 170, 0.18);
  --primary: #FB923C;
  --primaryPressed: #F97316;

  --goodPurple: #FCD34D;
  --blue: #7DD3FC;
  --green: #4ADE80;
  --orange: #FB923C;
  --red: #F87171;

  --band: #0F0E0C;
  --bandEdge: rgba(255, 198, 130, 0.3);
  --bandText: #FDE68A;
  --metal: #C1AB88;
  --metalEdge: #6D4E2F;

  --map-core: #1B120B;
  --map-node: #24170F;
  --map-arrow: rgba(251, 146, 60, 0.5);

  --toast-bg: rgba(15, 10, 6, 0.92);
  --toast-text: #FDE68A;
  --toast-shadow: 0 14px 34px rgba(0, 0, 0, 0.45);

  background-color: var(--bg);
  background-image:
    radial-gradient(420px 280px at 12% 0%, rgba(249, 115, 22, 0.18), transparent 60%),
    radial-gradient(420px 300px at 90% 12%, rgba(220, 38, 38, 0.12), transparent 60%),
    repeating-linear-gradient(135deg, rgba(255, 214, 170, 0.08) 0 2px, transparent 2px 14px);
}

body.dark .topbar {
  background: linear-gradient(90deg, rgba(16, 14, 12, 0.96), rgba(26, 18, 12, 0.98));
  border-color: rgba(255, 198, 130, 0.25);
}

body.dark .card {
  background:
    linear-gradient(180deg, rgba(34, 23, 15, 0.98), rgba(26, 18, 12, 0.98)),
    repeating-linear-gradient(90deg, rgba(255, 214, 170, 0.06) 0 1px, transparent 1px 28px);
  border-color: rgba(255, 214, 170, 0.15);
  box-shadow: 0 20px 36px rgba(0, 0, 0, 0.45);
}

body.dark .card::after {
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

body.dark .cardInset,
body.dark .summary,
body.dark .chartWrap,
body.dark .miniCal,
body.dark .skillWrap {
  background: rgba(28, 19, 12, 0.9);
  border-color: rgba(255, 214, 170, 0.12);
}

body.dark .item {
  background: rgba(28, 19, 12, 0.95);
  border-color: rgba(255, 214, 170, 0.18);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.4);
}

body.dark input[type="text"],
body.dark input[type="date"],
body.dark input[type="number"],
body.dark select,
body.dark textarea,
body.dark .search,
body.dark .selectBtn,
body.dark .pickerBtn {
  background: #1F1510;
  border-color: rgba(255, 214, 170, 0.18);
  color: var(--text);
}

body.dark input::placeholder,
body.dark textarea::placeholder {
  color: rgba(253, 230, 138, 0.5);
}

body.dark .chip {
  background: rgba(253, 230, 138, 0.08);
  border-color: rgba(253, 230, 138, 0.25);
  color: var(--bandText);
}

body.dark .btn {
  background: linear-gradient(180deg, #2A1D14, #20150E);
  border-color: rgba(255, 214, 170, 0.2);
  color: var(--text);
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.5);
}

body.dark .btn.ghost {
  background: rgba(255, 214, 170, 0.08);
  border-color: rgba(255, 214, 170, 0.25);
  color: var(--bandText);
}

body.dark .iconBtn {
  background: rgba(255, 214, 170, 0.08);
  border-color: rgba(255, 214, 170, 0.25);
  color: var(--bandText);
}

body.dark .iconBtn.primary.isDone {
  background: #2563EB;
  border-color: #1D4ED8;
  color: #E0F2FE;
  box-shadow: 0 2px 0 rgba(15, 23, 42, 0.5);
}

body.dark .seg {
  background: rgba(255, 214, 170, 0.08);
  border-color: rgba(255, 214, 170, 0.2);
}

body.dark .segBtn {
  color: rgba(253, 230, 138, 0.7);
}

body.dark .segBtn.isActive {
  background: linear-gradient(180deg, #FB923C, #F97316);
  color: #1B1209;
}

body.dark .tabbar {
  background: linear-gradient(180deg, #0E0D0B, #070605);
  border-top-color: rgba(255, 214, 170, 0.18);
}

body.dark .tabBtn {
  color: rgba(253, 230, 138, 0.7);
}

body.dark .tabBtn.isActive {
  background: linear-gradient(180deg, #FB923C, #F97316);
  border-color: #C2410C;
  color: #1B1209;
}

body.dark .modal {
  background: linear-gradient(180deg, rgba(28, 19, 12, 0.98), rgba(20, 14, 9, 0.98));
  border-color: rgba(255, 214, 170, 0.18);
}

body.dark .modalHeader {
  background: linear-gradient(90deg, rgba(16, 14, 12, 0.96), rgba(26, 18, 12, 0.98));
  border-bottom-color: rgba(255, 214, 170, 0.14);
}

body.dark .auditDay,
body.dark .miniDay {
  background: rgba(20, 14, 9, 0.95);
  border-color: rgba(255, 214, 170, 0.2);
}

body.dark .auditDayNum,
body.dark .miniDayNum {
  color: var(--text);
}

body.dark .auditBadge {
  background: rgba(20, 14, 9, 0.9);
  border-color: rgba(255, 214, 170, 0.2);
  color: rgba(253, 230, 138, 0.8);
}

body.dark .notes {
  background:
    linear-gradient(180deg, rgba(28, 19, 12, 0.95), rgba(20, 14, 9, 0.95)),
    repeating-linear-gradient(0deg, rgba(255, 214, 170, 0.12) 0 1px, transparent 1px 24px);
  border-color: rgba(255, 214, 170, 0.2);
}

body.dark select.search {
  background-image:
    linear-gradient(45deg, transparent 50%, rgba(253, 230, 138, 0.8) 50%),
    linear-gradient(135deg, rgba(253, 230, 138, 0.8) 50%, transparent 50%);
}

body.dark .fileName {
  color: rgba(253, 230, 138, 0.75);
}

/* === Ninja boost: darker cloth, metal, smoke === */
:root {
  --ninja-ink: #1A1410;
  --ninja-ash: #3A2B1E;
  --ninja-metal: #C2AB86;
  --ninja-rivet: #6E4E2F;
  --ninja-stitch: rgba(253, 230, 138, 0.25);
  --ninja-smoke: rgba(22, 15, 10, 0.18);
  --ninja-accent: #D9480F;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: var(--wallpaper-overlay), var(--wallpaper-image);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  z-index: 0;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: var(--wallpaper-vignette);
  mix-blend-mode: var(--wallpaper-blend);
  opacity: var(--wallpaper-vignette-opacity);
  z-index: 1;
}

.app {
  position: relative;
  z-index: 2;
}

.topbar {
  position: relative;
  overflow: hidden;
  background:
    repeating-linear-gradient(135deg, rgba(255, 214, 170, 0.08) 0 2px, transparent 2px 10px),
    linear-gradient(90deg, rgba(16, 14, 12, 0.98), rgba(34, 24, 16, 0.98));
}

.topbar::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 220px;
  height: 44px;
  transform: translate(-50%, -50%);
  border-radius: 10px;
  background:
    radial-gradient(circle at 16px 14px, var(--ninja-rivet) 0 4px, transparent 5px),
    radial-gradient(circle at calc(100% - 16px) 14px, var(--ninja-rivet) 0 4px, transparent 5px),
    radial-gradient(circle at 16px calc(100% - 14px), var(--ninja-rivet) 0 4px, transparent 5px),
    radial-gradient(circle at calc(100% - 16px) calc(100% - 14px), var(--ninja-rivet) 0 4px, transparent 5px),
    linear-gradient(180deg, #D5C2A1, #A88962);
  border: 2px solid #5A3F25;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.25), 0 10px 18px rgba(0, 0, 0, 0.35);
  opacity: 0.9;
  z-index: 0;
}

.topbar > * {
  position: relative;
  z-index: 1;
}

.brand .icon {
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.45);
}

.card {
  border-left: 4px solid rgba(217, 72, 15, 0.65);
}

.card::before {
  content: "";
  position: absolute;
  right: 14px;
  top: 14px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: radial-gradient(circle, #DC2626 0 45%, #7F1D1D 46% 100%);
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.15);
  opacity: 0.45;
  pointer-events: none;
  z-index: 0;
}

/* Hide the dot only on cards whose header has right-side controls */
.card:has(.cardHeader .seg)::before,
.card:has(.cardHeader .row)::before {
  opacity: 0;
}

.card > * {
  position: relative;
  z-index: 1;
}

.item::after {
  content: "";
  position: absolute;
  right: 12px;
  top: 12px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(220, 38, 38, 0.7);
  box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.2);
  opacity: 0.4;
  pointer-events: none;
  z-index: 0;
}

.item > * {
  position: relative;
  z-index: 1;
}

.btn {
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.35);
}

.btn.primary {
  background:
    linear-gradient(135deg, rgba(0, 0, 0, 0.18) 0 16%, transparent 16% 100%),
    linear-gradient(180deg, #F97316, #C2410C);
}

.btn.primary::after {
  content: "";
  position: absolute;
  inset: 2px;
  border-radius: inherit;
  border: 1px dashed rgba(255, 236, 210, 0.35);
  pointer-events: none;
  opacity: 0.6;
}

.btn,
.iconBtn,
.selectBtn,
.pickerBtn {
  position: relative;
}

.seg {
  background:
    repeating-linear-gradient(45deg, rgba(253, 230, 138, 0.08) 0 2px, transparent 2px 10px),
    rgba(28, 22, 18, 0.1);
}

.segBtn.isActive {
  border: 1px solid rgba(90, 63, 37, 0.6);
}

.tabbar {
  background:
    repeating-linear-gradient(90deg, rgba(253, 230, 138, 0.08) 0 1px, transparent 1px 18px),
    linear-gradient(180deg, #0E0D0B, #050403);
}

.tabbar::before {
  content: "";
  position: absolute;
  left: 10px;
  right: 10px;
  top: 8px;
  height: 2px;
  background:
    repeating-linear-gradient(90deg, var(--ninja-stitch) 0 8px, transparent 8px 16px);
  opacity: 0.7;
}

.tabBtn.isActive {
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.35);
}

.modalHeader {
  background:
    repeating-linear-gradient(135deg, rgba(253, 230, 138, 0.08) 0 2px, transparent 2px 10px),
    linear-gradient(90deg, rgba(16, 14, 12, 0.98), rgba(34, 24, 16, 0.98));
}

body.dark .card {
  border-left-color: rgba(251, 146, 60, 0.7);
}

body.dark .card::before,
body.dark .item::after {
  opacity: 0.35;
}

body.dark .btn.primary::after {
  border-color: rgba(255, 214, 170, 0.25);
}

/* === Naruto (light) / Sasuke (dark) wallpaper themes === */
body:not(.dark) {
  --wallpaper-image: var(--wallpaper-image-light);
  --bg: #E7D1B4;
  --card: rgba(243, 224, 200, 0.94);
  --surface2: rgba(239, 218, 190, 0.92);
  --surface3: rgba(228, 200, 168, 0.9);
  --text: #1F140B;
  --muted: #5A3B24;
  --line: rgba(90, 60, 35, 0.32);
  --primary: #C2410C;
  --primaryPressed: #9A3412;

  --goodPurple: #2563EB;
  --blue: #2563EB;
  --green: #16A34A;
  --orange: #C2410C;
  --red: #B91C1C;

  --band: #1E1611;
  --bandEdge: rgba(120, 84, 50, 0.45);
  --bandText: #F1E1C9;
  --metal: #B89C76;
  --metalEdge: #6E4E2F;

  --ring: 0 0 0 4px rgba(194, 65, 12, 0.25);
  --ring2: 0 0 0 6px rgba(127, 29, 29, 0.22);

  --map-core: #F2DEC3;
  --map-node: #EBD4B4;
  --map-arrow: rgba(122, 86, 48, 0.4);

  --toast-bg: rgba(32, 22, 14, 0.92);
  --toast-text: #F1E1C9;
  --toast-shadow: 0 14px 34px rgba(30, 18, 10, 0.35);

  --wallpaper-overlay:
    linear-gradient(180deg, rgba(234, 214, 187, 0.25) 0%, rgba(231, 208, 178, 0.15) 55%, rgba(237, 218, 195, 0.3) 100%),
    radial-gradient(520px 340px at 12% 0%, rgba(194, 65, 12, 0.05), transparent 60%),
    radial-gradient(600px 360px at 90% 8%, rgba(59, 130, 246, 0.04), transparent 60%);
  --wallpaper-vignette-opacity: 0.7;
  --wallpaper-blend: normal;

  background-color: var(--bg);
  background-image: none;
}

body.dark {
  --bg: #0A0D1A;
  --card: rgba(12, 16, 27, 0.88);
  --surface2: rgba(20, 26, 40, 0.72);
  --surface3: rgba(30, 38, 56, 0.78);
  --text: #E6ECFF;
  --muted: #9AA6C6;
  --line: rgba(130, 150, 190, 0.2);
  --shadow: 0 10px 26px rgba(0, 0, 0, 0.45);
  --shadowBig: 0 26px 64px rgba(0, 0, 0, 0.6);
  --shadowSoft: 0 12px 32px rgba(0, 0, 0, 0.4);
  --primary: #6366F1;
  --primaryPressed: #4F46E5;
  --ring: 0 0 0 4px rgba(99, 102, 241, 0.28);
  --ring2: 0 0 0 6px rgba(59, 130, 246, 0.24);

  --goodPurple: #A78BFA;
  --blue: #60A5FA;
  --green: #34D399;
  --orange: #60A5FA;
  --red: #94A3B8;

  --band: #0B0F1A;
  --bandEdge: rgba(124, 140, 180, 0.35);
  --bandText: #C7D2FE;
  --metal: #A3AEC7;
  --metalEdge: #4B5563;

  --map-core: #0A0E1A;
  --map-node: #111827;
  --map-arrow: rgba(99, 102, 241, 0.55);

  --toast-bg: rgba(8, 11, 20, 0.92);
  --toast-text: #C7D2FE;
  --toast-shadow: 0 16px 36px rgba(0, 0, 0, 0.55);

  --ninja-ink: #0E121C;
  --ninja-ash: #1F2736;
  --ninja-metal: #A5AFC6;
  --ninja-rivet: #4B5563;
  --ninja-stitch: rgba(129, 140, 248, 0.35);
  --ninja-smoke: rgba(9, 12, 22, 0.28);
  --ninja-accent: #6366F1;

  --wallpaper-image: var(--wallpaper-image-dark);
  --wallpaper-overlay:
    linear-gradient(180deg, rgba(7, 9, 16, 0.82) 0%, rgba(12, 18, 32, 0.6) 45%, rgba(7, 9, 16, 0.92) 100%),
    radial-gradient(520px 360px at 12% 0%, rgba(99, 102, 241, 0.28), transparent 60%),
    radial-gradient(700px 420px at 90% 10%, rgba(56, 189, 248, 0.18), transparent 60%),
    repeating-linear-gradient(135deg, rgba(148, 163, 184, 0.08) 0 2px, transparent 2px 14px);
  --wallpaper-vignette:
    radial-gradient(1200px 700px at 50% -10%, rgba(0, 0, 0, 0.4), transparent 60%),
    radial-gradient(1400px 900px at 50% 120%, rgba(0, 0, 0, 0.55), transparent 72%);
  --wallpaper-vignette-opacity: 1;
  --wallpaper-blend: multiply;

  background-color: var(--bg);
  background-image: none;
}

body:not(.dark) .topbar {
  background:
    linear-gradient(90deg, rgba(243, 222, 195, 0.96), rgba(232, 202, 170, 0.98)),
    repeating-linear-gradient(135deg, rgba(94, 61, 33, 0.16) 0 2px, transparent 2px 12px);
  border-color: rgba(94, 61, 33, 0.3);
}

body:not(.dark) .brandTitle {
  color: var(--text);
}

body:not(.dark) .brandSubtitle {
  color: #6A4A2C;
}

body:not(.dark) .topbar .chip,
body:not(.dark) .topbar .btn,
body:not(.dark) .topbar .iconBtn {
  background: rgba(245, 225, 200, 0.9);
  border-color: rgba(110, 74, 43, 0.35);
  color: #5A3B24;
}

body.dark .topbar {
  background:
    linear-gradient(90deg, rgba(8, 10, 18, 0.95), rgba(16, 20, 34, 0.98)),
    repeating-linear-gradient(135deg, rgba(129, 140, 248, 0.12) 0 2px, transparent 2px 12px);
  border-color: rgba(129, 140, 248, 0.35);
}

body:not(.dark) .card {
  background: rgba(243, 224, 200, 0.94);
  border-color: rgba(110, 74, 43, 0.28);
  box-shadow: 0 20px 38px rgba(70, 42, 18, 0.28);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

body.dark .card {
  background: linear-gradient(180deg, rgba(14, 18, 32, 0.92), rgba(10, 14, 26, 0.92));
  border-color: rgba(129, 140, 248, 0.22);
  box-shadow: 0 24px 44px rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-left-color: rgba(129, 140, 248, 0.7);
}

body:not(.dark) .cardInset,
body:not(.dark) .summary,
body:not(.dark) .chartWrap,
body:not(.dark) .miniCal,
body:not(.dark) .skillWrap {
  background: rgba(239, 218, 190, 0.9);
  border-color: var(--line);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}


body.dark .cardInset,
body.dark .summary,
body.dark .chartWrap,
body.dark .miniCal,
body.dark .skillWrap {
  background: rgba(12, 16, 27, 0.82);
  border-color: rgba(129, 140, 248, 0.2);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

body.dark .chip {
  background: rgba(15, 20, 32, 0.6);
  border-color: rgba(129, 140, 248, 0.25);
  color: var(--bandText);
}

body.dark .btn {
  background: linear-gradient(180deg, #151B2B, #101626);
  border-color: rgba(129, 140, 248, 0.22);
  color: var(--text);
}

body.dark .btn.ghost,
body.dark .iconBtn {
  background: rgba(99, 102, 241, 0.12);
  border-color: rgba(129, 140, 248, 0.25);
  color: var(--bandText);
}

body.dark .btn.primary {
  background:
    linear-gradient(135deg, rgba(0, 0, 0, 0.22) 0 16%, transparent 16% 100%),
    linear-gradient(180deg, #6366F1, #4338CA);
}

body.dark .btn.primary::after {
  border-color: rgba(199, 210, 254, 0.35);
}

body:not(.dark) .seg {
  background:
    repeating-linear-gradient(45deg, rgba(90, 60, 35, 0.18) 0 2px, transparent 2px 12px),
    rgba(240, 218, 188, 0.8);
}

body.dark .seg {
  background:
    repeating-linear-gradient(45deg, rgba(129, 140, 248, 0.12) 0 2px, transparent 2px 12px),
    rgba(15, 20, 32, 0.35);
  border-color: rgba(129, 140, 248, 0.22);
}

body.dark .segBtn {
  color: rgba(199, 210, 254, 0.75);
}

body.dark .segBtn.isActive {
  background: linear-gradient(180deg, #6366F1, #4F46E5);
  border-color: #312E81;
  color: #EEF2FF;
}

body:not(.dark) .tabbar {
  background:
    repeating-linear-gradient(90deg, rgba(90, 60, 35, 0.16) 0 1px, transparent 1px 18px),
    linear-gradient(180deg, rgba(238, 215, 188, 0.96), rgba(225, 196, 164, 0.96));
  border-top-color: rgba(110, 74, 43, 0.3);
}

body.dark .tabbar {
  background:
    repeating-linear-gradient(90deg, rgba(129, 140, 248, 0.12) 0 1px, transparent 1px 18px),
    linear-gradient(180deg, #0B0F1A, #070911);
  border-top-color: rgba(129, 140, 248, 0.2);
}

body:not(.dark) .tabBtn.isActive {
  background: linear-gradient(180deg, #C2410C, #9A3412);
  border-color: #7C2D12;
  color: #F8EBDD;
}

body.dark .tabBtn.isActive {
  background: linear-gradient(180deg, #6366F1, #4F46E5);
  border-color: #312E81;
  color: #EEF2FF;
}

/* === Custom skill map background images === */
body:not(.dark) .skillWrap {
  background-image: var(--skill-bg-overlay-light), var(--skill-bg-image-light);
  background-size: auto, cover;
  background-position: center, center;
  background-repeat: no-repeat, no-repeat;
}

body.dark .skillWrap {
  background-image: var(--skill-bg-overlay-dark), var(--skill-bg-image-dark);
  background-size: auto, cover;
  background-position: center, center;
  background-repeat: no-repeat, no-repeat;
}

body:not(.dark) .modalHeader {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.12), transparent 35%),
    linear-gradient(180deg, #E38B3A 0%, #C65B18 55%, #9E4512 100%);
  border-bottom: 1px solid rgba(82, 32, 10, 0.42);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

body:not(.dark) .modalHeader .modalTitle,
body:not(.dark) .modalHeader .modalHint {
  color: #FFF4E6;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.3);
}

body:not(.dark) .modalHeader .iconBtn,
body:not(.dark) .modalHeader .btn {
  background: rgba(255, 232, 210, 0.14);
  border-color: rgba(255, 216, 170, 0.45);
  color: #FDE7D1;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

body:not(.dark) .btn.primary:active {
  background: linear-gradient(180deg, #F97316, #C2410C);
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.18);
}

body.dark .modalHeader {
  background:
    repeating-linear-gradient(135deg, rgba(129, 140, 248, 0.14) 0 2px, transparent 2px 10px),
    linear-gradient(90deg, rgba(8, 10, 18, 0.96), rgba(16, 20, 34, 0.98));
}

body.dark .segBtn.isActive,
body.dark .tabBtn.isActive {
  background: linear-gradient(180deg, #60A5FA, #2563EB);
  border-color: #1D4ED8;
  color: #0B1220;
  box-shadow: 0 8px 16px rgba(59, 130, 246, 0.35);
}

body.dark .card {
  border-left-color: rgba(96, 165, 250, 0.7);
}

body.dark .notes {
  background:
    linear-gradient(180deg, rgba(12, 16, 27, 0.9), rgba(8, 11, 20, 0.92)),
    repeating-linear-gradient(0deg, rgba(129, 140, 248, 0.18) 0 1px, transparent 1px 24px);
  border-color: rgba(129, 140, 248, 0.25);
}

body.dark select.search {
  background-image:
    linear-gradient(45deg, transparent 50%, rgba(199, 210, 254, 0.8) 50%),
    linear-gradient(135deg, rgba(199, 210, 254, 0.8) 50%, transparent 50%);
}

body.dark .fileName {
  color: rgba(199, 210, 254, 0.8);
}

body.dark .topbar .brandSubtitle {
  color: rgba(199, 210, 254, 0.7);
}

body.dark .topbar .chip,
body.dark .topbar .btn,
body.dark .topbar .iconBtn {
  background: rgba(99, 102, 241, 0.12);
  border-color: rgba(129, 140, 248, 0.3);
  color: var(--bandText);
}

body.dark .brand .icon,
body.dark .brand .icon.hasImg {
  background: radial-gradient(circle at 40% 40%, #93C5FD 0 24%, #6366F1 25% 58%, #0B0F1A 59% 100%);
  border-color: rgba(129, 140, 248, 0.6);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.45);
}

body.dark input[type="text"],
body.dark input[type="date"],
body.dark input[type="number"],
body.dark select,
body.dark textarea,
body.dark .search,
body.dark .selectBtn,
body.dark .pickerBtn {
  background: rgba(12, 16, 27, 0.92);
  border-color: rgba(129, 140, 248, 0.28);
  color: var(--text);
}

body.dark input::placeholder,
body.dark textarea::placeholder {
  color: rgba(199, 210, 254, 0.55);
}

body.dark .tabBtn {
  color: rgba(199, 210, 254, 0.7);
}

body.dark .auditDow,
body.dark .miniDow,
body.dark .miniSelectedLabel {
  color: rgba(199, 210, 254, 0.6);
}

body.dark .auditDay,
body.dark .miniDay {
  background: rgba(9, 12, 22, 0.9);
  border-color: rgba(129, 140, 248, 0.32);
}

body.dark .auditDay:hover,
body.dark .miniDay:hover {
  border-color: rgba(129, 140, 248, 0.6);
  box-shadow: 0 14px 26px rgba(79, 70, 229, 0.22);
}

body.dark .auditDay.isToday,
body.dark .miniDay.isToday {
  border-color: rgba(129, 140, 248, 0.85);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.25);
}

body.dark .auditDay.isSelected,
body.dark .miniDay.isSelected {
  border-color: rgba(99, 102, 241, 0.95);
  box-shadow: 0 0 0 5px rgba(99, 102, 241, 0.28);
}

body.dark .auditBadge {
  background: rgba(10, 14, 26, 0.88);
  border-color: rgba(129, 140, 248, 0.28);
  color: rgba(199, 210, 254, 0.9);
}

body.dark .badge {
  background: rgba(14, 18, 30, 0.72);
  color: var(--text);
  border-color: rgba(129, 140, 248, 0.2);
}

body.dark .badge.dim {
  background: rgba(14, 18, 30, 0.5);
  color: rgba(199, 210, 254, 0.65);
  border-color: rgba(129, 140, 248, 0.18);
}

body.dark .badge.mand {
  background: rgba(99, 102, 241, 0.22);
  color: #E0E7FF;
  border-color: rgba(99, 102, 241, 0.45);
}

body.dark .icon {
  background: rgba(99, 102, 241, 0.18);
  color: var(--text);
}

body.dark .card::before {
  background: radial-gradient(circle, #60A5FA 0 45%, #1E3A8A 46% 100%);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
  opacity: 0.5;
}

body.dark .item::after {
  background: rgba(99, 102, 241, 0.7);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.25);
  opacity: 0.45;
}

/* === Contrast fixes + remove rivet plate === */
.topbar::before {
  content: none;
  display: none;
}

body:not(.dark) .brand .icon {
  background: radial-gradient(circle at 40% 40%, #E6B87A 0 24%, #C2410C 25% 58%, #2A1B10 59% 100%);
  border-color: rgba(110, 74, 43, 0.55);
  box-shadow: 0 8px 18px rgba(60, 36, 16, 0.35);
}

body:not(.dark) .chip {
  background: rgba(244, 226, 204, 0.92);
  border-color: rgba(110, 74, 43, 0.3);
  color: var(--muted);
}

body:not(.dark) .badge {
  background: rgba(246, 231, 210, 0.95);
  border-color: rgba(110, 74, 43, 0.3);
  color: #5A3B24;
}

body:not(.dark) .badge.mand {
  color: #7C2D12;
  background: rgba(194, 65, 12, 0.12);
  border-color: rgba(194, 65, 12, 0.28);
}

body.dark .miniDot {
  background: rgba(99, 102, 241, 0.85);
}

body.dark .card::before {
  background: radial-gradient(circle, #1F2937 0 45%, #0B0F1A 46% 100%);
  box-shadow: 0 0 0 2px rgba(30, 64, 175, 0.2);
  opacity: 0.2;
}

body.dark .item::after {
  background: rgba(30, 41, 59, 0.45);
  box-shadow: 0 0 0 2px rgba(30, 64, 175, 0.18);
  opacity: 0.25;
}

body.dark #screen-settings .card,
body.dark #screen-settings .cardInset,
body.dark #screen-settings .notes {
  background: #0E1424;
  border-color: rgba(129, 140, 248, 0.25);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

body.dark #screen-settings input[type="file"].search,
body.dark #screen-settings input[type="text"].search {
  background: #0E1424;
  border-color: rgba(129, 140, 248, 0.28);
  color: var(--text);
}

body.dark #screen-settings input::file-selector-button {
  background: #1B2338;
  border-color: rgba(129, 140, 248, 0.3);
  color: #E0E7FF;
}

/* === Final theme corrections === */
body.dark .item::before {
  background: linear-gradient(180deg, #6366F1, #1E3A8A);
  opacity: 0.55;
}

body:not(.dark) .item.isMission::before {
  background: linear-gradient(180deg, #34D399, #16A34A);
  opacity: 0.82;
}

body.dark .item.isMission::before {
  background: linear-gradient(180deg, #6EE7B7, #10B981);
  opacity: 0.74;
}

body.dark .badge {
  background: rgba(99, 102, 241, 0.18);
  border-color: rgba(129, 140, 248, 0.38);
  color: #E0E7FF;
}

body.dark .badge.mand {
  background: rgba(79, 70, 229, 0.28);
  border-color: rgba(99, 102, 241, 0.5);
  color: #E0E7FF;
}

body.dark .ltGlowOrange {
  filter: drop-shadow(0 14px 26px rgba(99, 102, 241, 0.3));
}

body.dark .card::before,
body.dark .item::after {
  display: none;
}

body.dark .item {
  background: rgba(12, 16, 27, 0.92);
  border-color: rgba(129, 140, 248, 0.22);
  color: var(--text);
  box-shadow: 0 16px 30px rgba(0, 0, 0, 0.45);
}

body.dark .item:hover {
  box-shadow: 0 18px 32px rgba(30, 41, 59, 0.55);
}

/* === Dark theme: blue accents for all "gray" UI === */
body.dark {
  --muted: #A7B4D8;
  --line: rgba(129, 140, 248, 0.36);
}

body.dark .card {
  background:
    linear-gradient(90deg, rgba(8, 10, 18, 0.95), rgba(16, 20, 34, 0.98)),
    repeating-linear-gradient(135deg, rgba(129, 140, 248, 0.12) 0 2px, transparent 2px 12px);
  border-color: rgba(129, 140, 248, 0.32);
  box-shadow: 0 22px 44px rgba(5, 8, 16, 0.55);
}

body.dark .cardInset,
body.dark .summary,
body.dark .chartWrap,
body.dark .miniCal,
body.dark .skillWrap {
  background: rgba(8, 10, 18, 0.92);
  border-color: rgba(129, 140, 248, 0.3);
}

body.dark .cardHint,
body.dark .lbl,
body.dark .fileName,
body.dark .tabsCfgRow .lbl,
body.dark .sub {
  color: rgba(175, 187, 230, 0.8);
}

body.dark input[type="text"],
body.dark input[type="date"],
body.dark input[type="number"],
body.dark select,
body.dark textarea,
body.dark .search,
body.dark .selectBtn,
body.dark .pickerBtn {
  background: #0B1220;
  border-color: rgba(129, 140, 248, 0.35);
  color: #E6ECFF;
}

body.dark input::placeholder,
body.dark textarea::placeholder {
  color: rgba(163, 176, 212, 0.65);
}

body.dark .chip {
  background: rgba(79, 70, 229, 0.16);
  border-color: rgba(129, 140, 248, 0.32);
  color: #C7D2FE;
}

body.dark .btn {
  background: linear-gradient(180deg, #1E293B, #111827);
  border-color: rgba(129, 140, 248, 0.32);
  color: #E2E8F0;
  box-shadow: 0 6px 12px rgba(5, 8, 16, 0.45);
}

body.dark .btn.ghost,
body.dark .iconBtn {
  background: rgba(79, 70, 229, 0.14);
  border-color: rgba(129, 140, 248, 0.35);
  color: #C7D2FE;
}

body.dark .btn.primary {
  background: linear-gradient(180deg, #4F46E5, #3730A3);
  border-color: #312E81;
  color: #F1F5FF;
  box-shadow: 0 10px 20px rgba(79, 70, 229, 0.35);
}

body.dark .btn.primary::after {
  border-color: rgba(199, 210, 254, 0.35);
}

body.dark .modal {
  background: #0C0F1A;
  border-color: rgba(129, 140, 248, 0.32);
}

body.dark .modalHeader {
  background: linear-gradient(90deg, rgba(10, 14, 26, 0.98), rgba(16, 22, 40, 0.98));
  border-bottom-color: rgba(129, 140, 248, 0.32);
}

body.dark #screen-settings .card,
body.dark #screen-settings .cardInset,
body.dark #screen-settings .notes {
  background: #0C0F1A;
  border-color: rgba(129, 140, 248, 0.32);
}

body.dark #screen-settings input[type="file"].search,
body.dark #screen-settings input[type="text"].search {
  background: #0B1220;
  border-color: rgba(129, 140, 248, 0.35);
  color: #E6ECFF;
}

/* === Brand logo: Naruto hair (light) / Sharingan (dark) === */
body:not(.dark) .brand .icon {
  background:
    radial-gradient(circle at 72% 28%, rgba(255, 243, 188, 0.92) 0 15%, rgba(255, 213, 120, 0.28) 16% 28%, transparent 29%),
    radial-gradient(150% 108% at 50% 125%, #2F5B2B 0 30%, #1F4B26 31% 44%, transparent 45%),
    linear-gradient(155deg, #F7D9AE 0%, #ECA463 52%, #D77D4F 100%);
  border: 2px solid #166534;
  box-shadow: 0 8px 18px rgba(60, 36, 16, 0.35);
}

body:not(.dark) .brand .icon.hasImg {
  border: 2px solid #166534;
}

/* === Calendar header: unify arrows + month pill (light/dark) === */
body:not(.dark) .miniNavBtn,
body:not(.dark) .miniMonthChip,
body:not(.dark) .miniTodayChip {
  background: rgba(233, 209, 181, 0.92);
  border: 1px solid rgba(110, 74, 43, 0.4);
  color: #5A3B24;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

body:not(.dark) .miniNavBtn:hover,
body:not(.dark) .miniTodayChip:hover {
  border-color: rgba(110, 74, 43, 0.55);
  box-shadow: none;
}

body.dark .miniNavBtn,
body.dark .miniMonthChip,
body.dark .miniTodayChip {
  background: #0B1220;
  border: 1px solid rgba(118, 132, 201, 0.45);
  color: #E6ECFF;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

body.dark .miniNavBtn:hover,
body.dark .miniTodayChip:hover {
  border-color: rgba(118, 132, 201, 0.65);
  box-shadow: none;
}

body.dark .brand .icon {
  background:
    radial-gradient(circle at 50% 50%, #0B0F1A 0 18%, #C1121F 19% 38%, #8B0000 39% 55%, #200003 56% 100%),
    radial-gradient(circle at 68% 38%, #0B0F1A 0 7%, transparent 8%),
    radial-gradient(circle at 34% 62%, #0B0F1A 0 7%, transparent 8%),
    radial-gradient(circle at 66% 66%, #0B0F1A 0 7%, transparent 8%);
  border-color: rgba(199, 210, 254, 0.35);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.55);
}

body.dark .title {
  color: #E6ECFF;
}

body.dark .sub {
  color: rgba(199, 210, 254, 0.75);
}

body:not(.dark) .auditDow,
body:not(.dark) .miniDow {
  color: #5A3B24;
}

body:not(.dark) .auditDay,
body:not(.dark) .miniDay {
  background: rgba(226, 201, 170, 0.96);
  border-color: rgba(110, 74, 43, 0.48);
}

body:not(.dark) .auditDayNum,
body:not(.dark) .miniDayNum {
  color: #1F140B;
}

body:not(.dark) .auditDay.isToday,
body:not(.dark) .miniDay.isToday {
  border-color: rgba(194, 65, 12, 0.75);
  box-shadow: 0 0 0 4px rgba(194, 65, 12, 0.18);
}

body:not(.dark) .auditDay.isSelected,
body:not(.dark) .miniDay.isSelected {
  border-color: rgba(124, 45, 18, 0.75);
  box-shadow: 0 0 0 5px rgba(124, 45, 18, 0.18);
}

body:not(.dark) .auditBadge {
  background: rgba(226, 200, 168, 0.95);
  border-color: rgba(110, 74, 43, 0.48);
  color: #3A2314;
}

body:not(.dark) .miniDot {
  background: rgba(124, 45, 18, 0.85);
}

body:not(.dark) .tabBtn {
  color: #4A2F1C;
}

body:not(.dark) .tabbar {
  background:
    repeating-linear-gradient(90deg, rgba(90, 60, 35, 0.2) 0 1px, transparent 1px 18px),
    linear-gradient(180deg, rgba(230, 203, 172, 0.96), rgba(215, 186, 152, 0.96));
  border-top-color: rgba(110, 74, 43, 0.32);
}

body:not(.dark) .tabBtn.isActive {
  background: linear-gradient(180deg, #9A3412, #7C2D12);
  border-color: #6F2B12;
  color: #F6E7D6;
}

body:not(.dark) .miniCal {
  background: rgba(233, 209, 181, 0.92);
  border-color: rgba(110, 74, 43, 0.4);
}

/* === Dark theme: unify settings with Calendar + dark-blue arrows === */
body.dark {
  --muted: #A9B7E0;
  --line: rgba(118, 132, 201, 0.45);
}

body.dark .notes,
body.dark #screen-settings .notes {
  background: #0B1220;
  border-color: rgba(118, 132, 201, 0.35);
  color: #E6ECFF;
}

body.dark #screen-settings .card,
body.dark #screen-settings .cardInset,
body.dark #screen-settings .notes {
  background: #0C0F1A;
  border-color: rgba(118, 132, 201, 0.35);
  box-shadow: 0 18px 36px rgba(6, 10, 20, 0.55);
}

body.dark #screen-settings .cardHint,
body.dark #screen-settings .lbl,
body.dark #screen-settings .fileName,
body.dark .tabsCfgRow .lbl {
  color: rgba(175, 189, 230, 0.85);
}

body.dark .tabsCfgRow {
  border-bottom-color: rgba(118, 132, 201, 0.28);
}

body.dark .iconPreview {
  background: rgba(17, 25, 45, 0.9);
  border-color: rgba(118, 132, 201, 0.28);
}

body.dark #screen-settings .btn,
body.dark #screen-settings .btn.ghost {
  background: linear-gradient(180deg, #1A2340, #0F172A);
  border-color: rgba(118, 132, 201, 0.35);
  color: #E6ECFF;
}

body.dark #screen-settings input[type="file"].search,
body.dark #screen-settings input[type="text"].search {
  background: #0B1220;
  border-color: rgba(118, 132, 201, 0.35);
  color: #E6ECFF;
}

body.dark #screen-settings input::file-selector-button {
  background: #1A2340;
  border-color: rgba(118, 132, 201, 0.35);
  color: #E6ECFF;
}

body.dark .miniNavBtn,
body.dark .miniMonthChip,
body.dark .miniTodayChip {
  background: #0B1220;
  border-color: rgba(118, 132, 201, 0.45);
  color: #E6ECFF;
  box-shadow: none;
}

body.dark .miniNavBtn:hover,
body.dark .miniTodayChip:hover {
  border-color: rgba(118, 132, 201, 0.65);
  box-shadow: none;
}

body.dark #auditPrev,
body.dark #auditNext {
  background: var(--mini-btn-bg);
  border-color: var(--mini-btn-border);
  color: var(--mini-btn-text);
}

/* === Dark theme: Stats match Calendar styling === */
body.dark #screen-stats .summary,
body.dark #screen-stats .cardInset,
body.dark #screen-stats .chartWrap {
  background: #0C0F1A;
  border-color: rgba(118, 132, 201, 0.35);
  box-shadow: 0 16px 34px rgba(6, 10, 20, 0.55);
}

body.dark #screen-stats .subTitle,
body.dark #screen-stats .cardHint {
  color: rgba(175, 189, 230, 0.85);
}

body.dark #screen-stats .chartWrap canvas,
body.dark #screen-stats .chartWrap svg {
  filter: saturate(1.05);
}

/* === Dark theme: Settings match Calendar + remove button shadows === */
body.dark #screen-settings .card,
body.dark #screen-settings .cardInset,
body.dark #screen-settings .notes {
  background: #0C0F1A;
  border-color: rgba(118, 132, 201, 0.35);
  box-shadow: none;
}

body.dark #screen-settings .divider {
  background: rgba(118, 132, 201, 0.25);
}

body.dark #screen-settings .cardHint,
body.dark #screen-settings .lbl,
body.dark #screen-settings .fileName {
  color: rgba(175, 189, 230, 0.9);
}

body.dark #screen-settings input[type="text"].search,
body.dark #screen-settings input[type="file"].search,
body.dark #screen-settings .tabsCfgRow input[type="text"],
body.dark #screen-settings textarea.notes {
  background: #0B1220;
  border-color: rgba(118, 132, 201, 0.35);
  color: #E6ECFF;
}

body.dark #screen-settings input::placeholder,
body.dark #screen-settings textarea::placeholder {
  color: rgba(163, 176, 212, 0.65);
}

body.dark #screen-settings .iconPreview {
  background: #0B1220;
  border-color: rgba(118, 132, 201, 0.28);
}

body.dark #screen-settings .tabsCfgRow {
  border-bottom-color: rgba(118, 132, 201, 0.28);
}

body.dark .btn,
body.dark .btn.primary,
body.dark .btn.ghost,
body.dark .iconBtn {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    inset 0 -1px 0 rgba(0, 0, 0, 0.12),
    0 2px 0 rgba(15, 23, 42, 0.5);
  text-shadow: none;
}

/* === Dark theme: Settings depth (avoid same-color blocks) === */
body.dark #screen-settings .card {
  background: linear-gradient(180deg, #0E1528, #0A1020);
  border-color: rgba(118, 132, 201, 0.4);
}

body.dark #screen-settings .cardInset {
  background: #0B1220;
  border-color: rgba(118, 132, 201, 0.35);
}

body.dark #screen-settings .notes {
  background: #0A0F1C;
  border-color: rgba(118, 132, 201, 0.35);
}

body.dark #screen-settings .fileRow {
  background: #0A0F1C;
  border: 1px solid rgba(118, 132, 201, 0.28);
  padding: 10px 12px;
  border-radius: var(--field-radius);
}

body.dark #screen-settings .tabsCfgRow {
  background: rgba(10, 15, 28, 0.75);
  border: 1px solid rgba(118, 132, 201, 0.22);
  border-radius: var(--field-radius);
  padding: 10px 12px;
  margin: 6px 0;
  border-bottom: none;
}

body.dark #screen-settings .tabsCfgRow:last-child {
  border-bottom: none;
}

body.dark #screen-settings .tabsCfgRow .lbl {
  color: rgba(182, 194, 232, 0.9);
}

body.dark #screen-settings .btn,
body.dark #screen-settings .btn.ghost,
body.dark #screen-settings .iconBtn {
  background: linear-gradient(180deg, #162033, #0F172A);
  border-color: rgba(118, 132, 201, 0.4);
  color: #E6ECFF;
}

/* === Dark theme: reduce block opacity to ~70% (backgrounds only) === */
body.dark {
  --dark-block-alpha: 1;
  --glass-shell-bg: linear-gradient(180deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.03));
  --glass-shell-fill: rgba(9, 12, 22, 0.54);
  --glass-shell-border: rgba(191, 219, 254, 0.18);
  --glass-shell-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.14),
    inset 0 -1px 0 rgba(255, 255, 255, 0.03),
    0 20px 40px rgba(2, 6, 23, 0.34);
  --glass-inner-bg: linear-gradient(180deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.04));
  --glass-inner-fill: rgba(24, 34, 58, 0.58);
  --glass-inner-border: rgba(191, 219, 254, 0.16);
  --glass-inner-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    inset 0 -1px 0 rgba(255, 255, 255, 0.02),
    0 14px 30px rgba(2, 6, 23, 0.26);
}

body.dark .card,
body.dark .modal,
body.dark #screen-settings .card {
  background-color: var(--glass-shell-fill);
  background-image: var(--glass-shell-bg);
  border-color: var(--glass-shell-border);
  box-shadow: var(--glass-shell-shadow);
  backdrop-filter: blur(22px) saturate(165%);
  -webkit-backdrop-filter: blur(22px) saturate(165%);
}

body.dark .cardInset,
body.dark .summary,
body.dark .chartWrap,
body.dark .miniCal,
body.dark .skillWrap,
body.dark .item,
body.dark .notes,
body.dark #screen-settings .cardInset,
body.dark #screen-settings .notes,
body.dark #screen-stats .summary,
body.dark #screen-stats .cardInset,
body.dark #screen-stats .chartWrap {
  background-color: var(--glass-inner-fill);
  background-image: var(--glass-inner-bg);
  border-color: var(--glass-inner-border);
  box-shadow: var(--glass-inner-shadow);
  backdrop-filter: blur(18px) saturate(155%);
  -webkit-backdrop-filter: blur(18px) saturate(155%);
}

/* === Skill map backgrounds: 80% opacity + volume in light theme === */
.skillWrap {
  position: relative;
  background-image: none;
}

.skillWrap::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: var(--skill-bg-overlay-light), var(--skill-bg-image-light);
  background-size: auto, cover;
  background-position: center, center;
  background-repeat: no-repeat, no-repeat;
  opacity: 0.8;
  z-index: 0;
}

body.dark .skillWrap::before {
  background-image: var(--skill-bg-overlay-dark), var(--skill-bg-image-dark);
}

.skillWrap > * {
  position: relative;
  z-index: 1;
}

body:not(.dark) .skillWrap {
  background: var(--ios-glass-shell);
  background-color: rgba(8, 12, 22, 0.42);
  border-color: rgba(191, 219, 254, 0.16);
  box-shadow: var(--ios-glass-shadow);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
}

body.dark .skillWrap {
  background-color: rgba(15, 23, 42, 0.8);
}

body:not(.dark) .ltNode {
  filter: drop-shadow(0 10px 18px rgba(60, 36, 16, 0.25));
}

body:not(.dark) .ltNode:hover {
  filter: drop-shadow(0 16px 26px rgba(60, 36, 16, 0.3));
}

/* === Skill map bubbles: light theme glass === */
body:not(.dark) {
  --map-core: rgba(74, 38, 12, 0.64);
  --map-node: rgba(92, 48, 14, 0.62);
  --map-arrow: rgba(249, 115, 22, 0.58);
}

body:not(.dark) #skillMap .ltNode {
  filter:
    drop-shadow(0 14px 30px rgba(2, 6, 23, 0.3))
    drop-shadow(0 0 14px var(--lt-node-glow, rgba(249, 115, 22, 0.16)));
  transition: none;
}

body:not(.dark) #skillMap .ltLink {
  stroke: rgba(249, 115, 22, 0.34);
  stroke-width: 2;
  filter: drop-shadow(0 0 6px rgba(249, 115, 22, 0.14));
}

body:not(.dark) #skillMap .ltNode:hover {
  transform: none;
  filter:
    drop-shadow(0 18px 36px rgba(2, 6, 23, 0.34))
    drop-shadow(0 0 18px var(--lt-node-glow, rgba(249, 115, 22, 0.2)));
}

body:not(.dark) #skillMap .ltNode:active {
  transform: none;
}

body:not(.dark) #skillMap .ltCore {
  filter: drop-shadow(0 14px 32px rgba(0, 0, 0, 0.16)) drop-shadow(0 0 14px var(--core-glow));
}

body:not(.dark) #skillMap .ltBubble {
  fill: var(--lt-node-fill, rgba(24, 34, 58, 0.56)) !important;
  fill-opacity: 1;
  stroke: var(--lt-node-stroke, rgba(251, 146, 60, 0.18)) !important;
  stroke-width: 1.35;
  stroke-opacity: 1;
  paint-order: stroke fill;
}

body:not(.dark) #skillMap .ltCoreCircle {
  fill: var(--lt-core-fill, rgba(14, 20, 34, 0.58)) !important;
  fill-opacity: 1;
  stroke: var(--lt-core-stroke, rgba(251, 146, 60, 0.24)) !important;
  stroke-width: 1.55;
  stroke-opacity: 1;
  paint-order: stroke fill;
}

body:not(.dark) #skillMap .ltCoreRing {
  display: block;
  stroke: var(--lt-core-ring, rgba(251, 146, 60, 0.42));
}

body:not(.dark) #skillMap .ltLensInner,
body:not(.dark) #skillMap .ltCoreInner,
body:not(.dark) #skillMap .ltLensGloss,
body:not(.dark) #skillMap .ltCoreGloss,
body:not(.dark) #skillMap .ltLensCaustic,
body:not(.dark) #skillMap .ltCoreCaustic {
  display: none;
  pointer-events: none;
}

body:not(.dark) #skillMap .ltLensRim {
  display: none;
  pointer-events: none;
}

body:not(.dark) #skillMap .ltLabel,
body:not(.dark) #skillMap .ltScore,
body:not(.dark) #skillMap .ltCoreTitle,
body:not(.dark) #skillMap .ltCoreScore {
  fill: #F4F8FF;
}

@keyframes ltEnergyFlow {
  from { stroke-dashoffset: 0; }
  to { stroke-dashoffset: -220; }
}

@keyframes ltEnergyFlicker {
  0%, 100% { opacity: 0.7; }
  14% { opacity: 0.96; }
  22% { opacity: 0.6; }
  34% { opacity: 0.98; }
  48% { opacity: 0.76; }
  64% { opacity: 1; }
  78% { opacity: 0.66; }
}

#skillMap .ltLinkFx,
#skillMap .ltBubbleFx,
#skillMap .ltCoreFx {
  fill: none;
  pointer-events: none;
  vector-effect: non-scaling-stroke;
  mix-blend-mode: screen;
  stroke: var(--lt-energy-color, rgba(249, 115, 22, 0.9));
  filter:
    drop-shadow(0 0 4px var(--lt-energy-glow, rgba(249, 115, 22, 0.52)))
    drop-shadow(0 0 12px var(--lt-energy-glow, rgba(249, 115, 22, 0.32)));
  animation:
    ltEnergyFlow var(--lt-energy-speed, 6s) linear infinite,
    ltEnergyFlicker 1.4s steps(2, end) infinite;
  animation-delay: var(--lt-energy-delay, 0s), var(--lt-energy-delay, 0s);
}

#skillMap .ltLinkFx {
  opacity: 0.92;
}

#skillMap .ltBubbleFx,
#skillMap .ltCoreFx {
  opacity: 0.9;
}

/* === Mini calendar header: unified style across themes === */
body:not(.dark) {
  --mini-btn-bg: rgba(233, 209, 181, 0.92);
  --mini-btn-border: rgba(110, 74, 43, 0.42);
  --mini-btn-text: #5A3B24;
  --mini-btn-hover-border: rgba(110, 74, 43, 0.6);
  --mini-btn-shadow: none;
  --mini-btn-hover-shadow: none;
}

body.dark {
  --mini-btn-bg: rgba(11, 18, 32, 0.9);
  --mini-btn-border: rgba(118, 132, 201, 0.45);
  --mini-btn-text: #E6ECFF;
  --mini-btn-hover-border: rgba(118, 132, 201, 0.65);
  --mini-btn-shadow: none;
  --mini-btn-hover-shadow: none;
}

.miniNavBtn,
.miniMonthChip,
.miniTodayChip {
  background: var(--mini-btn-bg);
  border: 1px solid var(--mini-btn-border);
  color: var(--mini-btn-text);
  box-shadow: var(--mini-btn-shadow);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.miniNavBtn:hover,
.miniTodayChip:hover {
  border-color: var(--mini-btn-hover-border);
  box-shadow: var(--mini-btn-hover-shadow);
}

/* === Ninja card === */
.ninjaTitleRow {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
}

.ninjaTitleRow .cardTitle {
  margin: 0;
}

.ninjaWeekNav {
  flex-wrap: nowrap;
  gap: 6px;
  align-items: center;
}

.ninjaRadarSwitch {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.ninjaRadarHeaderMain {
  width: 100%;
}

.ninjaRadarTitleRow {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
}

.ninjaRadarBtn {
  border: 1px solid var(--line);
  background: var(--surface2);
  color: var(--muted);
  height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}

.ninjaRadarBtn.isActive {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.ninjaRadarBtn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.2);
}

.ninjaModeBtn {
  border: 1px solid #e1a26b;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  line-height: 1;
  font-weight: 300;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #8a4c18;
  background: transparent;
  box-shadow: none;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.25);
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.ninjaModeBtn.isCivil {
  background: transparent;
}

.ninjaModeBtn.isShinobi {
  background: transparent;
}

.ninjaModeBtn::before {
  content: '⇄';
  font-size: 12px;
  line-height: 1;
  opacity: 0.85;
}

.ninjaModeBtn:hover {
  background: rgba(225, 162, 107, 0.12);
}

.ninjaModeBtn:active {
  background: rgba(225, 162, 107, 0.18);
}

.ninjaModeBtn:focus-visible {
  outline: 2px solid #f0b37e;
  outline-offset: 2px;
}

body.dark .ninjaModeBtn {
  border-color: #343d60;
  color: #dbe2f5;
  background: transparent;
  text-shadow: none;
}

body.dark .ninjaModeBtn:hover {
  background: rgba(52, 61, 96, 0.18);
}

body.dark .ninjaModeBtn:active {
  background: rgba(52, 61, 96, 0.28);
}

body.dark .ninjaModeBtn:focus-visible {
  outline-color: #343d60;
}

.ninjaWeekLabel {
  min-width: 170px;
}

.ninjaWeekMeta {
  display: grid;
  gap: 4px;
  justify-items: center;
}

.ninjaWeekRange {
  font-size: 12px;
  color: var(--muted);
  line-height: 1;
}

.ninjaWeekRange.isHidden {
  display: none;
}

@media (max-width: 520px) {
  .icon {
    flex-shrink: 0;
  }

  .plannerControls {
    justify-items: stretch;
    max-width: none;
    width: 100%;
    margin: 0;
    box-sizing: border-box;
    padding: 16px;
  }

  .miniCal {
    width: 100%;
    box-sizing: border-box;
    padding: 16px;
  }

  .plannerControls .selectBtn {
    position: relative;
    justify-content: center;
  }

  .plannerControls .selectBtn::after {
    position: absolute;
    right: 12px;
  }

  #screen-ninja-card .ninjaWeekNav {
    width: 100%;
    justify-content: center;
    gap: 6px;
    padding: 8px 10px;
    border-radius: 12px;
    background: var(--surface2);
    border: 1px solid var(--line);
  }

  #screen-ninja-card .ninjaWeekNav .ninjaWeekBtn {
    flex: 0 0 auto;
  }

  #screen-ninja-card .ninjaWeekNav .ninjaWeekMeta {
    flex: 1 1 auto;
    justify-items: center;
  }

  #screen-ninja-card .ninjaTitleRow {
    justify-content: space-between;
  }

  #screen-ninja-card .ninjaTitleRow .ninjaModeBtn {
    flex: 0 0 auto;
  }

  body:not(.dark) #skillMap .ltCoreRing {
    display: none;
  }

  #skillMap .ltLabel,
  #skillMap .ltScore {
    font-size: 24px !important;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.45));
  }

  #skillMap .ltLabel {
    font-size: 36px !important;
  }

  body:not(.dark) #skillMap .ltLabel {
    fill: #ffffff;
    filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.65)) drop-shadow(0 0 2px rgba(0, 0, 0, 0.55));
  }

  #skillMap .ltCoreTitle {
    font-size: 40px !important;
    font-weight: 350 !important;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.45));
  }

  #skillMap .ltCoreScore {
    font-size: 24px !important;
    font-weight: 350 !important;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.45));
  }

  body:not(.dark) #skillMap .ltCoreTitle,
  body:not(.dark) #skillMap .ltCoreScore {
    fill: #ffffff;
    filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.65)) drop-shadow(0 0 2px rgba(0, 0, 0, 0.55));
  }

  body.dark #skillMap .ltLabel,
  body.dark #skillMap .ltScore,
  body.dark #skillMap .ltCoreTitle,
  body.dark #skillMap .ltCoreScore {
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.55));
  }
}

.ninjaSeikaControls {
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.ninjaSeikaControls .field {
  margin: 0;
  min-width: 140px;
}

.ninjaSeikaBeginner {
  margin-bottom: 6px;
}

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

.genderOption {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}

.genderOption input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.genderOption span {
  position: relative;
  padding: 8px 12px 8px 30px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface2);
  font-size: 14px;
  line-height: 1;
  color: var(--text);
}

.genderOption span::before {
  content: "";
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  border-radius: 4px;
  border: 1px solid var(--line);
  background: transparent;
}

.genderOption input:checked + span::before {
  background: var(--primary);
  border-color: var(--primary);
}

.genderOption input:checked + span::after {
  content: "✓";
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 11px;
  color: #fff;
}

.ninjaProfileGrid {
  align-items: start;
  grid-template-columns: 1fr;
}

.ninjaProfileLayout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(200px, 280px);
  grid-template-areas: "info portrait";
  gap: 22px;
  padding: 20px;
  align-items: start;
  align-content: start;
}

.ninjaProfileInfo {
  grid-area: info;
  display: grid;
  gap: 14px;
  min-width: 0;
}

.ninjaProfilePortrait {
  grid-area: portrait;
  display: grid;
  gap: 8px;
  justify-items: center;
  align-self: start;
  width: 100%;
}

.ninjaAvatarWrap {
  position: relative;
  width: 100%;
  max-width: 280px;
}

.ninjaAvatarBtn {
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  width: 100%;
}

.ninjaProfileHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.ninjaProfileNameRow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.ninjaProfileRank {
  padding: 6px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface2);
  font-size: 14px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: 0.3px;
  min-height: 28px;
  display: inline-flex;
  align-items: center;
}

.ninjaOverallRank {
  display: none;
}

.ninjaProfileName {
  font-size: 19px;
  font-weight: 800;
}

.ninjaProfileMeta,
.ninjaProfileExtras {
  display: grid;
  gap: 10px;
  font-size: 15px;
  line-height: 1.45;
  color: var(--muted);
}

.ninjaProfileMeta {
  margin-top: 4px;
}

.ninjaProfileExtras {
  margin-top: 16px;
}

.ninjaProfileForm.isHidden,
.ninjaProfileView.isHidden {
  display: none;
}

.ninjaExtrasList {
  display: grid;
  gap: 12px;
  margin: 10px 0 8px;
}

.ninjaExtras {
  margin-top: 16px;
  margin-bottom: 16px;
}

.ninjaExtraRow {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
}

.ninjaAvatarPreview {
  width: 100%;
  aspect-ratio: 5 / 6;
  height: auto;
  border-radius: 16px;
  border: none;
  background: transparent;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: none;
  position: relative;
}

.ninjaAvatarPreview img {
  width: 100%;
  height: 100%;
  max-width: 280px;
  max-height: none;
  object-fit: cover;
  object-position: center;
  display: block;
  background: transparent;
  border: none;
  box-shadow: none;
}

.ninjaAvatarPreview.isEmpty::after {
  content: "Нет фото";
  font-size: 14px;
  color: var(--muted);
}

.ninjaAvatarHint {
  font-size: 12px;
  color: var(--muted);
  text-align: center;
}

.ninjaAvatarHint--overlay {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 8px;
  text-align: center;
  background: rgba(0, 0, 0, 0.35);
  color: #fff;
  padding: 4px 8px;
  border-radius: 8px;
  pointer-events: none;
}

.ninjaAvatarDelete {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  background: rgba(204, 52, 52, 0.9);
  color: #fff;
  font-size: 18px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  z-index: 2;
}

.ninjaAvatarDelete:hover {
  background: rgba(222, 45, 45, 0.95);
}

.ninjaAvatarDelete:active {
  transform: scale(0.96);
}

.rankImages {
  margin-top: 16px;
  margin-bottom: 16px;
  display: none;
  gap: 10px;
  padding-right: 8px;
}

#ninjaProfileCard.isEdit .rankImages {
  display: grid;
}

.rankImagesToggle {
  justify-content: space-between;
  width: 100%;
  gap: 10px;
}

.rankImagesToggleIcon {
  font-size: 14px;
  transition: transform .2s ease;
}

.rankImagesToggle.isOpen .rankImagesToggleIcon {
  transform: rotate(180deg);
}

.rankImagesBody {
  display: grid;
  gap: 10px;
}

.rankImagesBody.isCollapsed {
  display: none;
}

.rankImageRow {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) 46px auto;
  align-items: center;
  gap: 12px;
  padding: 6px 0;
  border-bottom: 1px dashed rgba(0, 0, 0, 0.08);
}

.rankImageRow .btn {
  width: 100%;
  min-width: 0;
}

.rankImageLabel {
  font-size: 15px;
  color: var(--text);
  font-weight: 700;
}

.rankImagePreview {
  width: 46px;
  aspect-ratio: 5 / 6;
  border-radius: 8px;
  border: 1px solid var(--line);
  background-color: rgba(255, 255, 255, 0.6);
  background-size: cover;
  background-position: center;
  cursor: pointer;
}

.rankImageActions {
  display: inline-flex;
  gap: 8px;
  justify-content: flex-end;
}

.rankImagePick,
.rankImageClear {
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 8px;
  font-size: 16px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: none;
}

body.dark .rankImageRow {
  border-bottom-color: rgba(255, 255, 255, 0.08);
}

.rankImagePreview.isEmpty::after {
  content: "—";
  display: block;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  line-height: 1;
  margin-top: 10px;
}

body.dark .rankImagePreview {
  background-color: rgba(255, 255, 255, 0.06);
}

/* === Auth Overlay === */
.authOverlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 20px;
}

.authOverlay.isHidden {
  display: none;
}

.authCard {
  width: min(420px, 92vw);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 22px;
  display: grid;
  gap: 14px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
}

.authTitle {
  font-size: 20px;
  font-weight: 800;
  color: var(--text);
}

.authTabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.authTab {
  border: 1px solid var(--line);
  background: var(--surface2);
  color: var(--text);
  border-radius: 10px;
  padding: 8px 10px;
  font-weight: 600;
  cursor: pointer;
}

.authTab.isActive {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.authHint {
  font-size: 13px;
  color: var(--muted);
}

.authForm {
  display: grid;
  gap: 12px;
}

.authError {
  min-height: 18px;
  font-size: 13px;
  color: #c62828;
}

.authSubmit {
  width: 100%;
}

.authSettingsRow {
  margin-top: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.authUserLabel {
  font-size: 13px;
  color: var(--muted);
}

body.authLocked {
  overflow: hidden;
}

.ninjaAvatarActions {
  gap: 8px;
  justify-content: center;
}

.ninjaPhotoBtn {
  height: 36px;
  padding: 0 12px;
}

.ninjaProfilePill {
  min-height: 44px;
  padding: 12px 14px;
  border-radius: var(--field-radius);
  background: #FFF4DE;
  border: 1px solid #C59A6A;
  color: var(--text);
  display: flex;
  align-items: center;
  font-size: 15px;
  line-height: 1.2;
}

body.dark .ninjaProfilePill {
  background: var(--ios-glass-btn);
  background-color: rgba(17, 27, 44, 0.32);
  border-color: rgba(191, 219, 254, 0.13);
  color: #EAF1FF;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.14),
    inset 0 -1px 0 rgba(255, 255, 255, 0.03),
    0 8px 22px rgba(2, 6, 23, 0.2);
  backdrop-filter: blur(18px) saturate(165%);
  -webkit-backdrop-filter: blur(18px) saturate(165%);
}

.ninjaEditBtn {
  width: 36px;
  height: 36px;
  min-width: 36px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.ninjaEditBtn svg {
  width: 18px;
  height: 18px;
}

#ninjaProfileCard {
  padding: 0;
}

#ninjaProfileCard:not(.isEdit) .ninjaAvatarActions,
#ninjaProfileCard:not(.isEdit) .ninjaAvatarHint {
  display: none;
}

#ninjaProfileCard:not(.isEdit) .ninjaAvatarBtn {
  pointer-events: none;
}

#ninjaProfileCard:not(.isEdit) .ninjaAvatarDelete {
  display: none !important;
}

.ninjaProfileForm .btn.primary,
#ninjaProfileCard .btn.primary {
  background: var(--primary);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.ninjaProfileForm .btn.primary::after,
#ninjaProfileCard .btn.primary::after {
  display: none;
}

.ninjaProfileForm .grid2 {
  gap: 12px;
}

.ninjaProfileForm > .row {
  margin-top: 16px;
}


.ninjaProfileForm .checkboxRow {
  display: inline-flex;
  align-items: center;
  gap: 0;
}

.ninjaProfileForm .checkboxRow input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.ninjaProfileForm .checkboxRow span {
  margin: 0;
  padding: 8px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface2);
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.2;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}

.ninjaProfileForm .checkboxRow input[type="checkbox"]:checked + span {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.ninjaProfileForm .checkboxRow input[type="checkbox"]:focus-visible + span {
  outline: none;
  box-shadow: 0 0 0 3px rgba(0, 122, 255, .2);
}

.ninjaProfileForm .genderOption span {
  padding: 8px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface2);
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.2;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}

.ninjaProfileForm .genderOption span::before,
.ninjaProfileForm .genderOption span::after {
  display: none;
  content: none;
}

.ninjaProfileForm .genderOption input:checked + span {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.ninjaProfileForm .genderOption input:focus-visible + span {
  outline: none;
  box-shadow: 0 0 0 3px rgba(0, 122, 255, .2);
}

.ninjaProfileForm input,
.ninjaProfileForm select,
.ninjaProfileForm textarea {
  height: 44px;
  font-size: 15px;
  padding: 12px 14px;
}

@media (max-width: 900px) {
  .ninjaProfileLayout {
    grid-template-columns: minmax(0, 1fr) minmax(180px, 240px);
    gap: 16px;
    padding: 16px;
  }
  .ninjaAvatarWrap {
    max-width: 220px;
  }
  .ninjaAvatarPreview img {
    max-width: 220px;
    max-height: none;
  }
}

@media (max-width: 720px) {
  .topbar {
    flex-wrap: wrap;
    gap: 10px;
  }

  .topbarRight {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .brandSubtitle {
    white-space: normal;
  }

  #ninjaProfileCard {
    padding: 12px;
  }

  .ninjaProfileLayout {
    grid-template-columns: 1fr;
    grid-template-areas:
      "portrait"
      "info";
    padding: 12px;
    gap: 14px;
  }
  .ninjaAvatarWrap {
    max-width: min(320px, 88vw);
  }
  .ninjaAvatarPreview img {
    max-width: min(320px, 88vw);
    max-height: none;
  }
  .ninjaProfilePortrait {
    margin-top: 0;
    margin-bottom: 12px;
    align-self: center;
  }

  .tabbar {
    justify-content: flex-start;
    gap: 6px;
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x;
  }

  .tabbar::-webkit-scrollbar {
    display: none;
  }

  .tabBtn {
    flex: 0 0 auto;
    min-width: 72px;
    padding: 8px 6px;
    scroll-snap-align: center;
  }

  .tabIco svg {
    width: 20px;
    height: 20px;
  }

  .tabLbl {
    font-size: 11px;
    white-space: nowrap;
  }
}

.ninjaStatsGrid {
  align-items: stretch;
}

.ninjaStatsCol {
  display: grid;
  gap: 16px;
  align-content: space-between;
  height: 100%;
}

.radarWrap {
  display: flex;
  justify-content: center;
  padding: 10px 0;
}

.ninjaStatList {
  display: grid;
  gap: 6px;
  font-size: 14px;
  color: var(--muted);
}

.ninjaStatRow {
  display: grid;
  gap: 6px;
}

.ninjaStatMain {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 6px 8px;
  border-radius: 10px;
  border: 1px solid transparent;
  cursor: pointer;
}

.ninjaStatMain:hover {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.25);
}

.ninjaStatRow .statKey {
  font-weight: 800;
  letter-spacing: 0.02em;
}

.ninjaStatRow .statValue {
  color: var(--text);
  font-weight: 600;
}

.ninjaStatDetails {
  font-size: 12px;
  color: var(--muted);
  padding: 0 8px 6px 8px;
}

.ninjaStatDetails.isHidden {
  display: none;
}

.ninTestsGrid {
  display: grid;
  gap: 12px;
}

.ninTestCard {
  padding: 12px;
  border-radius: 12px;
  background: var(--surface2);
  border: 1px solid var(--line);
  display: grid;
  gap: 8px;
}

.ninTestCard .subTitle {
  margin-bottom: 4px;
}

.ninTestCard .cardHint {
  margin-top: 2px;
}

.modal:has(.ninTestsGrid) .btn,
.modal:has(.ninTestsGrid) .btn.primary,
.modal:has(.ninTestsGrid) .btn.ghost {
  text-shadow: none;
  box-shadow: none;
  background: #f7e5c8;
  border-color: var(--line);
  color: var(--text);
}

.modal:has(.ninTestsGrid) .btn.primary {
  background: #f7e5c8;
}

.modal:has(.ninTestsGrid) .btn.primary::after {
  content: none;
}

.modal:has(.ninTestsGrid) {
  height: auto;
  max-height: 92vh;
}

.modal:has(.ninTestsGrid) .modalBody {
  overflow: visible;
}

body.dark .modal:has(.ninTestsGrid) .btn,
body.dark .modal:has(.ninTestsGrid) .btn.primary,
body.dark .modal:has(.ninTestsGrid) .btn.ghost {
  background: rgba(28, 28, 35, 0.6);
  border-color: rgba(255, 255, 255, 0.12);
  color: var(--text);
}

.modal:has(.physics-modal) .modalHeader {
  padding: 18px 20px 12px;
  align-items: flex-start;
}

.modal:has(.physics-modal) .modalTitle {
  font-size: 17px;
}

.modal:has(.physics-modal) .modalHint {
  margin-top: 6px;
  font-size: 14px;
  line-height: 1.4;
}

.modal:has(.physics-modal) .modalHeader .iconBtn {
  align-self: flex-start;
}

.modal:has(.physics-modal) .modalBody {
  padding: 20px;
}

.modalBody .physics-modal {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.modalBody .physics-modal .subTitle {
  margin: 0;
  font-size: 16px;
}

.modalBody .physics-modal .field {
  margin: 0;
}

.modalBody .physics-modal .field > span {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
}

.modalBody .physics-modal input[type="text"],
.modalBody .physics-modal input[type="number"],
.modalBody .physics-modal select,
.modalBody .physics-modal .fieldValue {
  height: 46px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--card);
  padding: 0 12px;
  font-size: 15px;
}

.modalBody .physics-modal .fieldValue {
  display: flex;
  align-items: center;
  color: var(--text);
}

.modalBody .physics-modal input[type="text"]:focus,
.modalBody .physics-modal input[type="number"]:focus,
.modalBody .physics-modal select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 122, 255, .15);
}

.modalBody .physics-modal .checkboxRow {
  display: grid;
  grid-template-columns: 20px 1fr;
  align-items: center;
  gap: 10px;
}

.modalBody .physics-modal .checkboxRow input[type="checkbox"] {
  width: 20px;
  height: 20px;
  margin: 0;
  align-self: center;
  display: inline-grid;
  place-content: center;
}

.modalBody .physics-modal .checkboxRow input[type="checkbox"]::before {
  width: 9px;
  height: 5px;
  margin: 0;
  transform: translateY(-1px) rotate(-45deg);
  transform-origin: center;
}

.modalBody .physics-modal .checkboxRow span {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}

.modalBody .physics-modal #taiStepsBlock {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface2);
}

.modalBody .physics-modal #taiStepsBlock .cardHint {
  margin-top: 2px;
}

.modalBody .physics-modal .cardHint {
  font-size: 13px;
  line-height: 1.4;
  color: var(--muted);
}

.modalBody .physics-modal .row {
  margin-top: 4px;
}

@media (max-width: 520px) {
  .modal:has(.physics-modal) .modalBody {
    padding: 18px;
  }
}

.ninScoreBadge {
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--glass2);
  border: 1px solid var(--line);
  font-weight: 700;
  font-size: 13px;
}

.ninScoreValue {
  font-weight: 900;
  font-size: 28px;
  line-height: 1.1;
  letter-spacing: 0.02em;
  color: var(--text);
  min-width: 44px;
  text-align: right;
  margin-left: auto;
}

.ninSeq {
  font-size: 22px;
  letter-spacing: 2px;
  font-weight: 800;
  text-align: center;
  margin: 8px 0;
}

.ninTimer {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

.ninTimer.isOver {
  color: var(--red);
  font-weight: 800;
}

.ninGrid {
  display: grid;
  grid-template-columns: repeat(5, 32px);
  gap: 8px;
  justify-content: center;
  margin: 10px 0;
}

.ninCell {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface3);
  cursor: pointer;
}

.ninCell.isTarget {
  background: var(--primary);
  box-shadow: 0 0 0 2px rgba(255, 237, 213, 0.35);
}

.ninCell.isSelected {
  background: var(--blue);
}

.ninQuestions {
  display: grid;
  gap: 12px;
}

.ninQuestion {
  display: grid;
  gap: 6px;
}

.ninChoices {
  display: grid;
  gap: 6px;
}

.ninChoice {
  display: inline-flex;
  gap: 8px;
  align-items: center;
}

.missionGrid {
  display: grid;
  gap: 8px;
  font-size: 16px;
}

.missionRow {
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 8px;
  align-items: center;
}

.missionRank {
  font-weight: 800;
}

.missionCount {
  text-align: right;
  font-weight: 600;
}

.missionInfoRow {
  margin-top: 9px;
}

.checkboxRow {
  display: flex;
  align-items: center;
  gap: 10px;
}

.checkboxRow span {
  margin: 0;
  display: inline-block;
  line-height: 1.25;
  color: var(--text);
}

.checkboxRow input[type="checkbox"] {
  appearance: none;
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  margin: 0;
  border-radius: 5px;
  border: 1.5px solid var(--line);
  background: var(--card);
  display: inline-grid;
  place-content: center;
  transition: background .15s ease, border-color .15s ease, box-shadow .15s ease;
}

.checkboxRow input[type="checkbox"]::before {
  content: "";
  width: 9px;
  height: 5px;
  border-left: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(-45deg);
  opacity: 0;
  transition: opacity .15s ease;
}

.checkboxRow input[type="checkbox"]:checked {
  background: var(--primary);
  border-color: var(--primary);
}

.checkboxRow input[type="checkbox"]:checked::before {
  opacity: 1;
}

.checkboxRow input[type="checkbox"]:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(0, 122, 255, .2);
}

.weekAssignModal {
  display: grid;
  gap: 12px;
}

.weekAssignList {
  display: grid;
  gap: 10px;
}

.weekAssignRow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface2);
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}

.weekAssignRow:hover {
  border-color: rgba(249, 115, 22, 0.35);
}

.weekAssignRow.isSelected {
  border-color: rgba(249, 115, 22, 0.45);
  box-shadow: inset 0 0 0 1px rgba(249, 115, 22, 0.12);
}

.weekAssignRow.isReference {
  border-color: rgba(249, 115, 22, 0.45);
  box-shadow: inset 0 0 0 1px rgba(249, 115, 22, 0.12);
}

.weekAssignMeta {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.weekAssignName {
  font-size: 15px;
  font-weight: 700;
}

.weekAssignDate {
  font-size: 13px;
  color: var(--muted);
}

.weekAssignControls {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.weekAssignCount {
  min-width: 34px;
  height: 34px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  font-size: 14px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.missionDateRow {
  gap: 8px;
  align-items: center;
}

.missionDateRow .missionDateInput {
  flex: 1;
}

.ninjaInputsCard.isCollapsed .ninjaInputsBody {
  display: none;
}

.ninjaInputsCard {
  background: transparent;
  border: none;
  border-left: none;
  box-shadow: none;
}

.ninjaInputsCard::before,
.ninjaInputsCard::after {
  display: none;
  content: none;
}

.ninjaInputsCard.ninjaInputsFlat {
  background: transparent;
  border: none;
  border-left: none;
  box-shadow: none;
  padding: 0;
}

.ninjaInputsCard.ninjaInputsFlat .cardHeader {
  display: none;
}

.ninjaInputsCard.ninjaInputsFlat .ninjaInputsBody {
  padding: 0;
}

.ninjaInputsCard.ninjaInputsFlat::before,
.ninjaInputsCard.ninjaInputsFlat::after {
  display: none;
  content: none;
}


.miniStatLine {
  font-size: 13px;
  color: var(--muted);
  margin: 4px 0;
}

.ninjaOverride.isHidden {
  display: none;
}
@media (max-width: 520px) {
  #quickList .actions {
    display: grid;
    grid-template-columns: repeat(2, 40px);
    justify-content: end;
    align-content: start;
  }

  #quickList .actions > :last-child:nth-child(odd) {
    grid-column: 2;
  }

  .cardHeaderActions {
    width: 100%;
    margin-left: 0;
  }

  .skillWrap,
  #skillMap {
    touch-action: none;
    overscroll-behavior: contain;
  }

  body:not(.dark) .skillWrap::after {
    content: none;
    display: none;
  }
}

/* Day pool: max 3 tasks per block (1 main + 2 compact). */
.dayPoolBlock {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(98px, 112px);
  gap: 10px;
  align-items: stretch;
}

.dayPoolBlock.isSingle {
  grid-template-columns: minmax(0, 1fr);
}

.dayPoolSide {
  display: grid;
  grid-template-rows: 1fr 1fr;
  gap: 10px;
}

.dayPoolSide.isSingle {
  grid-template-rows: 1fr;
}

.dayPoolItem {
  height: 100%;
}

.dayPoolItem::after {
  content: none;
  display: none;
}

.dayPoolItem.isCompact {
  padding: 18px 8px 10px;
  min-height: 88px;
  justify-content: flex-start;
  align-items: flex-start;
}

.dayPoolItem.isCompact::before {
  display: none;
}

.dayPoolItem.isCompact .meta {
  display: none;
}

.dayPoolItem.isCompact .actions {
  width: 100%;
  justify-content: center;
  margin-top: 2px;
}

.tabbar::before {
  content: none;
  display: none;
}
