:root {
  color-scheme: light;
  --canvas: #f5f7fb;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --surface-tint: #f0f3ff;
  --ink: #172033;
  --ink-soft: #334155;
  --muted: #667085;
  --muted-light: #8791a3;
  --line: #e3e8f0;
  --line-strong: #cfd7e4;
  --primary: #4257d6;
  --primary-strong: #3045be;
  --primary-soft: #edf0ff;
  --success: #16704c;
  --success-soft: #eaf8f1;
  --warning: #9b6418;
  --warning-soft: #fff6df;
  --danger: #ad414a;
  --danger-soft: #fff0f1;
  --shadow-sm: 0 2px 8px rgb(23 32 51 / 5%);
  --shadow-md: 0 14px 35px rgb(23 32 51 / 9%);
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 22px;
  --focus: 0 0 0 4px rgb(66 87 214 / 18%);
  /* shadcn/ui-compatible semantic aliases for the light theme. */
  --background: var(--canvas);
  --foreground: var(--ink);
  --card: var(--surface);
  --card-foreground: var(--ink);
  --border: var(--line);
  --input: var(--line-strong);
  --muted-foreground: var(--muted);
  --ring: var(--primary);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-width: 320px;
  background: var(--canvas);
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.5;
  text-rendering: optimizeLegibility;
}

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

button,
select,
input[type="checkbox"],
input[type="radio"] {
  cursor: pointer;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
dialog:focus-visible {
  outline: 0;
  box-shadow: var(--focus);
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  border: 0;
}

.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;
}

.brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 11px;
  background: var(--primary);
  color: #fff;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.04em;
  box-shadow: 0 5px 12px rgb(66 87 214 / 24%);
}

.brand-name {
  color: var(--ink);
  font-size: 17px;
  font-weight: 750;
  letter-spacing: -0.025em;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--primary);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
  line-height: 1.2;
}

.button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 16px;
  border-radius: 11px;
  font-size: 14px;
  font-weight: 700;
  transition: background-color 150ms ease-out, color 150ms ease-out, box-shadow 150ms ease-out, transform 150ms ease-out;
}

.button:hover {
  transform: translateY(-1px);
}

.button:active {
  transform: translateY(0);
}

.button-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 5px 14px rgb(66 87 214 / 18%);
}

.button-primary:hover {
  background: var(--primary-strong);
  box-shadow: 0 8px 18px rgb(66 87 214 / 24%);
}

.button-quiet {
  background: transparent;
  color: var(--muted);
}

.button-quiet:hover {
  background: #eef1f6;
  color: var(--ink);
}

.button-outline {
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink-soft);
}

.button-outline:hover {
  border-color: #b9c4ef;
  background: var(--primary-soft);
  color: var(--primary-strong);
}

.button-large {
  min-height: 50px;
  width: 100%;
  font-size: 15px;
}

.button-plus {
  font-size: 22px;
  font-weight: 400;
  line-height: 0.7;
}

.login-page {
  display: grid;
  min-height: 100vh;
  padding: 24px;
  place-items: center;
  background:
    radial-gradient(circle at 10% 10%, rgb(66 87 214 / 8%), transparent 32%),
    var(--canvas);
}

.login-card {
  width: min(100%, 430px);
  padding: 40px;
  border: 1px solid var(--line);
  border-radius: 25px;
  background: var(--surface);
  box-shadow: var(--shadow-md);
}

.login-card .brand-lockup {
  margin-bottom: 32px;
}

.login-card h1 {
  max-width: 320px;
  margin: 0;
  color: var(--ink);
  font-size: clamp(28px, 5vw, 34px);
  letter-spacing: -0.055em;
  line-height: 1.05;
}

.login-copy {
  margin: 16px 0 28px;
  color: var(--muted);
  line-height: 1.65;
}

.stack-form {
  display: grid;
  gap: 16px;
}

.login-footnote {
  margin: 22px 0 0;
  color: var(--muted-light);
  font-size: 12px;
  text-align: center;
}

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

.topbar {
  display: flex;
  min-height: 72px;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(20px, 5vw, 72px);
  border-bottom: 1px solid rgb(227 232 240 / 75%);
  background: rgb(255 255 255 / 82%);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.private-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 3px var(--success-soft);
}

.page-shell {
  width: min(100% - 40px, 1180px);
  margin: 0 auto;
  padding: 58px 0 80px;
}

