:root {
  --bg: #1e1f22;
  --bg-elevated: #2b2d31;
  --bg-input: #1e1f22;
  --bg-hover: #35373c;
  --border: #3f4147;
  --text: #f2f3f5;
  --text-muted: #b5bac1;
  --accent: #23a559;
  --accent-hover: #1e8f4c;
  --success: #23a559;
  --danger: #f23f43;
  --focus: #5865f2;
  --maroon: #6b1e2a;
  --maroon-soft: rgba(107, 30, 42, 0.35);
  --radius: 10px;
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
  color-scheme: dark;
  font-family: "Sora", "Segoe UI", sans-serif;
}

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

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(ellipse 80% 50% at 10% -10%, var(--maroon-soft), transparent),
    radial-gradient(ellipse 60% 40% at 100% 0%, rgba(88, 101, 242, 0.12), transparent),
    var(--bg);
  color: var(--text);
}

body {
  line-height: 1.45;
}

.sitelock-badge {
  position: fixed;
  top: 10px;
  right: 12px;
  z-index: 20;
  display: inline-flex;
  line-height: 0;
}

.sitelock-seal {
  display: block;
  width: auto;
  height: 48px;
  max-width: 100%;
}

.app {
  max-width: 1400px;
  margin: 0 auto;
  padding: 28px 20px 48px;
}

.header {
  margin-bottom: 24px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: end;
  gap: 18px;
}

.brand {
  min-width: 0;
}

.brand-mark {
  margin: 0 0 6px;
  color: #e8b4bc;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.brand h1 {
  margin: 0;
  font-size: clamp(1.85rem, 3vw, 2.45rem);
  font-weight: 700;
  letter-spacing: -0.03em;
}

.quick-copy-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-self: center;
  gap: 6px;
}

.minimized-timers {
  display: flex;
  max-width: 100%;
  flex-wrap: wrap;
  justify-content: flex-start;
  align-items: stretch;
  gap: 6px;
}

.minimized-timer {
  display: grid;
  min-width: 112px;
  max-width: 170px;
  gap: 2px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  background: var(--bg-elevated);
  color: #4aa3ff;
  text-align: left;
  cursor: pointer;
  box-shadow: var(--shadow);
}

.minimized-timer:hover {
  border-color: var(--focus);
  background: var(--bg-hover);
}

.minimized-timer-label {
  overflow: hidden;
  color: var(--text-muted);
  font-size: 0.65rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.minimized-timer-time {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.84rem;
  font-weight: 700;
}

.minimized-timer.finished .minimized-timer-time {
  color: var(--success);
}

.minimized-timer.ringing {
  border-color: var(--danger);
  background: rgba(242, 63, 67, 0.12);
  color: var(--danger);
  animation: bell-pulse 1.2s ease-in-out infinite;
}

.minimized-timer.ringing .minimized-timer-label,
.minimized-timer.ringing .minimized-timer-time {
  color: var(--danger);
}

.minimized-bell-stop {
  animation: bell-pulse 1.2s ease-in-out infinite;
}

@keyframes bell-pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.55;
  }
}

.minimized-bell-stop {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 42px;
  border: 1px solid var(--danger);
  border-radius: 8px;
  padding: 6px 12px;
  background: rgba(242, 63, 67, 0.08);
  color: var(--danger);
  font: inherit;
  font-size: 0.74rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow);
}

.minimized-bell-stop:hover {
  background: rgba(242, 63, 67, 0.16);
}

.minimized-bell-stop svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
}

.quick-copy {
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: center;
  padding: 4px;
  gap: 4px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-elevated);
  box-shadow: var(--shadow);
}

.quick-copy-hint {
  max-width: 260px;
  color: var(--text-muted);
  font-size: 0.75rem;
  text-align: center;
}

.quick-copy-btn {
  border: none;
  padding: 10px 16px;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition:
    background 0.15s ease,
    color 0.15s ease;
}

.quick-copy-btn:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.store-switch {
  display: inline-flex;
  padding: 4px;
  gap: 4px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-elevated);
  box-shadow: var(--shadow);
}

.store-btn {
  border: none;
  padding: 10px 16px;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition:
    background 0.15s ease,
    color 0.15s ease;
}

.store-btn:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.store-btn.active {
  background: var(--accent);
  color: #fff;
}

