:root {
  --ink: #17212b;
  --navy: #0d2740;
  --harbor: #1f5a6e;
  --gulf: #77b8bd;
  --paper: #f4ecdc;
  --brass: #be8b42;
  --signal: #9f3c30;
  --foam: #f9f6ef;
  --muted: #65717a;
  --line: rgba(13, 39, 64, 0.14);
}

* { box-sizing: border-box; }

body {
  background: #f6efe3;
  color: var(--ink);
  font-family: Arial, sans-serif;
  margin: 0;
}

.masthead {
  background: rgba(249, 246, 239, 0.96);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}

.masthead .nav {
  align-items: center;
  display: flex;
  gap: 24px;
  justify-content: space-between;
  margin: 0 auto;
  max-width: 1320px;
  padding: 14px 24px;
}

.masthead .brand {
  border-bottom: 0;
  color: var(--navy);
  padding-bottom: 0;
  text-decoration: none;
}

.masthead .brand span {
  color: var(--signal);
  font-size: 10px;
  margin-top: 4px;
}

.masthead .links {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: flex-end;
}

.masthead .links a,
.user-pill {
  color: var(--navy);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-decoration: none;
  text-transform: uppercase;
}

.user-pill {
  color: var(--signal);
}

.admin-return-bar {
  background: rgba(13, 39, 64, 0.06);
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: center;
  padding: 12px 24px;
}

.admin-return-bar .button {
  min-width: 220px;
}

.helm-shell,
.login-wrap {
  margin: 0 auto;
  max-width: 1200px;
  padding: 36px 24px 64px;
}

.login-wrap {
  align-items: center;
  display: grid;
  min-height: calc(100vh - 90px);
  place-items: center;
}

.login-panel {
  background: rgba(249, 246, 239, 0.94);
  border: 1px solid var(--line);
  box-shadow: 0 18px 42px rgba(13, 39, 64, 0.08);
  display: grid;
  gap: 16px;
  max-width: 440px;
  padding: 30px;
  width: 100%;
}

.login-panel h1 {
  font-size: 48px;
}

.notice,
.error {
  border: 1px solid rgba(13, 39, 64, 0.14);
  margin: 0 0 16px;
  padding: 12px 14px;
}

.notice {
  background: rgba(119, 184, 189, 0.16);
  color: var(--navy);
}

.save-notice {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: space-between;
}

.save-notice .button {
  min-height: 0;
  padding: 9px 14px;
}

.error {
  background: rgba(159, 60, 48, 0.1);
  color: var(--signal);
}

.admin-table {
  border-collapse: collapse;
  width: 100%;
}

.admin-table th,
.admin-table td {
  border-bottom: 1px solid var(--line);
  padding: 13px 10px;
  text-align: left;
  vertical-align: top;
}

.admin-table th {
  color: var(--signal);
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.admin-table small {
  color: var(--muted);
  display: block;
  line-height: 1.45;
  margin-top: 4px;
}

.sortable-table tbody tr {
  cursor: grab;
}

.sortable-table tbody tr.is-dragging {
  opacity: 0.45;
}

.drag-cell {
  width: 72px;
}

.drag-handle {
  background: rgba(13, 39, 64, 0.08);
  color: var(--navy);
  display: inline-grid;
  font-weight: 900;
  height: 30px;
  letter-spacing: -0.08em;
  place-items: center;
  width: 30px;
}

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

.shell {
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  background:
    linear-gradient(180deg, rgba(13, 39, 64, 0.96), rgba(10, 28, 45, 0.98)),
    url("assets/compass-rose-1748-bowen.png");
  background-position: center bottom;
  background-repeat: no-repeat;
  background-size: 280px;
  color: #f9f6ef;
  padding: 28px 22px;
}

.brand {
  border-bottom: 1px solid rgba(249, 246, 239, 0.18);
  padding-bottom: 24px;
}

.brand strong {
  display: block;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 30px;
  line-height: 1;
}

.brand span {
  color: #d4dfdf;
  display: block;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
  margin-top: 8px;
  text-transform: uppercase;
}

.nav-list {
  display: grid;
  gap: 8px;
  margin-top: 28px;
}

.nav-list a {
  border: 1px solid transparent;
  color: #f9f6ef;
  display: flex;
  justify-content: space-between;
  padding: 12px 13px;
  text-decoration: none;
}

.nav-list a[aria-current="page"],
.nav-list a:hover {
  background: rgba(249, 246, 239, 0.1);
  border-color: rgba(249, 246, 239, 0.18);
}

.content {
  padding: 30px clamp(24px, 5vw, 56px) 48px;
}

.topbar,
.section-head,
.footer-actions {
  align-items: center;
  display: flex;
  gap: 18px;
  justify-content: space-between;
}

.topbar {
  margin-bottom: 34px;
}

.eyebrow,
.status,
.label {
  color: var(--signal);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  color: var(--navy);
  margin: 0;
}

h1 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(38px, 6vw, 70px);
  line-height: 0.96;
}

