:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --panel: #ffffff;
  --text: #172033;
  --muted: #63708a;
  --line: #d8deea;
  --primary: #1f6feb;
  --primary-strong: #1557bf;
  --danger: #c7362e;
  --danger-bg: #fff0ef;
  --ok-bg: #eaf7ef;
  --warn-bg: #fff6df;
  --shadow: 0 12px 30px rgba(23, 32, 51, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

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

.app-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 48px;
}

.app-shell.narrow {
  width: min(860px, calc(100% - 32px));
}

.login-shell {
  width: min(440px, calc(100% - 32px));
  min-height: 100vh;
  display: grid;
  align-items: center;
}

.login-panel {
  padding: 28px;
}

.login-form {
  margin-top: 22px;
}

.topbar,
.toolbar,
.panel,
.status,
.notice {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 22px 24px;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 28px;
  line-height: 1.2;
}

.topbar p {
  margin-top: 8px;
  color: var(--muted);
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 280px) 1fr;
  gap: 16px;
  margin-top: 18px;
  padding: 18px;
}

.directory-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcff;
}

.directory-list {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}

.directory-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcff;
}

.directory-item.active {
  border-color: #9fc3ff;
  background: #f2f7ff;
}

.directory-item strong,
.directory-item small,
.directory-hint {
  display: block;
}

.directory-item small,
.directory-hint,
.sync-note {
  color: var(--muted);
  line-height: 1.45;
}

.directory-hint {
  margin-top: 3px;
  font-size: 13px;
}

.directory-item small {
  margin-top: 5px;
  font-size: 13px;
}

.directory-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.current-target {
  margin-top: 6px;
}

.sync-note {
  margin-top: 10px;
  font-size: 13px;
}

.label,
label,
legend {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.directory-box strong {
  display: block;
  font-size: 15px;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 18px;
  margin-top: 18px;
}

.panel {
  padding: 20px;
}

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

h2 {
  font-size: 20px;
}

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

.addon-list {
  display: grid;
  gap: 12px;
}

.addon-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #fff;
}

.addon-main {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.addon-main h3 {
  font-size: 18px;
  line-height: 1.25;
}

.description {
  margin-top: 6px;
  color: var(--muted);
  line-height: 1.5;
  white-space: pre-wrap;
}

.meta {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
  text-align: right;
}

.toc {
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

button,
.download,
.primary-link,
.ghost-link {
  min-height: 38px;
  border: 1px solid var(--primary);
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  padding: 8px 13px;
  text-decoration: none;
  cursor: pointer;
}

button:hover,
.download:hover,
.primary-link:hover,
.ghost-link:hover {
  background: var(--primary-strong);
}

.ghost-btn,
.ghost-link {
  background: #fff;
  color: var(--primary);
}

.ghost-btn:hover,
.ghost-link:hover {
  background: #edf4ff;
}

.primary-link,
.ghost-link {
  display: inline-flex;
  align-items: center;
}

.danger {
  border-color: #f0c4c0;
  background: var(--danger-bg);
  color: var(--danger);
}

.danger:hover {
  border-color: var(--danger);
  background: #ffe5e2;
}

.field {
  margin-bottom: 14px;
}

input,
select,
textarea {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  padding: 8px 10px;
}

textarea {
  resize: vertical;
}

.flavor-checks {
  display: grid;
  gap: 8px;
  margin: 0 0 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.flavor-checks label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--text);
  font-weight: 500;
}

.flavor-checks input {
  width: auto;
  min-height: auto;
}

.status,
.notice {
  margin-top: 18px;
  padding: 14px 16px;
  line-height: 1.5;
}

.status {
  background: var(--ok-bg);
}

.notice {
  background: var(--warn-bg);
}

.empty {
  padding: 30px 16px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 8px;
}

.toolbar.compact {
  grid-template-columns: minmax(200px, 260px) 1fr;
  margin-top: 0;
  box-shadow: none;
}

.list-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 16px 0 12px;
}

.inline-check,
.addon-select {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  color: var(--text);
}

.inline-check input,
.addon-select input {
  width: auto;
  min-height: auto;
}

.addon-select {
  align-items: flex-start;
  cursor: pointer;
}

.addon-select span {
  display: grid;
  gap: 5px;
}

.addon-select small {
  color: var(--muted);
  line-height: 1.4;
}

.local-addon {
  padding: 12px 14px;
}

.share-result {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.copy-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.landing-actions {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.hidden {
  display: none !important;
}

@media (max-width: 880px) {
  .topbar,
  .addon-main,
  .directory-box {
    align-items: stretch;
    flex-direction: column;
  }

  .toolbar,
  .content-grid,
  .directory-item {
    grid-template-columns: 1fr;
  }

  .directory-actions {
    justify-content: flex-start;
  }

  .meta {
    text-align: left;
  }
}