.store-btn.active:hover {
  background: var(--accent-hover);
  color: #fff;
}

.store-btn.is-tab-locked:not(.active) {
  color: #fbbf24;
}

.store-btn.is-tab-locked:not(.active)::after {
  content: " \1F512";
  font-size: 0.72em;
  opacity: 0.85;
}

.panel {
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  box-shadow: var(--shadow);
}

.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 0 14px;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--maroon);
  color: #ffd7dc;
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  vertical-align: middle;
}

.btn {
  border: none;
  padding: 12px 14px;
  border-radius: 8px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition:
    background 0.15s ease,
    transform 0.1s ease;
}

.btn:active {
  transform: translateY(1px);
}

.btn.primary {
  background: var(--accent);
  color: #fff;
}

.btn.primary:hover {
  background: var(--accent-hover);
}

.btn.ghost {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
}

.btn.ghost:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.intro-panel {
  margin-bottom: 0;
}

.family-access-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  align-items: center;
  gap: 10px;
  margin: 22px 0;
}

.family-placeholder {
  cursor: default;
  opacity: 0.72;
}

.family-placeholder:hover {
  background: transparent;
  color: var(--text-muted);
}

.notes-panel {
  margin-bottom: 18px;
  padding: 18px;
}

.notes-panel .panel-title {
  margin-bottom: 12px;
}

.notes-panel .notes-board-body {
  max-height: none;
  overflow: visible;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #121419;
}

.intro-panel p {
  max-width: 74ch;
  margin: 0;
  color: var(--text-muted);
  font-size: 0.92rem;
}

.intro-panel .welcome-contact {
  margin-top: 12px;
}

.intro-panel .welcome-contact strong {
  color: var(--text);
  font-family: "JetBrains Mono", monospace;
  font-weight: 600;
}

.tools-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
  align-items: stretch;
}

.feature-strip {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  min-height: 260px;
  padding: 0;
  overflow: hidden;
}

.feature-section {
  display: flex;
  flex-direction: column;
  min-height: 260px;
  padding: 16px 18px;
  overflow-y: auto;
  border-right: 1px solid var(--border);
}

.feature-section:last-child {
  border-right: none;
}

.feature-section-title {
  margin: 0 0 14px;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-align: center;
  text-transform: uppercase;
}

.action-command-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.action-command-list li {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
}

.action-command-list code {
  color: #e8b4bc;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
}

.action-command-list.price-list li {
  grid-template-columns: minmax(0, 1fr) auto auto;
}

.action-command-list.price-list code {
  overflow: hidden;
  text-overflow: ellipsis;
}

.action-command-list span {
  color: var(--text-muted);
  font-size: 0.82rem;
}

.action-copy-btn {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 0;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition:
    background 0.15s ease,
    color 0.15s ease,
    border-color 0.15s ease;
}

.action-copy-btn svg {
  width: 15px;
  height: 15px;
  fill: currentColor;
}

.action-copy-btn:hover {
  border-color: var(--border);
  background: var(--bg-hover);
  color: var(--text);
}

.action-copy-btn.copied {
  border-color: rgba(35, 165, 89, 0.45);
  color: var(--accent);
}

.status {
  min-height: 1.25em;
  margin: 14px 0 0;
  color: var(--accent);
  font-size: 0.88rem;
}

.status.error {
  color: var(--danger);
}

.page-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.75rem;
}

.extra-tool-window {
  position: fixed;
  z-index: 80;
  top: 90px;
  left: 50%;
  width: min(430px, calc(100vw - 24px));
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #16181d;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.55);
  transform: translateX(-50%);
}

.extra-tool-window.map-viewer {
  width: min(900px, calc(100vw - 24px));
}

.extra-tool-window.calculator-window {
  width: min(320px, calc(100vw - 24px));
}

.extra-tool-window.trade-prices-window {
  width: min(680px, calc(100vw - 24px));
}

.extra-tool-window.notes-board-window,
.extra-tool-window.photo-dump-window {
  width: min(760px, calc(100vw - 24px));
}

.extra-tool-window.contacts-window,
.extra-tool-window.debts-window {
  width: min(320px, calc(100vw - 24px));
}

.extra-tool-window.rules-tool-window {
  width: min(720px, calc(100vw - 24px));
}

.extra-tool-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 13px;
  border-bottom: 1px solid var(--border);
  background: #1f2228;
  cursor: move;
  user-select: none;
  touch-action: none;
}

