:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --text: #1f2933;
  --muted: #697586;
  --line: #d8dde6;
  --accent: #176b5c;
  --accent-strong: #0f5147;
  --danger: #b42318;
  --shadow: 0 10px 30px rgba(30, 41, 59, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  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;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.app-shell {
  min-height: 100vh;
  padding: 24px;
}

.topbar {
  align-items: center;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  max-width: 1180px;
  margin: 0 auto 18px;
}

h1 {
  font-size: 28px;
  line-height: 1.15;
  margin: 0 0 4px;
}

p {
  color: var(--muted);
  margin: 0;
}

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

button {
  align-items: center;
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 8px;
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  font-weight: 700;
  justify-content: center;
  min-height: 42px;
  padding: 0 16px;
}

button:hover {
  background: var(--accent-strong);
}

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

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.secondary,
.icon-button {
  background: #fff;
  color: var(--text);
  border-color: var(--line);
}

.secondary:hover,
.icon-button:hover {
  background: #eef2f6;
}

.icon-button {
  width: 42px;
  padding: 0;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(260px, 320px) minmax(0, 1fr);
  gap: 18px;
  max-width: 1180px;
  margin: 0 auto;
}

.side-panel,
.editor-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.side-panel {
  align-self: start;
  display: grid;
  gap: 10px;
  padding: 16px;
}

label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input,
select,
textarea {
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  outline: none;
  width: 100%;
}

input,
select {
  min-height: 42px;
  padding: 0 12px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(23, 107, 92, 0.14);
}

.publish-row {
  align-items: center;
  display: flex;
  min-height: 42px;
}

.toggle {
  align-items: center;
  color: var(--text);
  display: flex;
  gap: 10px;
}

.toggle input {
  accent-color: var(--accent);
  height: 18px;
  width: 18px;
}

.post-link {
  color: var(--accent-strong);
  display: block;
  font-weight: 700;
  min-height: 22px;
  text-decoration: none;
  word-break: break-word;
}

.post-link:not([href]) {
  visibility: hidden;
}

.editor-panel {
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: calc(100vh - 128px);
  overflow: hidden;
}

.title-input {
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  font-size: 22px;
  font-weight: 750;
  min-height: 64px;
  padding: 0 18px;
}

.title-input:focus {
  box-shadow: none;
}

textarea {
  border: 0;
  border-radius: 0;
  min-height: 440px;
  padding: 18px;
  resize: none;
}

.compact-textarea {
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 88px;
  padding: 10px 12px;
  resize: vertical;
}

textarea:focus {
  box-shadow: none;
}

.toast {
  background: #101828;
  border-radius: 8px;
  bottom: 20px;
  color: #fff;
  left: 50%;
  max-width: min(560px, calc(100vw - 32px));
  opacity: 0;
  padding: 12px 14px;
  position: fixed;
  transform: translate(-50%, 20px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.toast.error {
  background: var(--danger);
  cursor: pointer;
}

/* Tablet portrait */
@media (max-width: 1024px) {
  .workspace {
    grid-template-columns: minmax(240px, 280px) minmax(0, 1fr);
    gap: 14px;
  }
}

/* Mobile */
@media (max-width: 760px) {
  .app-shell {
    padding: 14px;
  }

  .topbar {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .top-actions {
    display: grid;
    grid-template-columns: 1fr 42px;
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .editor-panel {
    min-height: 560px;
  }

  label {
    font-size: 16px;
  }

  textarea {
    min-height: 320px;
  }
}