h2 {
  font-size: 24px;
  letter-spacing: -0.01em;
}

h3 {
  font-size: 18px;
}

p {
  color: var(--muted);
  line-height: 1.55;
  margin: 8px 0 0;
}

.button {
  background: var(--navy);
  border: 0;
  color: var(--foam);
  cursor: pointer;
  display: inline-flex;
  font-size: 13px;
  font-weight: 900;
  justify-content: center;
  letter-spacing: 0.08em;
  padding: 12px 16px;
  text-decoration: none;
  text-transform: uppercase;
}

.button.secondary {
  background: transparent;
  border: 1px solid rgba(13, 39, 64, 0.22);
  color: var(--navy);
}

.button.danger {
  background: var(--signal);
  color: var(--foam);
}

.table-actions {
  align-items: center;
  display: flex;
  gap: 8px;
}

.table-actions form {
  margin: 0;
}

.dashboard-grid {
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 34px;
}

.panel,
.task,
.editor-card,
.list-item,
.preview-card {
  background: rgba(249, 246, 239, 0.9);
  border: 1px solid var(--line);
  box-shadow: 0 18px 42px rgba(13, 39, 64, 0.08);
}

.panel,
.task {
  padding: 22px;
}

.task {
  display: flex;
  flex-direction: column;
  min-height: 245px;
}

.task p {
  flex: 1;
}

.panel strong,
.task strong {
  color: var(--navy);
  display: block;
  font-size: 30px;
  line-height: 1;
  margin-top: 12px;
}

.quick-actions {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 22px 0 36px;
}