.dashboard-intro {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 34px;
}

.dashboard-intro h1 {
  margin: 0;
  color: var(--ink);
  font-size: clamp(30px, 4vw, 46px);
  letter-spacing: -0.06em;
  line-height: 1.05;
}

.page-lede {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 16px;
}

.papers-section {
  min-width: 0;
}

.section-heading-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 18px;
}

.section-heading-row h2 {
  margin: 0;
  font-size: 22px;
  letter-spacing: -0.035em;
}

.section-caption {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

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

.search-field,
.select-wrap {
  position: relative;
  display: inline-flex;
  min-height: 42px;
  align-items: center;
}

.search-field {
  width: 190px;
}

.search-icon {
  position: absolute;
  left: 12px;
  color: var(--muted-light);
  font-size: 21px;
  line-height: 1;
  transform: translateY(-1px) rotate(-20deg);
}

.search-field input,
.select-wrap select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink-soft);
  font-size: 13px;
}

.search-field input {
  padding: 0 12px 0 34px;
}

.select-wrap select {
  padding: 0 30px 0 12px;
}

.search-field input::placeholder {
  color: var(--muted-light);
}

.papers-list {
  display: grid;
  gap: 10px;
}

.paper-card {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(220px, 0.7fr) auto;
  width: 100%;
  min-height: 116px;
  align-items: center;
  gap: 22px;
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  text-align: left;
  appearance: none;
  transition: border-color 180ms ease-out, box-shadow 180ms ease-out, transform 180ms ease-out;
}