.extra-tool-header strong {
  color: #4aa3ff;
  font-size: 0.86rem;
}

.extra-tool-header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.extra-tool-close,
.extra-tool-minimize {
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 5px;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  cursor: pointer;
}

.extra-tool-close:hover {
  color: var(--danger);
}

.extra-tool-minimize:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.extra-tool-body {
  padding: 16px;
  max-height: calc(100vh - 170px);
  overflow-y: auto;
}

.calculator-body {
  overflow: hidden;
}

.calculator-display {
  width: 100%;
  margin-bottom: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #111214;
  color: var(--text);
  font-family: "JetBrains Mono", monospace;
  font-size: 1.6rem;
  font-weight: 700;
  text-align: right;
}

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

.calculator button {
  min-height: 46px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-input);
  color: var(--text);
  font: inherit;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
}

.calculator button:hover {
  border-color: var(--focus);
  background: var(--bg-hover);
}

.calculator button.operator {
  color: #4aa3ff;
}

.calculator button.utility {
  color: var(--text-muted);
}

.calculator button.equals {
  background: var(--accent);
  color: #fff;
}

.calculator button.zero {
  grid-column: span 2;
}

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

.trade-price-section {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
}

.trade-price-section h3 {
  min-height: 2.4em;
  margin: 0 0 8px;
  color: #4aa3ff;
  font-size: 0.72rem;
  line-height: 1.2;
}

.trade-price-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  padding: 5px 3px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 0.74rem;
}

.trade-price-row strong {
  color: var(--text);
}

.trade-price-row span {
  color: var(--text-muted);
  font-family: "JetBrains Mono", monospace;
  text-align: right;
}

.notes-board-body,
.photo-dump-body,
.rules-tool-body {
  max-height: calc(100vh - 150px);
  overflow-y: auto;
  background: #121419;
}

.contacts-body {
  position: relative;
  min-height: min(480px, calc(100vh - 190px));
  max-height: calc(100vh - 150px);
  overflow-y: auto;
  padding: 12px;
  background: var(--bg);
}

.contacts-toolbar {
  position: sticky;
  z-index: 2;
  top: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 38px;
  gap: 8px;
  padding-bottom: 10px;
  background: var(--bg);
}

.contacts-toolbar input,
.contact-editor input,
.contact-editor textarea {
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
  outline: none;
  background: var(--bg-input);
  color: var(--text);
  font: inherit;
}

.contacts-toolbar input:focus,
.contact-editor input:focus,
.contact-editor textarea:focus {
  border-color: var(--focus);
  box-shadow: 0 0 0 2px rgba(88, 101, 242, 0.18);
}

.contacts-add {
  border: 1px solid var(--focus);
  border-radius: 7px;
  background: rgba(88, 101, 242, 0.16);
  color: var(--text);
  font-size: 1.25rem;
  font-weight: 700;
  cursor: pointer;
}

.contacts-list {
  display: grid;
  gap: 8px;
}

.contact-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 10px;
  padding: 10px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-input);
}

.contact-card > div:first-child {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.contact-card strong,
.contact-card span,
.contact-card small {
  overflow-wrap: anywhere;
}

.contact-card span {
  color: var(--text);
  font-family: "JetBrains Mono", monospace;
  font-size: 0.78rem;
}

.contact-card small,
.contacts-empty {
  color: var(--text-muted);
  font-size: 0.7rem;
  line-height: 1.4;
}

.contact-card-actions {
  display: flex;
  gap: 4px;
}

.contact-card-actions button,
.contact-editor-actions button {
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text-muted);
  font: inherit;
  font-size: 0.68rem;
  cursor: pointer;
}

.contact-card-actions .remove:hover {
  color: var(--danger);
}

.contacts-empty {
  margin: 28px 0;
  text-align: center;
}

.contact-editor-backdrop {
  position: absolute;
  z-index: 4;
  inset: 0;
  display: grid;
  place-items: start center;
  min-height: 100%;
  padding: 16px;
  background: rgba(10, 11, 15, 0.76);
  backdrop-filter: blur(2px);
}

.contact-editor {
  display: grid;
  gap: 10px;
  width: min(340px, 100%);
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-elevated);
  box-shadow: var(--shadow);
}