.content-areas {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.task h3 {
  margin-bottom: 6px;
}

.task .button {
  margin-top: auto;
  width: 100%;
}

.component-grid {
  display: grid;
  gap: 22px;
  grid-template-columns: minmax(0, 1fr) 380px;
}

.editor-layout {
  display: grid;
  gap: 22px;
  grid-template-columns: minmax(0, 1fr) 360px;
}

.editor-card {
  padding: 24px;
}

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

label {
  color: var(--navy);
  display: grid;
  font-size: 13px;
  font-weight: 900;
  gap: 7px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

label.wide {
  grid-column: 1 / -1;
}

.check-row {
  align-content: center;
  display: flex;
  gap: 10px;
  min-height: 44px;
}

input,
select,
textarea {
  background: #fffaf0;
  border: 1px solid rgba(13, 39, 64, 0.2);
  color: var(--ink);
  min-height: 44px;
  padding: 10px 12px;
}

input[type="checkbox"] {
  min-height: auto;
  width: 18px;
}

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

.rich-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0 10px;
}

.rich-toolbar button,
.rich-toolbar select {
  background: #fffaf0;
  border: 1px solid rgba(13, 39, 64, 0.18);
  color: var(--navy);
  cursor: pointer;
  font-family: Arial, sans-serif;
  font-size: 12px;
  font-weight: 800;
  padding: 8px 10px;
  text-transform: uppercase;
}

.rich-toolbar button:hover,
.rich-toolbar select:hover {
  border-color: var(--sea);
  color: var(--sea);
}

.upload-preview {
  align-items: center;
  background: rgba(13, 39, 64, 0.04);
  border: 1px solid var(--line);
  display: grid;
  gap: 18px;
  grid-template-columns: 130px minmax(0, 1fr);
  padding: 16px;
}

.upload-preview img,
.empty-preview {
  aspect-ratio: 3 / 4;
  background: #fffaf0;
  border: 1px solid rgba(13, 39, 64, 0.16);
  display: grid;
  object-fit: cover;
  place-items: center;
  text-align: center;
  width: 130px;
}

.upload-preview img {
  object-fit: contain;
}

.upload-preview video {
  background: #071623;
  border: 1px solid rgba(13, 39, 64, 0.16);
  display: block;
  max-height: 220px;
  width: 100%;
}

.video-upload-preview {
  grid-template-columns: minmax(220px, 360px) minmax(0, 1fr);
}

.empty-preview {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  padding: 12px;
  text-transform: none;
}

.upload-preview input[type="file"] {
  background: #fffaf0;
}

.upload-box {
  align-items: center;
  border: 1px dashed rgba(13, 39, 64, 0.28);
  display: grid;
  justify-items: center;
  min-height: 170px;
  padding: 24px;
  text-align: center;
}

.book-image-editor {
  align-items: center;
  background: rgba(13, 39, 64, 0.04);
  border: 1px solid var(--line);
  display: grid;
  gap: 18px;
  grid-template-columns: 120px minmax(0, 1fr);
  margin-top: 18px;
  padding: 16px;
}

.book-image-editor img {
  aspect-ratio: 3 / 4;
  background: var(--navy);
  display: block;
  object-fit: cover;
  width: 100%;
}

.book-image-editor .button {
  margin-top: 14px;
}

.message-list {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.message {
  border-left: 4px solid var(--brass);
  padding-left: 14px;
}

.footer-actions {
  border-top: 1px solid var(--line);
  margin-top: 22px;
  padding-top: 18px;
}

.list-stack {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.list-item {
  align-items: center;
  display: grid;
  gap: 14px;
  grid-template-columns: 72px minmax(0, 1fr) auto;
  padding: 14px;
}

.list-item img {
  aspect-ratio: 1;
  background: var(--navy);
  object-fit: cover;
  width: 72px;
}

.list-item small {
  color: var(--signal);
  display: block;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.list-item strong {
  color: var(--navy);
  display: block;
}

.preview-card {
  overflow: hidden;
}

.preview-card img {
  aspect-ratio: 4 / 3;
  display: block;
  object-fit: cover;
  width: 100%;
}

.preview-body {
  padding: 20px;
}

.embed-preview {
  aspect-ratio: 16 / 9;
  background: linear-gradient(135deg, var(--navy), var(--harbor));
  color: var(--foam);
  display: grid;
  place-items: center;
  text-align: center;
}

.embed-preview strong {
  border: 2px solid rgba(249, 246, 239, 0.72);
  border-radius: 999px;
  padding: 20px 24px;
}

.inbox-layout {
  display: grid;
  gap: 22px;
  grid-template-columns: 360px minmax(0, 1fr);
}

.message-row {
  background: rgba(249, 246, 239, 0.9);
  border: 1px solid var(--line);
  padding: 16px;
}

.message-row[aria-current="true"] {
  border-left: 5px solid var(--brass);
}

.message-detail {
  background: rgba(249, 246, 239, 0.9);
  border: 1px solid var(--line);
  padding: 28px;
}

@media (max-width: 1050px) {
  .shell,
  .editor-layout,
  .component-grid,
  .inbox-layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    background-size: 190px;
  }

  .dashboard-grid,
  .quick-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 700px) {
  .dashboard-grid,
  .quick-actions,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .video-upload-preview {
    grid-template-columns: 1fr;
  }

  .topbar,
  .section-head,
  .footer-actions {
    align-items: flex-start;
    flex-direction: column;
  }
}
