:root {
  --bg: #f4f5f7;
  --ink: #12161c;
  --muted: #5e6874;
  --line: rgba(44, 62, 80, 0.16);
  --accent: #0a84ff;
}

* { box-sizing: border-box; }

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: linear-gradient(160deg, #fbfbfd, #f3f5f8 55%, #eef2f6);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
}

.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 60px;
  display: flex;
  align-items: center;
  z-index: 20;
  background: rgba(255, 255, 255, 0.74);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
}

.site-header-inner {
  width: min(1180px, 94vw);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.site-logo {
  text-decoration: none;
  color: var(--ink);
  font-weight: 700;
  letter-spacing: -0.01em;
}

.site-links {
  display: flex;
  gap: 14px;
}

.site-links a {
  text-decoration: none;
  color: #404b58;
  font-size: 14px;
  font-weight: 600;
}

.site-links a:hover {
  color: var(--accent);
}

.shell {
  width: min(1180px, 94vw);
  margin: 0 auto;
  padding: 86px 0 56px;
  display: grid;
  gap: 12px;
}

.top,
.panel {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255,255,255,.9);
  backdrop-filter: blur(14px);
  padding: 18px;
}

.eyebrow { margin: 0; text-transform: uppercase; letter-spacing: .08em; color: #0067d6; font-size: 12px; font-weight: 700; }
h1 { margin: 8px 0 0; font-size: clamp(1.9rem, 4vw, 2.7rem); }

.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.actions a,
.actions button {
  border: 1px solid var(--line);
  border-radius: 999px;
  text-decoration: none;
  color: var(--ink);
  padding: 10px 14px;
  min-height: 40px;
  background: rgba(255,255,255,.95);
  font-weight: 600;
  cursor: pointer;
}

#settingsEditorShell:not([hidden]) {
  display: grid;
  gap: 12px;
}

#settingsEditorShell[hidden] {
  display: none;
}

.auth-panel {
  display: grid;
  gap: 16px;
}

.auth-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.auth-panel-head h2 {
  margin: 6px 0 0;
  font-size: clamp(1.25rem, 2.8vw, 1.8rem);
}

.auth-actions,
.token-unlock-form {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: end;
}

.token-unlock-form label {
  min-width: min(420px, 100%);
  flex: 1 1 320px;
}

.primary-btn,
.secondary-btn {
  border-radius: 999px;
  min-height: 40px;
  padding: 10px 14px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.primary-btn {
  border: 1px solid #0a84ff;
  background: linear-gradient(180deg, #2a9bff, #0a84ff);
  color: #fff;
}

#saveBtn {
  border-color: #0a84ff;
  background: linear-gradient(180deg, #2a9bff, #0a84ff);
  color: #fff;
}

#syncBtn {
  border-color: #22a06b;
  background: linear-gradient(180deg, #3fca86, #22a06b);
  color: #fff;
}

.grid {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

label { display: grid; gap: 6px; font-size: 14px; font-weight: 600; }

input,
textarea {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  font: inherit;
  background: #fff;
}

textarea { min-height: 84px; resize: vertical; }

.json { min-height: 180px; font-family: ui-monospace, Menlo, monospace; font-size: 13px; }
.muted { color: var(--muted); }
.status { margin: 8px 0 0; color: #005fcb; font-weight: 600; }
.status[data-tone="error"] { color: #b42318; }

.linkedin-posts-editor {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.linkedin-post-row {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  background: rgba(255,255,255,.86);
  display: grid;
  gap: 10px;
}

.linkedin-post-row-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

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

.linkedin-post-priority {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #0067d6;
}

.linkedin-post-status {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.linkedin-post-status[data-state="ready"] {
  color: #126d42;
}

.linkedin-post-status[data-state="warning"] {
  color: #a15c07;
}

.secondary-btn {
  border: 1px solid var(--line);
  background: rgba(255,255,255,.95);
  color: var(--ink);
  justify-self: start;
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

@media (max-width: 900px) {
  .grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .site-header {
    height: 56px;
  }

  .site-header-inner {
    width: min(1180px, 96vw);
    gap: 8px;
  }

  .site-logo {
    font-size: 15px;
  }

  .site-links {
    gap: 6px;
  }

  .site-links a {
    font-size: 13px;
  }

  .shell {
    padding-top: 76px;
  }

  .auth-panel-head,
  .linkedin-post-row-head {
    grid-template-columns: 1fr;
    display: grid;
  }

  .linkedin-post-row-actions {
    justify-content: start;
  }
}

@media (max-width: 360px) {
  .site-links {
    gap: 4px;
  }

  .site-links a {
    font-size: 12px;
  }

  .site-links a[href="/settings"] {
    display: none;
  }
}