.contact-editor h3 {
  margin: 0 0 2px;
  font-size: 0.9rem;
}

.contact-editor label {
  display: grid;
  gap: 5px;
  color: var(--text-muted);
  font-size: 0.7rem;
}

.contact-editor textarea {
  min-height: 70px;
  resize: vertical;
}

.contact-editor-actions {
  display: flex;
  justify-content: flex-end;
  gap: 7px;
}

.contact-editor-actions .primary {
  border-color: var(--focus);
  background: rgba(88, 101, 242, 0.18);
  color: var(--text);
}

.debts-body {
  position: relative;
  min-height: min(480px, calc(100vh - 190px));
  max-height: calc(100vh - 150px);
  overflow-y: auto;
  padding: 12px;
  background: var(--bg);
}

.debts-toolbar {
  position: sticky;
  z-index: 2;
  top: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 38px;
  gap: 8px;
  padding-bottom: 10px;
  background: var(--bg);
}

.debts-toolbar input,
.debt-editor input {
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
  outline: none;
  background: var(--bg-input);
  color: var(--text);
  font: inherit;
}

.debts-toolbar input:focus,
.debt-editor input:focus {
  border-color: var(--focus);
  box-shadow: 0 0 0 2px rgba(88, 101, 242, 0.18);
}

.debts-add {
  border: 1px solid var(--focus);
  border-radius: 7px;
  background: rgba(88, 101, 242, 0.16);
  color: var(--text);
  font-size: 1.25rem;
  font-weight: 700;
  cursor: pointer;
}

.debts-list {
  display: grid;
  gap: 8px;
}

.debt-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 10px;
  padding: 10px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-input);
}

.debt-card.due-soon {
  border-color: #f59e0b;
  box-shadow: 0 0 0 1px rgba(245, 158, 11, 0.45);
}

.debt-card.overdue {
  border-color: #ef4444;
  box-shadow: 0 0 0 1px rgba(239, 68, 68, 0.45);
}

.debt-card.settled {
  opacity: 0.72;
}

.debt-card > div:first-child {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.debt-card strong,
.debt-card span,
.debt-card small {
  overflow-wrap: anywhere;
}

.debt-card span {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.78rem;
}

.debt-card small,
.debts-empty,
.debt-pay-summary {
  color: var(--text-muted);
  font-size: 0.7rem;
  line-height: 1.4;
}

.debt-card .debt-balance {
  color: var(--text);
  font-weight: 600;
}

.debt-card.due-soon .debt-due {
  color: #fbbf24;
}

.debt-card.overdue .debt-due {
  color: #f87171;
}

.debt-card-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 4px;
}

.debt-card-actions button,
.debt-editor-actions button {
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text-muted);
  font: inherit;
  font-size: 0.68rem;
  cursor: pointer;
}

.debt-card-actions .pay {
  border-color: rgba(74, 222, 128, 0.45);
  color: #86efac;
  font-weight: 700;
}

.debt-card-actions .pay:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.debt-card-actions .remove:hover {
  color: var(--danger);
}

.debts-empty {
  margin: 28px 0;
  text-align: center;
}

.debt-editor-backdrop {
  position: absolute;
  z-index: 4;
  inset: 0;
  display: grid;
  place-items: start center;
  min-height: 100%;
  padding: 16px;
  background: rgba(10, 11, 15, 0.76);
  backdrop-filter: blur(2px);
}

.debt-editor {
  display: grid;
  gap: 10px;
  width: min(340px, 100%);
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-elevated);
  box-shadow: var(--shadow);
}

.debt-editor h3 {
  margin: 0 0 2px;
  font-size: 0.9rem;
}

.debt-editor label {
  display: grid;
  gap: 5px;
  color: var(--text-muted);
  font-size: 0.7rem;
}

.debt-due-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.debt-pay-summary {
  margin: 0;
}

.debt-editor-actions {
  display: flex;
  justify-content: flex-end;
  gap: 7px;
}

.debt-editor-actions .primary {
  border-color: var(--focus);
  background: rgba(88, 101, 242, 0.18);
  color: var(--text);
}

.debt-editor-actions .primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.rules-tool-body {
  display: grid;
  gap: 12px;
}

.notes-board-toolbar,
.photo-dump-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.notes-board-toolbar span,
.photo-dump-toolbar span {
  color: var(--text-muted);
  font-size: 0.74rem;
}