.paper-card:hover {
  border-color: #c8d1f6;
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.paper-card:focus-visible {
  outline: 0;
  box-shadow: var(--focus);
}

.paper-card-main {
  min-width: 0;
}

.paper-card-title {
  display: -webkit-box;
  overflow: hidden;
  margin: 0;
  color: var(--ink);
  font-size: 16px;
  font-weight: 750;
  letter-spacing: -0.025em;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.paper-card-journal {
  overflow: hidden;
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.paper-card-meta,
.paper-card-side {
  display: flex;
  align-items: center;
  gap: 8px;
}

.paper-card-meta {
  flex-wrap: wrap;
}

.paper-card-side {
  justify-content: flex-end;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.tag,
.status-badge {
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 750;
  line-height: 1;
}

.tag {
  background: var(--primary-soft);
  color: var(--primary-strong);
}

.status-badge {
  background: #f0f2f6;
  color: var(--ink-soft);
}

.status-badge.status-preparando,
.status-badge.status-enviado {
  background: #eef2ff;
  color: #3c4fab;
}

.status-badge.status-atendiendo-revisores {
  background: var(--warning-soft);
  color: var(--warning);
}

.status-badge.status-aceptado,
.status-badge.status-publicado {
  background: var(--success-soft);
  color: var(--success);
}

.status-badge.status-rechazado {
  background: var(--danger-soft);
  color: var(--danger);
}

.deadline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.deadline-icon {
  color: var(--muted-light);
  font-size: 15px;
}

.deadline.is-soon {
  color: var(--warning);
  font-weight: 700;
}

.deadline.is-overdue {
  color: var(--danger);
  font-weight: 700;
}

.empty-state {
  display: grid;
  min-height: 260px;
  padding: 36px 24px;
  place-items: center;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-lg);
  background: rgb(255 255 255 / 55%);
  text-align: center;
}

.empty-state-icon {
  display: grid;
  width: 54px;
  height: 54px;
  margin: 0 auto 15px;
  place-items: center;
  border-radius: 17px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 24px;
}

.empty-state h3 {
  margin: 0;
  font-size: 18px;
  letter-spacing: -0.03em;
}

.empty-state p {
  max-width: 360px;
  margin: 7px auto 18px;
  color: var(--muted);
  font-size: 13px;
}

.loading-state {
  padding: 44px 20px;
  color: var(--muted);
  text-align: center;
}

.dialog {
  width: min(calc(100% - 32px), 760px);
  max-height: min(90vh, 900px);
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: 0 24px 80px rgb(23 32 51 / 22%);
}

.dialog::backdrop {
  background: rgb(23 32 51 / 35%);
  backdrop-filter: blur(3px);
}

.dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 28px 30px 20px;
  border-bottom: 1px solid var(--line);
}

.dialog-header h2 {
  max-width: 620px;
  margin: 0;
  font-size: 24px;
  letter-spacing: -0.04em;
  line-height: 1.18;
}

.icon-button {
  display: grid;
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-size: 26px;
  font-weight: 300;
  line-height: 1;
}

.icon-button:hover {
  background: #f0f2f6;
  color: var(--ink);
}

fieldset {
  min-width: 0;
  padding: 25px 0 5px;
  border: 0;
  border-bottom: 1px solid var(--line);
}

fieldset:last-of-type {
  border-bottom: 0;
}

legend {
  padding: 0;
  color: var(--ink);
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.field {
  display: grid;
  gap: 7px;
  margin-bottom: 17px;
}

.field-wide {
  margin-top: 17px;
}

.field label {
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 700;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 44px;
  padding: 9px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  outline: 0;
  background: var(--surface);
  color: var(--ink);
  transition: border-color 150ms ease-out, box-shadow 150ms ease-out;
}

.field textarea {
  min-height: 120px;
  resize: vertical;
}

.field input::placeholder,
.field textarea::placeholder {
  color: var(--muted-light);
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--primary);
  box-shadow: var(--focus);
}

.form-grid {
  display: grid;
  gap: 16px;
}

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

.field-help,
.optional-label {
  margin: 0;
  color: var(--muted-light);
  font-size: 12px;
  font-weight: 500;
}

.optional-label {
  margin-left: 4px;
  font-weight: 500;
}

.required-mark {
  color: var(--danger);
}

.form-error {
  min-height: 18px;
  margin: 4px 0 0;
  color: var(--danger);
  font-size: 13px;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 24px;
}

.paper-editor-view {
  min-height: calc(100vh - 72px);
  background: var(--canvas);
}

.editor-shell {
  width: min(100% - 40px, 1180px);
  margin: 0 auto;
  padding: 42px 0 70px;
}

.editor-heading {
  margin-bottom: 28px;
}

.back-link {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  margin-bottom: 24px;
  padding: 0;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.back-link:hover {
  color: var(--primary-strong);
}

.editor-heading h1 {
  margin: 0;
  color: var(--ink);
  font-size: clamp(30px, 4vw, 44px);
  letter-spacing: -0.06em;
  line-height: 1.05;
}

.paper-form-page {
  display: grid;
  gap: 24px;
}

.paper-editor-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(280px, 0.75fr);
  gap: 24px;
  align-items: start;
}

.paper-editor-main,
.paper-editor-aside {
  display: grid;
  gap: 24px;
  min-width: 0;
}

.paper-form-page fieldset {
  margin: 0;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.paper-form-page fieldset:last-of-type {
  border-bottom: 1px solid var(--line);
}

.paper-form-page .field-wide {
  margin-top: 20px;
}

.paper-form-page .field:last-child {
  margin-bottom: 6px;
}

.paper-editor-aside fieldset,
.paper-editor-aside .field,
.paper-editor-aside textarea {
  height: 100%;
}

.paper-editor-aside textarea {
  min-height: 280px;
}

.paper-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 0 0;
  border-top: 1px solid var(--line);
}

.dialog-detail {
  width: min(calc(100% - 32px), 940px);
}

.detail-content {
  max-height: 90vh;
  overflow-y: auto;
}

.detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 22px;
  padding: 30px;
  border-bottom: 1px solid var(--line);
}

.detail-header h2 {
  max-width: 690px;
  margin: 0;
  font-size: clamp(22px, 3vw, 31px);
  letter-spacing: -0.055em;
  line-height: 1.12;
}

.detail-header-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.detail-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
}

.detail-body {
  padding: 26px 30px 32px;
}

.detail-overview {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 28px;
}

.overview-card {
  min-height: 88px;
  padding: 14px 15px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface-soft);
}

.overview-label {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.overview-value {
  display: block;
  margin-top: 8px;
  color: var(--ink);
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.detail-columns {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(250px, 0.7fr);
  gap: 24px;
}

.detail-section {
  min-width: 0;
  margin-bottom: 26px;
}

.detail-section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.detail-section h3 {
  margin: 0;
  font-size: 16px;
  letter-spacing: -0.025em;
}

.detail-section-copy {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
  white-space: pre-wrap;
}

.detail-metadata {
  display: grid;
  gap: 10px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-soft);
}

.metadata-row {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  color: var(--muted);
  font-size: 12px;
}

.metadata-row strong {
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 700;
  text-align: right;
}

.authors-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
}

