body.loading-cursor,
body.loading-cursor * {
  cursor: wait !important;
}

:root {
  --bg-primary: #ffffff;
  --bg-secondary: #f7f7f7;
  --bg-tertiary: #eeeeee;
  --bg-quaternary: #e0e0e0;

  --text-primary: #111111;
  --text-secondary: #333333;
  --text-tertiary: #666666;
  --text-quaternary: #999999;

  --border: #cccccc;
  --accent: #00a884;
  --accent-hover: #00c89a;
  --scrollbar-thumb: #b0b0b0;
  --scrollbar-thumb-hover: #999999;

  --overlay: rgba(0,0,0,0.35);
}

.dark {
  --bg-primary: #111b21;
  --bg-secondary: #1a242b;
  --bg-tertiary: #222e35;
  --bg-quaternary: #2a3942;

  --text-primary: #e9edef;
  --text-secondary: #aebac1;
  --text-tertiary: #7a8a94;
  --text-quaternary: #5a6a73;

  --border: #444444;
  --accent: #007b8f;
  --accent-hover: #0099a8;
  --scrollbar-thumb: #4a5a63;
  --scrollbar-thumb-hover: #5a6a73;

  --overlay: rgba(255,255,255,0.25);
}

html,
body {
  height: 100%;
  width: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
  background: var(--bg-secondary);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 12px;
  letter-spacing: 1px;
}

*::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

*::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}

*::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
}

*::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-thumb-hover);
}

.toast-container {
  position: fixed;
  top: 2px;
  right: 4px;
  z-index: 1000;
}

.toast {
  background: #222e35;
  color: #e9edef;
  padding: 12px;
  border-radius: 8px;
  margin-top: 0;
  box-shadow: 0 2px 8px #0006;
  opacity: 0;
  transform: translateX(100%);
  transition: opacity 0.3s, transform 0.3s;
  cursor: pointer;
  min-width: 180px;
  font-size: 15px;
}

.toast.show {
  opacity: 1;
  transform: translateX(0);
}

.toast.success {
  background: #005c4b;
  color: #fff;
}

.toast.error {
  background: #a00;
  color: #fff;
}

.toast.info {
  background: #2a3942;
  color: #00a884;
}

.toast.warning {
  background: #ff9800;
  color: #fff;
}

.container {
  display: grid;
  background: var(--bg-secondary);
  grid-template-columns: 40px 1fr;
  grid-template-rows: min-content 1fr;
  grid-template-areas:
    "menu-bar nav-bar"
    "menu-bar main-content";
  height: 100vh;
}

.nav-bar {
  grid-area: nav-bar;
  display: flex;
  flex-direction: row;
  align-items: center;
  background: var(--bg-secondary);
  color: var(--text-primary);
  height: 40px;
  width: 100%;
  gap: 4px;
  padding: 2px;
  user-select: none;
}

.main-content {
  grid-area: main-content;
  display: flex;
  flex-direction: column;
  background: var(--bg-primary);
  color: var(--text-primary);
  overflow: auto;
}

.menu-bar {
  grid-area: menu-bar;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--bg-secondary);
  color: var(--text-primary);
  height: 100%;
  width: 40px;
  gap: 4px;
  padding: 2px;
  user-select: none;
}

@media (max-width: 768px) {
  .container {
    grid-template-columns: 1fr;
    grid-template-rows: min-content min-content 1fr;
    grid-template-areas:
      "menu-bar"
      "nav-bar"
      "main-content";
  }

  .menu-bar {
    flex-direction: row;
    width: 100vw;
    height: 40px;
  }
}

a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  color: var(--text-tertiary);
  background: transparent;
  width: 40px;
  height: 40px;
  padding: 2px 0;
  cursor: pointer;
}

a span {
  width: 24px;
  height: 24px;
  stroke: currentColor;
  fill: none;
}

a svg {
  width: 24px;
  height: 24px;
  stroke: currentColor;
  fill: none;
}

a div,
a label {
  margin-top: 0px;
  font-size: 9px;
  text-align: center;
  cursor: pointer;
  letter-spacing: 0px;
}

a:hover {
  background: var(--bg-quaternary);
  color: var(--text-primary);
}

a.active {
  color: var(--accent);
}

#suggestions {
  position: absolute;
  display: none;
  background: var(--bg-primary, #23272e);
  color: var(--text-primary, #fff);
  border: 1px solid var(--border, #444);
  border-radius: 6px;
  box-shadow: 0 4px 16px #000a;
  max-height: calc(100% - 40px);
  overflow: auto;
  margin-top: 3px;
  z-index: 1000;
  padding-bottom: 10px;
}

#suggestions>div {
  height: 30px;
  padding: 6px 12px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  white-space: nowrap;
}

#suggestions>div:hover {
  background: var(--bg-secondary);
}

.wrapper {
  position: relative;
  display: inline-block;
  vertical-align: middle;
}

.wrapper input {
  width: 100%;
  height: 30px;
  color: var(--text-primary);
  background-color: transparent;
  border: 1px solid var(--text-tertiary);
  font-weight: bold;
  font-size: 12px;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
  padding-right: 5px;
  padding-left: 5px;
  border-radius: 4px;
  box-sizing: border-box;
}

.wrapper:has(span.edit) input {
  padding-left: 30px;
}

.wrapper:has(span.reset) input {
  padding-right: 30px;
}

.wrapper:has(span.action) input {
  padding-right: 55px;
}

.wrapper input::placeholder {
  color: var(--text-tertiary);
  font-weight: normal;
}

.wrapper input:focus {
  border-color: var(--accent, #69C4FF);
}

.wrapper .reset:hover,
.wrapper .edit:hover,
.wrapper .action:hover {
  transform: scale(1.2);
}

.wrapper .edit {
  cursor: pointer;
  user-select: none;
  color: var(--text-secondary, #aaa);
  padding: 0 6px;
  display: inline-flex;
  position: absolute;
  left: 0;
  line-height: 30px;
}

.wrapper .reset {
  cursor: pointer;
  user-select: none;
  color: var(--text-secondary, #aaa);
  padding: 0 6px;
  display: inline-flex;
  position: absolute;
  right: 0;
  line-height: 30px;
}

.wrapper .action {
  cursor: pointer;
  user-select: none;
  color: var(--text-secondary, #aaa);
  padding: 0 26px 0 5px;
  display: inline-flex;
  position: absolute;
  right: 0;
  line-height: 30px;
}

dialog {
  border: none;
  border-radius: 8px;
  padding: 20px;
  background: var(--bg-secondary);
  color: var(--text-primary);
  box-shadow: 0 2px 16px rgba(0,0,0,0.8);
  text-align: center;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  user-select: none;
}

dialog::backdrop {
  background: var(--overlay);
}

button {
  width: 100%;
  height: 30px;
  cursor: pointer;
  user-select: none;
}

button:hover {
  background: var(--accent-hover);
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

#cancelBtn {
  background: var(--border);
  color: var(--text-primary);
}

#okBtn {
  background: var(--accent-hover);
  color: var(--text-primary);
}

dialog .grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-areas:
    "title title"
    "okBtn cancelBtn";
  gap: 10px;
  width: fit-content;
}

.title { grid-area: title; font-size: 12px; font-weight: bold; line-height: 30px;}
#okBtn { grid-area: okBtn; width: 120px;}
#cancelBtn { grid-area: cancelBtn; width: 120px;}