.notes-add {
  width: 34px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: #5865f2;
  color: #fff;
  font: inherit;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}

.notes-add:hover {
  background: #6c78f5;
}

.notes-grid,
.photo-dump-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  align-items: start;
  gap: 14px;
}

.post-it-note {
  display: grid;
  min-width: 0;
  aspect-ratio: 1;
  grid-template-rows: auto auto minmax(0, 1fr);
  padding: 10px;
  border-radius: 3px 3px 10px 3px;
  background: #f8e58b;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.28);
  color: #22242a;
}

.post-it-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 5px;
}

.post-it-header input,
.post-it-note textarea {
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  color: inherit;
  caret-color: #22242a;
  font: inherit;
}

.post-it-header input {
  padding: 3px 2px 6px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.15);
  font-size: 0.78rem;
  font-weight: 700;
}

.post-it-note textarea {
  width: 100%;
  height: 100%;
  padding: 8px 2px 2px;
  resize: none;
  font-size: 0.74rem;
  line-height: 1.35;
}

.post-it-note textarea:focus {
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.28);
}

.post-it-header input::placeholder,
.post-it-note textarea::placeholder {
  color: rgba(34, 36, 42, 0.52);
}

.post-it-remove {
  align-self: start;
  border: none;
  background: transparent;
  color: rgba(34, 36, 42, 0.55);
  font: inherit;
  cursor: pointer;
}

.post-it-remove:hover {
  color: #a12b38;
}

.post-it-swatches {
  display: flex;
  gap: 5px;
  padding: 6px 0 2px;
}

.post-it-swatch {
  width: 16px;
  height: 16px;
  border: 1px solid rgba(34, 36, 42, 0.28);
  border-radius: 50%;
  padding: 0;
  cursor: pointer;
}

.post-it-swatch.active {
  border-color: #22242a;
  box-shadow: 0 0 0 2px rgba(34, 36, 42, 0.35);
}

.notes-empty,
.photo-dump-empty,
.rules-empty {
  grid-column: 1 / -1;
  margin: 30px 0;
  color: var(--text-muted);
  font-size: 0.78rem;
  text-align: center;
}

.photo-dump-upload {
  flex: 0 0 auto;
  padding: 7px 11px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #5865f2;
  color: #fff;
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
}

.photo-dump-upload input {
  display: none;
}

.photo-dump-card {
  display: grid;
  min-width: 0;
  aspect-ratio: 1;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
  padding: 9px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #202329;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.28);
}

.photo-dump-card-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
  padding-bottom: 7px;
}

.photo-dump-card-header input {
  min-width: 0;
  border: none;
  border-bottom: 1px solid var(--border);
  outline: none;
  padding: 3px 2px 5px;
  background: transparent;
  color: var(--text);
  caret-color: #fff;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 700;
}

.photo-dump-card-header input:focus {
  border-bottom-color: var(--focus);
}

.photo-dump-remove {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  cursor: pointer;
}

.photo-dump-remove:hover {
  color: var(--danger);
}

.photo-dump-card img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  border-radius: 5px;
  background: #0d0f12;
  object-fit: cover;
  cursor: zoom-in;
}

.rules-search-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.rules-search-form input,
.shipment-timer-fields input {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 7px;
  outline: none;
  padding: 10px 11px;
  background: var(--bg-input);
  color: var(--text);
  caret-color: #fff;
  font: inherit;
}

.rules-search-form input:focus,
.shipment-timer-fields input:focus {
  border-color: var(--focus);
  box-shadow: 0 0 0 2px rgba(88, 101, 242, 0.2);
}