.authors-table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
}

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

.authors-table th {
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.authors-table tr:last-child td {
  border-bottom: 0;
}

.author-position {
  color: var(--muted-light);
  font-size: 12px;
  font-weight: 800;
}

.author-name-cell strong {
  display: block;
  color: var(--ink);
  font-size: 13px;
}

.author-name-cell span {
  display: block;
  overflow: hidden;
  max-width: 230px;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.corresponding-badge,
.payment-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 750;
}

.corresponding-badge {
  padding: 5px 8px;
  background: var(--primary-soft);
  color: var(--primary-strong);
}

.payment-badge {
  padding: 5px 8px;
  background: var(--danger-soft);
  color: var(--danger);
}

.payment-badge.is-paid {
  background: var(--success-soft);
  color: var(--success);
}

.payment-action {
  cursor: pointer;
  font: inherit;
}

.payment-action:hover {
  filter: brightness(0.96);
}

.payment-action:disabled {
  cursor: wait;
  opacity: 0.65;
}

.task-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.task-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface);
}

.task-item input[type="checkbox"] {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  margin: 1px 0 0;
  accent-color: var(--primary);
}

.task-title {
  flex: 1;
  color: var(--ink-soft);
  font-size: 13px;
}

.task-item.is-complete .task-title {
  color: var(--muted-light);
  text-decoration: line-through;
}

.task-delete {
  display: grid;
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 8px;
  background: transparent;
  color: var(--muted-light);
}

.task-delete:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

.task-add-form {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.task-add-form input {
  min-width: 0;
  min-height: 42px;
  flex: 1;
  padding: 8px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
}

.task-add-form button {
  min-width: 42px;
  min-height: 42px;
  padding: 0 12px;
  border-radius: 10px;
  background: var(--primary-soft);
  color: var(--primary-strong);
  font-size: 18px;
  font-weight: 700;
}

.task-add-form button:hover {
  background: #dfe4ff;
}

.empty-inline {
  padding: 14px;
  border: 1px dashed var(--line-strong);
  border-radius: 11px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.author-editor {
  display: grid;
  gap: 10px;
}

.author-row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1.35fr) minmax(0, 1fr) 68px 68px;
  gap: 8px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-soft);
}

.author-row .move-controls {
  display: grid;
  grid-column: 1;
  grid-row: 1 / span 2;
  gap: 3px;
}

.author-row [data-field="name"] {
  grid-column: 2;
  grid-row: 1;
}

.author-row [data-field="email"] {
  grid-column: 3;
  grid-row: 1;
}

.author-row [data-field="institution"] {
  grid-column: 2;
  grid-row: 2;
}

.author-row [data-field="orcid"] {
  grid-column: 3;
  grid-row: 2;
}

.author-row [data-field="paid_at"] {
  grid-column: 4;
  grid-row: 2;
}

.author-row .compact-label[data-label="corresponding"] {
  grid-column: 4;
  grid-row: 1;
}

.author-row .compact-label[data-label="paid"] {
  grid-column: 5;
  grid-row: 1;
}

.mini-button {
  display: grid;
  width: 28px;
  height: 24px;
  place-items: center;
  border-radius: 6px;
  background: var(--surface);
  color: var(--muted);
  font-size: 14px;
  line-height: 1;
}

.mini-button:hover {
  background: var(--primary-soft);
  color: var(--primary-strong);
}

.author-row input[type="text"],
.author-row input[type="email"],
.author-row input[type="date"] {
  width: 100%;
  min-height: 38px;
  padding: 6px 8px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font-size: 12px;
}

.author-row .compact-label {
  display: grid;
  min-height: 38px;
  place-items: center;
  gap: 2px;
  color: var(--muted);
  font-size: 10px;
  text-align: center;
}

.author-row .compact-label input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--primary);
}

.author-row .remove-author {
  grid-column: 5;
  grid-row: 2;
  color: var(--danger);
}

.author-row .remove-author:hover {
  background: var(--danger-soft);
}

.author-editor-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
}

.author-editor-actions-right {
  display: flex;
  gap: 10px;
}

