:root {
  --app-bg: #f4f7fb;
  --app-panel: #ffffff;
  --app-soft: #f8fafc;
  --app-line: #d7dee9;
  --app-line-strong: #b8c4d4;
  --app-ink: #182230;
  --app-sub: #5f6f82;
  --app-blue: #2f6fed;
  --app-teal: #0f8f7a;
  --app-navy: #142033;
  --app-danger: #b42318;
  --app-shadow: 0 10px 24px rgba(18, 32, 51, 0.08);
  --app-shadow-strong: 0 18px 40px rgba(18, 32, 51, 0.16);
  color-scheme: light;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--app-ink);
  background: var(--app-bg);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    linear-gradient(180deg, #eef4fb 0, var(--app-bg) 220px),
    var(--app-bg);
}

button,
input,
select,
textarea,
a {
  font: inherit;
}

.topbar {
  min-height: 72px;
  padding: 16px 20px;
  background: linear-gradient(120deg, #111b2c 0%, #17253a 58%, #15352f 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 10px 28px rgba(18, 32, 51, 0.16);
}

.topbar > div:first-child {
  min-width: 0;
}

.eyebrow {
  margin: 0 0 2px;
  color: #a9b8cc;
  font-size: 13px;
  font-weight: 700;
}

.topbar h1 {
  margin: 0;
  font-size: 24px;
  font-weight: 850;
  white-space: nowrap;
}

.top-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex: 0 0 auto;
  max-width: 100%;
  overflow: visible;
  flex-wrap: nowrap;
}

.app-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex: 0 0 auto;
  flex-wrap: nowrap;
}

.topbar a,
.topbar button,
.app-nav a {
  flex: 0 0 auto;
  min-height: 38px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.94);
  color: var(--app-navy);
  border-radius: 6px;
  padding: 8px 12px;
  text-decoration: none;
  cursor: pointer;
  font-weight: 750;
  white-space: nowrap;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.35) inset;
}

.topbar a:hover,
.topbar button:hover,
.app-nav a:hover {
  background: #ffffff;
  border-color: rgba(255, 255, 255, 0.7);
}

main button,
.layout button,
.home-main button,
.terms button {
  border-color: var(--app-line-strong);
  background: linear-gradient(#ffffff, #f6f9fd);
  color: var(--app-navy);
  font-weight: 760;
  box-shadow: 0 1px 2px rgba(18, 32, 51, 0.08);
  transition: border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

main button:hover,
.layout button:hover,
.home-main button:hover,
.terms button:hover {
  border-color: var(--app-blue);
  background: #f0f6ff;
  box-shadow: 0 8px 18px rgba(47, 111, 237, 0.12);
}

main button:active,
.layout button:active,
.home-main button:active,
.terms button:active {
  transform: translateY(1px);
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.16);
}

.app-nav a[aria-current="page"] {
  border-color: var(--app-blue);
  color: #1d4ed8;
  background: #eef5ff;
}

.manu-settings {
  position: relative;
  display: inline-flex;
}

.manu-settings > summary {
  list-style: none;
}

.manu-settings > summary::-webkit-details-marker {
  display: none;
}

.manu-settings-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  min-width: 38px;
  min-height: 38px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--app-navy);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
}

.manu-settings-button:hover {
  background: #fff;
}

.manu-settings-button:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.38);
  outline-offset: 2px;
}

.manu-settings-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 3000;
  min-width: 180px;
  padding: 10px;
  border: 1px solid var(--app-line);
  border-radius: 8px;
  background: #fff;
  color: var(--app-navy);
  box-shadow: var(--app-shadow-strong);
}

.manu-lang-field {
  display: grid;
  gap: 6px;
  font-size: 12px;
  font-weight: 800;
}

.manu-lang-field select {
  width: 100%;
  min-height: 34px;
  border: 1px solid #bcccdc;
  border-radius: 6px;
  background: #fff;
  color: inherit;
  padding: 5px 8px;
  cursor: pointer;
}

.app-alert {
  max-width: 1280px;
  margin: 12px auto 0;
  padding: 10px 14px;
  border: 1px solid #f8c9a8;
  border-radius: 8px;
  background: #fff7ed;
  color: #9a3412;
  font-size: 14px;
  line-height: 1.5;
}

.app-alert.hidden {
  display: none;
}

.toast-container {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 2000;
  display: grid;
  gap: 8px;
  pointer-events: none;
}

.app-toast {
  min-width: 220px;
  max-width: min(360px, calc(100vw - 32px));
  padding: 10px 12px;
  border: 1px solid rgba(15, 23, 42, 0.14);
  border-radius: 8px;
  background: var(--app-navy);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.45;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.22);
  opacity: 0;
  transform: translateY(8px);
  animation: toast-in 0.18s ease forwards;
}

.app-toast.success {
  background: var(--app-teal);
}

.app-toast.error {
  background: #b42318;
}

@keyframes toast-in {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.layout,
.home-main,
.terms {
  width: 100%;
  margin-left: auto;
  margin-right: auto;
}

.list-pane,
.editor-pane,
.form-pane,
.history-pane,
.qr-pane,
.quick-panel,
.terms section {
  background: var(--app-panel);
  border: 1px solid var(--app-line);
  border-radius: 8px;
  box-shadow: var(--app-shadow);
}

input,
select,
textarea {
  border-color: var(--app-line-strong);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--app-blue);
  outline: 3px solid rgba(47, 111, 237, 0.16);
  outline-offset: 1px;
}

@media (max-width: 640px) {
  .topbar {
    align-items: center;
    flex-direction: row;
    gap: 8px;
    min-height: 0;
    padding: 10px 8px;
  }

  .top-actions,
  .app-nav {
    align-items: center;
    justify-content: flex-end;
    flex-direction: row;
    width: auto;
    flex-wrap: nowrap;
  }

  .topbar .app-nav a,
  .topbar .top-actions > button,
  .topbar .manu-settings-button {
    width: auto !important;
    min-height: 28px !important;
    padding: 4px 7px !important;
    border-radius: 5px;
    font-size: 12px !important;
    line-height: 1.2;
    text-align: center;
  }

  .topbar .manu-settings-button {
    width: 28px !important;
    min-width: 28px;
  }

  .topbar h1 {
    font-size: 20px;
  }

  .toast-container {
    right: 10px;
    bottom: 10px;
    left: 10px;
  }

  .app-toast {
    width: 100%;
    max-width: none;
  }

  input,
  select,
  textarea {
    font-size: 16px;
    line-height: 1.35;
  }
}
