/* Settings page. Extends styles.css rather than repeating it. */

header .headerlink { color: #fff; text-decoration: none; opacity: .85; font-size: 14px; }
header .headerlink:hover { opacity: 1; text-decoration: underline; }

.tabs {
  display: flex; gap: 2px; padding: 0 22px;
  background: var(--panel); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 15;
}
.tab {
  border: none; background: none; padding: 13px 18px; font-size: 14px;
  color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent;
  border-radius: 0;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--green); border-bottom-color: var(--green); font-weight: 600; }

main { padding: 22px; max-width: 1180px; margin: 0 auto 90px; }

.savebar {
  position: fixed; bottom: 0; left: 0; right: 0;
  display: flex; align-items: center; gap: 14px; padding: 12px 22px;
  background: var(--panel); border-top: 1px solid var(--line);
  box-shadow: 0 -3px 14px rgba(0,0,0,.07); z-index: 20;
}
.savebar .spacer { flex: 1; }

.logo-preview {
  margin: -4px 0 14px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 6px; background: var(--bg);
}
.logo-preview img { max-height: 48px; max-width: 200px; vertical-align: middle; }
.logo-preview .err { color: var(--danger); font-size: 13px; }

.colors { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 8px; }
.colors label {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--muted);
}
.colors input[type=color] {
  width: 34px; height: 28px; padding: 0; border: 1px solid var(--line);
  border-radius: 5px; background: none; cursor: pointer;
}

/* --------------------------------------------------------- template pane */
.tpl-layout { display: grid; grid-template-columns: 260px 1fr; gap: 18px; align-items: start; }
@media (max-width: 900px) { .tpl-layout { grid-template-columns: 1fr; } }

.tpl-list .row {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 14px; border-bottom: 1px solid var(--line);
  cursor: pointer; font-size: 14px;
}
.tpl-list .row:hover { background: color-mix(in srgb, var(--green) 8%, transparent); }
.tpl-list .row.active {
  background: color-mix(in srgb, var(--green) 14%, transparent);
  border-left: 3px solid var(--green); font-weight: 600;
}
.tpl-list .row .n { margin-left: auto; font-size: 11px; color: var(--muted); }
.tpl-list .row .edited { font-size: 10px; color: var(--green); }

.editor-toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px;
  padding: 8px; border: 1px solid var(--line); border-bottom: none;
  border-radius: 6px 6px 0 0; background: var(--bg);
}
.editor-toolbar button {
  padding: 5px 9px; font-size: 13px; min-width: 30px;
  background: var(--panel);
}
.editor-toolbar select { padding: 5px 7px; font-size: 13px; border-radius: 5px;
  border: 1px solid var(--line); background: var(--panel); color: var(--text); }
.editor-toolbar input[type=color] {
  width: 30px; height: 28px; padding: 0; border: 1px solid var(--line);
  border-radius: 5px; background: none; cursor: pointer;
}
.editor-toolbar .spacer { flex: 1; }

.rich-editor, .source-editor {
  width: 100%; min-height: 340px; max-height: 520px; overflow-y: auto;
  padding: 16px; border: 1px solid var(--line); border-radius: 0 0 6px 6px;
  background: #fff; color: #11292F;
}
.rich-editor:focus, .source-editor:focus { outline: 2px solid var(--green); outline-offset: -2px; }
.source-editor { font-family: ui-monospace, Menlo, monospace; font-size: 12.5px; line-height: 1.5; }

.vars { margin-top: 12px; }
.vars summary { cursor: pointer; font-size: 13px; color: var(--green); }
.varlist { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.varlist button {
  font-family: ui-monospace, Menlo, monospace; font-size: 12px;
  padding: 4px 8px; background: var(--bg);
}
.varlist button small { color: var(--muted); font-family: inherit; }

.tpl-editor .foot {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; border-top: 1px solid var(--line);
}
.tpl-editor .foot .spacer { flex: 1; }