.detail-note {
  padding: 15px 16px;
  border-left: 3px solid #cbd3fa;
  border-radius: 0 12px 12px 0;
  background: var(--surface-tint);
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 10;
  max-width: min(360px, calc(100% - 44px));
  padding: 12px 15px;
  border: 1px solid #bedfce;
  border-radius: 11px;
  background: var(--success-soft);
  box-shadow: var(--shadow-md);
  color: var(--success);
  font-size: 13px;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 180ms ease-out, transform 180ms ease-out;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 900px) {
  .paper-card {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .paper-card-meta {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .paper-card-side {
    grid-column: 2;
    grid-row: 1;
  }

  .author-row {
    grid-template-columns: 28px minmax(0, 1.35fr) minmax(0, 1fr) 68px 68px;
  }

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

  .paper-editor-grid {
    grid-template-columns: 1fr;
  }

  .paper-editor-aside textarea {
    min-height: 180px;
  }
}

@media (max-width: 680px) {
  .topbar {
    min-height: 64px;
    padding: 0 16px;
  }

  .private-pill {
    display: none;
  }

  .page-shell {
    width: min(100% - 28px, 1180px);
    padding-top: 38px;
  }

  .editor-shell {
    width: min(100% - 28px, 1180px);
    padding-top: 32px;
  }

  .dashboard-intro,
  .section-heading-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .dashboard-intro {
    margin-bottom: 28px;
  }

  .dashboard-intro .button {
    width: 100%;
  }

  .paper-form-page fieldset {
    padding: 20px 18px;
  }

  .paper-form-actions {
    flex-direction: column-reverse;
  }

  .paper-form-actions .button {
    width: 100%;
  }

  .toolbar {
    width: 100%;
    flex-wrap: wrap;
  }

  .search-field {
    width: 100%;
  }

  .select-wrap {
    flex: 1;
  }

  .paper-card {
    gap: 12px;
    padding: 17px;
  }

  .paper-card-side {
    display: block;
    text-align: right;
    white-space: normal;
  }

  .paper-card-side .deadline {
    justify-content: flex-end;
  }

  .login-card {
    padding: 30px 24px;
  }

  .login-card .brand-lockup {
    margin-bottom: 34px;
  }

  .dialog {
    width: calc(100% - 18px);
    max-height: calc(100vh - 18px);
    border-radius: 18px;
  }

  .dialog-header,
  .detail-header {
    padding: 22px 18px 17px;
  }

  .paper-form,
  .detail-body {
    padding-right: 18px;
    padding-left: 18px;
  }

  .paper-form {
    max-height: calc(100vh - 90px);
  }

  .two-columns,
  .detail-overview {
    grid-template-columns: 1fr 1fr;
  }

  .detail-overview {
    gap: 7px;
  }

  .overview-card {
    min-height: 76px;
    padding: 11px;
  }

  .overview-value {
    font-size: 14px;
  }

  .detail-header {
    display: block;
  }

  .detail-actions {
    margin-top: 17px;
  }

  .detail-actions .button {
    flex: 1;
  }

  .author-row {
    grid-template-columns: 32px minmax(0, 1fr) 78px 74px;
  }

  .author-row .move-controls {
    grid-column: 1;
    grid-row: 1 / span 4;
  }

  .author-row [data-field="name"] {
    grid-column: 2;
    grid-row: 1;
  }

  .author-row [data-field="email"],
  .author-row [data-field="institution"],
  .author-row [data-field="orcid"],
  .author-row [data-field="paid_at"] {
    grid-column: 2 / -1;
  }

  .author-row [data-field="email"] { grid-row: 2; }
  .author-row [data-field="institution"] { grid-row: 3; }
  .author-row [data-field="orcid"] { grid-row: 4; }
  .author-row [data-field="paid_at"] { grid-row: 5; }

  .author-row .compact-label[data-label="corresponding"] {
    grid-column: 3;
    grid-row: 1;
  }

  .author-row .compact-label[data-label="paid"] {
    grid-column: 4;
    grid-row: 1;
  }

  .author-row .remove-author {
    grid-column: 4;
    grid-row: 5;
  }

  .author-editor-actions {
    flex-direction: column;
  }

  .author-editor-actions .button {
    width: 100%;
  }
}

@media (max-width: 420px) {
  .two-columns,
  .detail-overview {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Paper detail workspace: a page-level shadcn/ui-style layout, never a nested dialog. */
.paper-detail-view {
  min-height: calc(100vh - 72px);
  background: var(--background);
}

.detail-page-shell {
  width: min(100% - 40px, 1180px);
  margin: 0 auto;
  padding: 30px 0 76px;
  overflow: visible;
}

.detail-page-inner {
  min-width: 0;
}

.detail-page-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.detail-page-nav .back-link {
  margin-bottom: 0;
}

.detail-page-header {
  padding: 0 0 26px;
  border-bottom: 1px solid var(--border);
}

.detail-page-header .detail-header-meta {
  margin-top: 0;
}

.detail-page-header h1 {
  max-width: 900px;
  margin: 14px 0 0;
  color: var(--foreground);
  font-size: clamp(30px, 4.5vw, 48px);
  letter-spacing: -0.06em;
  line-height: 1.06;
  overflow-wrap: anywhere;
}

.detail-subtitle {
  margin: 10px 0 0;
  color: var(--muted-foreground);
  font-size: 14px;
}

.paper-detail-view .detail-overview {
  margin: 24px 0 20px;
}

.paper-detail-view .overview-card {
  min-height: 82px;
  background: var(--card);
  box-shadow: var(--shadow-sm);
}

.paper-detail-view .detail-columns {
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, 0.75fr);
  gap: 20px;
  align-items: start;
}

.detail-main-column,
.detail-sidebar {
  display: grid;
  min-width: 0;
  gap: 20px;
}

.detail-card {
  margin: 0;
  padding: 21px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--card);
  box-shadow: var(--shadow-sm);
}

.paper-detail-view .detail-section {
  margin-bottom: 0;
}

.detail-card .detail-section-heading {
  margin-bottom: 16px;
}

.detail-card .detail-section-heading .button {
  min-height: 34px;
  padding: 0 10px;
  font-size: 12px;
}

.detail-card .detail-metadata {
  border-color: var(--border);
  background: var(--surface-soft);
}

.detail-card .metadata-row strong {
  max-width: 64%;
  overflow-wrap: anywhere;
}

.authors-list {
  display: grid;
  gap: 10px;
}

.author-item {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  gap: 13px;
  align-items: center;
  padding: 13px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-soft);
}

.author-info {
  min-width: 0;
}

.author-name-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
}

