.articles-page,
.public-article-page {
  min-height: 100vh;
  background: #f3f5f7;
}

.articles-page [hidden],
.public-article-page [hidden],
.article-preview[hidden] {
  display: none !important;
}

.articles-shell {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: calc(var(--topbar-height) + 24px) 0 64px;
}

.breadcrumb {
  display: flex;
  min-height: 34px;
  margin-bottom: 18px;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 0.78rem;
}

.breadcrumb a { text-decoration: none; }
.breadcrumb a:hover { color: var(--cyan); }
.breadcrumb svg { width: 14px; }

.article-button,
.icon-command {
  display: inline-flex;
  min-height: 42px;
  border: 0;
  border-radius: 6px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  font: inherit;
  font-size: 0.86rem;
  font-weight: 800;
  text-decoration: none;
}

.article-button { padding: 9px 14px; }
.article-button svg,
.icon-command svg { width: 18px; }
.article-button--primary { background: var(--cyan); color: #071419; }
.article-button--primary:hover { background: #51d2e4; }
.article-button--secondary { border: 1px solid var(--line-strong); background: #fff; color: #33404a; }
.article-button--secondary:hover { background: #edf3f5; }
.article-button:disabled { cursor: wait; opacity: 0.58; }

.icon-command {
  width: 42px;
  padding: 0;
  flex: 0 0 42px;
  border: 1px solid var(--line-strong);
  background: #fff;
  color: #3b4750;
}

.icon-command:hover { background: #edf3f5; }

.articles-auth {
  display: grid;
  min-height: 210px;
  padding: 28px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--cyan);
  grid-template-columns: 100px minmax(0, 1fr) auto;
  align-items: center;
  gap: 28px;
  background: #fff;
  box-shadow: var(--shadow);
}

.articles-auth > img { width: 100px; height: 100px; border-radius: 8px; object-fit: cover; }
.articles-auth h1 { margin: 3px 0 7px; font-size: 2rem; }
.articles-auth p { margin: 0; color: var(--muted); }
.articles-auth__actions { display: flex; flex-direction: column; gap: 8px; }

.library-heading {
  display: flex;
  padding: 12px 0 26px;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
}

.library-heading h1 { margin: 3px 0 5px; font-size: 2.5rem; }
.library-heading p { margin: 0; color: var(--muted); }
.eyebrow { color: #08788e; font-size: 0.72rem; font-weight: 900; text-transform: uppercase; }

.library-summary {
  display: flex;
  margin-bottom: 18px;
  border-block: 1px solid var(--line);
  background: #fff;
}

.library-summary > span {
  display: flex;
  min-width: 130px;
  padding: 14px 20px;
  flex-direction: column;
  border-right: 1px solid var(--line);
}

.library-summary strong { font-size: 1.35rem; line-height: 1.1; }
.library-summary small { margin-top: 4px; color: var(--muted); }

.article-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }

.article-list__item {
  display: grid;
  min-height: 154px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 7px;
  grid-template-columns: minmax(0, 1fr) 112px;
  gap: 18px;
  background: #fff;
  cursor: pointer;
  text-align: left;
}

.article-list__item:hover { border-color: #aebac2; box-shadow: 0 8px 20px rgba(24, 34, 45, 0.07); }
.article-list__copy { min-width: 0; display: flex; flex-direction: column; }
.article-list__copy h2 { margin: 7px 0 5px; font-size: 1.08rem; overflow-wrap: anywhere; }
.article-list__copy p { margin: 0; color: var(--muted); font-size: 0.82rem; overflow-wrap: anywhere; }
.article-list__copy time { margin-top: auto; padding-top: 12px; color: #87919a; font-size: 0.72rem; }

.article-status { display: inline-flex; width: fit-content; min-height: 25px; padding: 3px 8px; border-radius: 4px; align-items: center; gap: 5px; background: var(--yellow-soft); color: #7b5700; font-size: 0.7rem; font-weight: 900; }
.article-status.is-published { background: var(--green-soft); color: #146847; }
.article-status svg { width: 13px; }

.article-list__cover { display: grid; width: 112px; height: 112px; border-radius: 6px; place-items: center; overflow: hidden; background: #e9eef2; color: #78838c; }
.article-list__cover img { width: 100%; height: 100%; object-fit: cover; }
.article-list__cover svg { width: 28px; }
.article-list__empty { grid-column: 1 / -1; padding: 56px 20px; border-block: 1px solid var(--line); color: var(--muted); text-align: center; }
.article-list__empty svg { width: 34px; margin-bottom: 10px; color: var(--cyan); }
.article-list__empty strong { display: block; color: var(--ink); }

.editor-view { position: relative; }
.editor-header {
  position: sticky;
  z-index: 20;
  top: calc(var(--topbar-height) + 8px);
  display: flex;
  min-height: 62px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 7px 18px rgba(24, 34, 45, 0.08);
}

.editor-status { display: flex; min-width: 0; margin-right: auto; flex-direction: column; line-height: 1.25; }
.editor-status strong,
.editor-status small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.editor-status small { margin-top: 3px; color: var(--muted); font-size: 0.73rem; }
.editor-status small.is-saving { color: var(--yellow); }
.editor-status small.is-error { color: var(--red); }
.editor-actions { display: flex; gap: 8px; }

.editor-menu {
  position: absolute;
  z-index: 30;
  top: 58px;
  right: 8px;
  width: 228px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  box-shadow: var(--shadow);
}

.editor-menu button { display: flex; width: 100%; min-height: 42px; padding: 8px 10px; border: 0; border-radius: 4px; align-items: center; gap: 9px; background: transparent; cursor: pointer; color: var(--ink); font: inherit; font-size: 0.82rem; font-weight: 700; text-align: left; }
.editor-menu button:hover { background: #eef3f5; }
.editor-menu button.is-danger { color: var(--red); }
.editor-menu svg { width: 17px; }

.editor-layout { display: grid; margin-top: 18px; grid-template-columns: 230px minmax(0, 760px); justify-content: center; align-items: start; gap: 22px; }
.cover-panel { position: sticky; top: calc(var(--topbar-height) + 88px); }
.cover-drop { display: grid; width: 100%; aspect-ratio: 4 / 5; padding: 0; border: 1px dashed #aab7c0; border-radius: 7px; place-items: center; overflow: hidden; background: #e9eef2; cursor: pointer; color: #4d5a64; }
.cover-drop:hover { border-color: var(--cyan); background: var(--cyan-soft); }
.cover-drop img { width: 100%; height: 100%; object-fit: cover; }
.cover-drop > span { display: flex; padding: 18px; align-items: center; flex-direction: column; text-align: center; }
.cover-drop svg { width: 30px; margin-bottom: 10px; color: var(--cyan); }
.cover-drop small { margin-top: 5px; color: var(--muted); font-size: 0.7rem; }
.cover-remove { display: flex; width: 100%; min-height: 36px; margin-top: 7px; border: 0; align-items: center; justify-content: center; gap: 5px; background: transparent; color: var(--red); cursor: pointer; font: inherit; font-size: 0.75rem; font-weight: 800; }
.cover-remove svg { width: 15px; }

.editor-paper { min-height: 900px; padding: 64px 68px 100px; border: 1px solid var(--line); background: #fff; box-shadow: 0 8px 28px rgba(24, 34, 45, 0.06); }
.editor-title,
.editor-subtitle { display: block; width: 100%; padding: 0; border: 0; outline: 0; resize: none; overflow: hidden; background: transparent; color: var(--ink); font-family: Georgia, "Times New Roman", serif; letter-spacing: 0; }
.editor-title { min-height: 58px; font-size: 2.65rem; font-weight: 800; line-height: 1.08; }
.editor-subtitle { min-height: 36px; margin-top: 14px; color: #69737c; font-size: 1.22rem; line-height: 1.45; }
.editor-title::placeholder,
.editor-subtitle::placeholder { color: #b3bbc1; }

.editor-byline,
.public-byline { display: flex; margin: 26px 0 30px; align-items: center; gap: 10px; }
.editor-avatar { display: grid; width: 36px; height: 36px; flex: 0 0 36px; border-radius: 50%; place-items: center; background: var(--charcoal); color: #fff; font-size: 0.82rem; font-weight: 900; }
.editor-byline > span:last-child,
.public-byline > span:last-child { display: flex; flex-direction: column; line-height: 1.28; }
.editor-byline small,
.public-byline time { color: var(--muted); font-size: 0.72rem; }

.editor-toolbar { position: sticky; z-index: 10; top: calc(var(--topbar-height) + 80px); display: flex; min-height: 48px; margin: 0 -16px 28px; padding: 5px 10px; border-block: 1px solid var(--line); align-items: center; gap: 3px; background: rgba(255, 255, 255, 0.97); overflow-x: auto; }
.editor-toolbar button { display: grid; width: 36px; height: 36px; flex: 0 0 36px; padding: 0; border: 0; border-radius: 4px; place-items: center; background: transparent; color: #34414a; cursor: pointer; font: inherit; }
.editor-toolbar button:hover { background: #e9eef2; }
.editor-toolbar button.is-active { background: var(--cyan-soft); color: #08788e; }
.editor-toolbar button svg { width: 18px; }
.editor-toolbar > span { width: 1px; height: 23px; margin: 0 4px; flex: 0 0 1px; background: var(--line); }

.article-editor,
.public-content { min-height: 430px; outline: 0; color: #24282d; font-family: Georgia, "Times New Roman", serif; font-size: 1.08rem; line-height: 1.78; overflow-wrap: anywhere; }
.article-editor:empty::before { content: attr(data-placeholder); color: #abb4bb; pointer-events: none; }
.article-editor p,
.public-content p { margin: 0 0 1.25em; }
.article-editor h2,
.public-content h2 { margin: 1.7em 0 0.65em; font-size: 1.62rem; }
.article-editor h3,
.public-content h3 { margin: 1.5em 0 0.55em; font-size: 1.3rem; }
.article-editor blockquote,
.public-content blockquote { margin: 1.5em 0; padding: 4px 0 4px 22px; border-left: 4px solid var(--cyan); color: #4d5962; font-size: 1.14em; }
.article-editor ul,
.article-editor ol,
.public-content ul,
.public-content ol { padding-left: 1.5em; }
.article-editor a,
.public-content a { color: #087d94; }
.article-editor figure,
.public-content figure { margin: 2em 0; }
.article-editor img,
.public-content img { display: block; max-width: 100%; height: auto; margin: 1.8em auto; border-radius: 6px; }
.article-editor figcaption,
.public-content figcaption { margin-top: -1.2em; color: var(--muted); font-family: Inter, "Segoe UI", sans-serif; font-size: 0.76rem; text-align: center; }

.article-preview { position: fixed; z-index: 300; inset: 0; padding: 78px 20px 40px; overflow-y: auto; background: #f3f5f7; }
.preview-topbar { position: fixed; z-index: 2; inset: 0 0 auto; display: flex; height: 62px; padding: 0 20px; align-items: center; justify-content: space-between; background: var(--charcoal); color: #fff; }
.preview-topbar .icon-command { border-color: #49515a; background: #252a30; color: #fff; }

.public-shell { width: min(100%, 1000px); margin: 0 auto; padding: calc(var(--topbar-height) + 46px) 20px 80px; }
.public-article { width: min(100%, 780px); margin: 0 auto; }
.public-cover { display: block; width: 100%; max-height: 560px; margin-bottom: 42px; border-radius: 7px; object-fit: cover; }
.public-article > header { margin-bottom: 38px; }
.article-label { display: inline-flex; margin-bottom: 14px; align-items: center; gap: 7px; color: #08788e; font-size: 0.72rem; font-weight: 900; text-transform: uppercase; }
.article-label svg { width: 15px; }
.public-article > header h1 { margin: 0 0 12px; font-family: Georgia, "Times New Roman", serif; font-size: 3.15rem; line-height: 1.08; overflow-wrap: anywhere; }
.public-article > header > p { color: #68737c; font-family: Georgia, "Times New Roman", serif; font-size: 1.28rem; line-height: 1.5; }
.public-content { min-height: 0; font-size: 1.12rem; }
.public-footer { display: flex; min-height: 92px; margin-top: 64px; padding: 16px; border-block: 1px solid var(--line); align-items: center; gap: 12px; }
.public-footer img { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; }
.public-footer > span { display: flex; min-width: 0; flex: 1; flex-direction: column; }
.public-footer small { color: var(--muted); }
.public-footer a { display: inline-flex; min-height: 38px; padding: 7px 10px; border-radius: 5px; align-items: center; gap: 6px; background: var(--cyan-soft); color: #08788e; font-size: 0.78rem; font-weight: 900; text-decoration: none; }
.public-footer svg { width: 16px; }
.public-share { background: transparent; font: inherit; }

.article-loading { display: flex; min-height: 55vh; align-items: center; justify-content: center; flex-direction: column; color: var(--muted); }
.article-loading span { width: 34px; height: 34px; border: 3px solid #d8e0e5; border-top-color: var(--cyan); border-radius: 50%; animation: article-spin 0.8s linear infinite; }
.article-loading p { margin-top: 12px; }
@keyframes article-spin { to { transform: rotate(360deg); } }

.article-not-found { min-height: 55vh; align-items: center; justify-content: center; flex-direction: column; text-align: center; }
.article-not-found:not([hidden]) { display: flex; }
.article-not-found > svg { width: 48px; color: var(--cyan); }
.article-not-found h1 { margin: 18px 0 7px; font-size: 2rem; }
.article-not-found p { color: var(--muted); }

.toast { position: fixed; z-index: 500; right: 20px; bottom: 20px; display: flex; min-height: 46px; padding: 10px 14px; transform: translateY(90px); border-radius: 6px; align-items: center; gap: 8px; background: var(--charcoal); color: #fff; box-shadow: var(--shadow); opacity: 0; transition: 180ms ease; }
.toast.is-visible { transform: translateY(0); opacity: 1; }
.toast svg { width: 17px; color: #57dca8; }

@media (max-width: 900px) {
  .articles-auth { grid-template-columns: 80px minmax(0, 1fr); }
  .articles-auth > img { width: 80px; height: 80px; }
  .articles-auth__actions { grid-column: 1 / -1; flex-direction: row; }
  .editor-layout { grid-template-columns: 160px minmax(0, 1fr); }
  .editor-paper { padding: 48px 42px 80px; }
  .article-list { grid-template-columns: 1fr; }
}

@media (max-width: 700px) {
  .articles-shell { width: min(100% - 20px, 1180px); padding-top: calc(var(--topbar-height) + 12px); }
  .articles-auth { padding: 20px; grid-template-columns: 58px minmax(0, 1fr); gap: 15px; }
  .articles-auth > img { width: 58px; height: 58px; }
  .articles-auth h1 { font-size: 1.45rem; }
  .articles-auth__actions { flex-direction: column; }
  .library-heading { align-items: flex-start; flex-direction: column; }
  .library-heading h1 { font-size: 2rem; }
  .library-heading .article-button { width: 100%; }
  .library-summary { display: grid; grid-template-columns: repeat(3, 1fr); }
  .library-summary > span { min-width: 0; padding: 11px; border-right: 1px solid var(--line); text-align: center; }
  .article-list__item { grid-template-columns: minmax(0, 1fr) 82px; }
  .article-list__cover { width: 82px; height: 82px; }
  .editor-header { top: calc(var(--topbar-height) + 5px); flex-wrap: wrap; }
  .editor-status { width: calc(100% - 54px); }
  .editor-actions { width: 100%; }
  .editor-actions .article-button { flex: 1; }
  .editor-layout { display: block; }
  .cover-panel { position: static; margin-bottom: 12px; }
  .cover-drop { aspect-ratio: 16 / 8; }
  .editor-paper { min-height: 740px; padding: 32px 20px 70px; }
  .editor-title { font-size: 2.05rem; }
  .editor-subtitle { font-size: 1.08rem; }
  .editor-toolbar { top: 142px; margin-inline: -10px; }
  .public-shell { padding: calc(var(--topbar-height) + 28px) 16px 55px; }
  .public-cover { margin-bottom: 28px; }
  .public-article > header h1 { font-size: 2.25rem; }
  .public-article > header > p { font-size: 1.08rem; }
  .public-content { font-size: 1.03rem; }
  .public-footer { align-items: flex-start; flex-wrap: wrap; }
  .public-footer a { width: 100%; justify-content: center; }
  .article-preview { padding-inline: 16px; }
}

@media (max-width: 480px) {
  .topbar__actions .text-button span { display: none; }
  .article-list__item { min-height: 132px; padding: 14px; }
  .editor-actions .article-button { padding-inline: 8px; }
  .editor-actions .article-button span { font-size: 0.76rem; }
}