.rules-search-form button {
  border: 1px solid #6875ef;
  border-radius: 7px;
  padding: 9px 12px;
  background: #5865f2;
  color: #fff;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}

.rules-search-note {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.74rem;
}

.rules-topic-links {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.rules-topic-links button {
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 9px 10px;
  background: var(--bg-input);
  color: var(--text);
  font: inherit;
  font-size: 0.76rem;
  text-align: left;
  cursor: pointer;
}

.rules-topic-links button:hover {
  border-color: var(--focus);
  background: var(--bg-hover);
}

.rules-topic-links button.active {
  border-color: #6875ef;
  background: rgba(88, 101, 242, 0.18);
  color: #c9ceff;
}

.rules-results-summary {
  min-height: 1em;
  margin: 0;
  color: #aeb5ff;
  font-size: 0.74rem;
}

.rules-results {
  display: grid;
  gap: 9px;
}

.rules-result {
  padding: 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #1b1e24;
}

.rules-result-heading {
  display: grid;
  gap: 2px;
  margin-bottom: 7px;
}

.rules-result-heading strong {
  color: #7fb9ff;
  font-size: 0.76rem;
}

.rules-result-heading span {
  color: var(--text-muted);
  font-size: 0.7rem;
}

.rules-result p {
  margin: 0;
  color: var(--text);
  font-size: 0.78rem;
  line-height: 1.5;
}

.rules-result mark {
  border-radius: 2px;
  padding: 0 2px;
  background: #f0d56b;
  color: #17191e;
}

.rules-result a {
  display: inline-block;
  margin-top: 8px;
  color: #aeb5ff;
  font-size: 0.68rem;
  text-decoration: none;
}

.rules-result a:hover {
  text-decoration: underline;
}

.shipment-timer-list {
  display: grid;
  gap: 6px;
}

.shipment-timer-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--bg);
}

.shipment-timer-row strong {
  min-width: 0;
  overflow: hidden;
  font-size: 0.78rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shipment-timer-row-time {
  color: #4aa3ff;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.83rem;
  font-weight: 700;
}

.shipment-timer-row.finished .shipment-timer-row-time {
  color: var(--success);
}

.shipment-timer-remove {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.68rem;
  cursor: pointer;
}

.shipment-timer-remove:hover {
  color: var(--danger);
}

.shipment-timer-empty,
.shipment-timer-count {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.72rem;
}

.shipment-timer-empty {
  padding: 12px;
  text-align: center;
}

.shipment-timer-count {
  margin: 8px 0;
  text-align: right;
}

.shipment-timer-form {
  display: grid;
  gap: 7px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.shipment-timer-fields {
  display: grid;
  grid-template-columns: minmax(90px, 1fr) minmax(52px, 64px) minmax(52px, 64px) auto;
  gap: 6px;
}

.shipment-timer-presets {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 5px;
}

.shipment-timer-presets button,
.shipment-timer-start,
.shipment-bell-stop {
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-input);
  color: var(--text);
  font: inherit;
  font-size: 0.76rem;
  cursor: pointer;
}

.shipment-timer-presets button {
  padding: 8px 3px;
}

.shipment-timer-presets button:hover,
.shipment-timer-start:hover {
  border-color: var(--focus);
  background: var(--bg-hover);
}

.shipment-timer-start {
  padding: 8px 15px;
}

.shipment-timer-start:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.shipment-bell-stop {
  display: block;
  margin: 12px auto 0;
  padding: 8px 14px;
  border-color: var(--danger);
  color: var(--danger);
}

.photo-window {
  position: fixed;
  z-index: 90;
  top: 90px;
  right: 24px;
  width: min(680px, calc(100vw - 24px));
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #16181d;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.55);
}

.photo-window-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 13px;
  border-bottom: 1px solid var(--border);
  background: #1f2228;
  user-select: none;
}

.photo-window-header strong {
  color: #4aa3ff;
  font-size: 0.86rem;
}

.photo-window img {
  display: block;
  width: 100%;
  max-height: calc(100vh - 200px);
  background: #0d0f12;
  object-fit: contain;
}

.hidden {
  display: none !important;
}

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

@media (max-width: 680px) {
  .tools-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .feature-strip {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .feature-section {
    min-height: 120px;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .feature-section:last-child {
    border-bottom: none;
  }
}

@media (max-width: 860px) {
  .header {
    grid-template-columns: 1fr;
    justify-items: start;
  }

  .quick-copy-wrap {
    justify-self: start;
  }

  .quick-copy-wrap {
    align-items: flex-start;
  }

  .quick-copy-hint {
    text-align: left;
  }
}

@media (max-width: 720px) {
  .trade-prices,
  .rules-topic-links {
    grid-template-columns: 1fr;
  }

  .extra-tool-window {
    top: 12px;
    left: 12px;
    width: calc(100vw - 24px) !important;
    max-height: calc(100vh - 24px);
    overflow-y: auto;
    transform: none;
  }

  .shipment-timer-fields {
    grid-template-columns: minmax(80px, 1fr) 52px 52px auto;
  }
}