.author-name-line strong {
  color: var(--foreground);
  font-size: 14px;
  line-height: 1.3;
}

.author-meta-line {
  display: block;
  overflow: hidden;
  margin-top: 3px;
  color: var(--muted-foreground);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.author-payment {
  display: grid;
  justify-items: end;
  gap: 3px;
  min-width: 106px;
  text-align: right;
}

.author-payment small,
.author-payment-date {
  color: var(--muted-foreground);
  font-size: 11px;
}

.task-title {
  overflow-wrap: anywhere;
}

.detail-error-state {
  width: min(100%, 520px);
  margin: 10vh auto 0;
  padding: 28px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--card);
  box-shadow: var(--shadow-sm);
  text-align: center;
}

.detail-error-state h2 {
  margin: 0;
  font-size: 20px;
  letter-spacing: -0.03em;
}

.detail-error-state p {
  margin: 8px 0 20px;
  color: var(--muted-foreground);
  font-size: 13px;
}

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

@media (max-width: 680px) {
  .detail-page-shell {
    width: min(100% - 28px, 1180px);
    padding: 26px 0 56px;
  }

  .detail-page-nav {
    margin-bottom: 20px;
  }

  .detail-page-nav .button-outline {
    min-height: 38px;
    padding: 0 12px;
  }

  .detail-page-header {
    padding-bottom: 20px;
  }

  .detail-page-header h1 {
    margin-top: 12px;
    font-size: clamp(28px, 8vw, 38px);
  }

  .paper-detail-view .detail-overview {
    gap: 8px;
    margin: 18px 0 14px;
  }

  .paper-detail-view .overview-card {
    min-height: 72px;
    padding: 12px;
  }

  .detail-card {
    padding: 17px;
  }

  .author-item {
    grid-template-columns: 24px minmax(0, 1fr);
    gap: 10px;
    padding: 12px;
  }

  .author-payment {
    grid-column: 2;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
    gap: 7px;
    min-width: 0;
    text-align: left;
  }

  .detail-metadata {
    gap: 12px;
  }

  .metadata-row {
    display: grid;
    gap: 2px;
  }

  .detail-card .metadata-row strong {
    max-width: none;
    text-align: left;
  }
}
