:root {
  --paper: #f2f0e9;
  --white: #faf9f5;
  --ink: #151513;
  --muted: #6f6d66;
  --line: #c5c1b7;
  --error: #8f2f25;
  --success: #315f3b;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 15px/1.5 "DM Sans", Arial, sans-serif;
}

a { color: inherit; text-decoration: none; }
button, input, textarea { font: inherit; }

.admin-brand { display: inline-flex; align-items: center; gap: 11px; }
.admin-brand img { display: block; width: 34px; height: 34px; object-fit: contain; }
.admin-brand span { display: flex; flex-direction: column; }
.admin-brand strong { font: 400 1.35rem/1.05 "Newsreader", Georgia, serif; }
.admin-brand small { margin-top: 3px; color: var(--muted); font-size: .55rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; }
.admin-label { margin: 0; color: var(--muted); font-size: .7rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; }

form { display: flex; flex-direction: column; }
label { margin: 18px 0 7px; font-size: .8rem; font-weight: 500; }
input, textarea { width: 100%; border: 1px solid var(--line); border-radius: 0; background: var(--white); color: var(--ink); padding: 13px 14px; outline: none; }
input:focus, textarea:focus { border-color: var(--ink); }
button { margin-top: 22px; border: 1px solid var(--ink); border-radius: 0; background: var(--ink); color: white; padding: 13px 18px; cursor: pointer; }
button:hover { background: #33332f; }

.login-page { min-height: 100svh; }
.login-shell { min-height: 100svh; display: grid; grid-template-columns: 1fr 1fr; padding: 32px 3vw; }
.login-panel { width: min(100%, 480px); align-self: center; justify-self: center; }
.login-panel h1, .dashboard-title h1 { margin: 10px 0 0; font: 400 clamp(3.5rem, 7vw, 6.5rem)/.95 "Newsreader", Georgia, serif; }
.login-intro { margin: 20px 0 35px; color: var(--muted); }

.notice { padding: 13px 15px; border: 1px solid; margin: 0 0 22px; }
.notice-error { border-color: #bb817a; background: #f2e5e2; color: var(--error); }
.notice-success { border-color: #8cab93; background: #e7eee7; color: var(--success); }

.admin-header { min-height: 76px; display: flex; align-items: center; justify-content: space-between; padding: 0 3vw; border-bottom: 1px solid var(--line); }
.admin-header nav { display: flex; align-items: center; gap: 28px; }
.admin-header nav form { display: block; }
.text-button { margin: 0; border: 0; border-bottom: 1px solid; background: none; color: var(--ink); padding: 0; }

.dashboard { padding: 6rem 3vw; }
.dashboard-title { display: flex; align-items: flex-end; justify-content: space-between; gap: 30px; margin-bottom: 4rem; }
.dashboard-actions { display: flex; align-items: center; gap: 24px; }
.dashboard-actions p { margin: 0; color: var(--muted); }
.primary-action { display: flex; align-items: center; gap: 12px; margin: 0; padding: 11px 17px; }
.primary-action span { font-size: 1.25rem; line-height: 1; }

.manager-section { border-top: 1px solid var(--line); padding-top: 25px; }
.manager-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 30px; margin-bottom: 28px; }
.manager-heading h2 { margin: 6px 0 0; font: 400 2.6rem "Newsreader", Georgia, serif; }
.manager-heading > p { margin: 0 0 8px; color: var(--muted); }

.manager-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.manage-card { position: relative; min-width: 0; display: flex; flex-direction: column; margin: 0; padding: 0; border: 0; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--white); color: var(--ink); text-align: left; }
.manage-poster, .empty-poster { display: flex; width: 100%; aspect-ratio: 4/5; border-bottom: 1px solid var(--line); background: #e9e7df; }
.manage-poster img { display: block; width: 100%; height: 100%; object-fit: cover; }
.manage-info { min-height: 82px; display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding: 12px; }
.manage-info strong, .manage-info small { display: block; }
.manage-info strong { overflow: hidden; font-size: .85rem; text-overflow: ellipsis; white-space: nowrap; }
.manage-info small { margin-top: 3px; color: var(--muted); font-size: .68rem; }
.status-text { color: var(--muted); font-size: .62rem; text-transform: uppercase; }

.empty-card { cursor: pointer; }
.empty-card:hover { background: #f1efe8; color: var(--ink); }
.empty-poster { align-items: center; justify-content: center; flex-direction: column; gap: 10px; color: var(--muted); }
.plus-mark { font-size: 2.6rem; font-weight: 300; line-height: 1; color: var(--ink); }
.empty-poster > span:last-child { font-size: .72rem; }

.card-delete { position: absolute; right: 10px; bottom: 9px; display: block; }
.card-delete input { display: none; }
.delete-button { margin: 0; border-color: var(--line); background: transparent; color: var(--error); padding: 4px 7px; font-size: .64rem; }
.delete-button:hover { background: #eee2df; }

.field-help { margin: 6px 0 0; color: var(--muted); font-size: .72rem; }
.field-row { display: grid; grid-template-columns: 1fr 120px; gap: 14px; }
.checkbox { display: flex; align-items: center; gap: 10px; font-weight: 400; }
.checkbox input { width: 16px; height: 16px; }

.upload-dialog { width: min(680px, calc(100% - 36px)); max-height: 92svh; padding: 0; border: 1px solid var(--line); background: var(--paper); color: var(--ink); }
.upload-dialog::backdrop { background: rgba(20,20,18,.68); }
.dialog-header { position: sticky; z-index: 2; top: 0; display: flex; align-items: flex-start; justify-content: space-between; padding: 25px 28px; border-bottom: 1px solid var(--line); background: var(--paper); }
.dialog-header h2 { margin: 5px 0 0; font: 400 2.5rem "Newsreader", Georgia, serif; }
.dialog-close { margin: 0; border: 0; border-bottom: 1px solid var(--ink); background: none; color: var(--ink); padding: 1px 0; font-size: .75rem; }
.upload-dialog > form { padding: 10px 28px 28px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; }
.dialog-actions button { margin: 0; }
.secondary-button { border-color: var(--line); background: transparent; color: var(--ink); }
.secondary-button:hover { background: #e8e6df; }

@media (max-width: 900px) {
  .manager-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .login-shell { display: block; padding: 24px 18px; }
  .login-panel { margin: 20vh auto 0; }
  .admin-header { padding: 0 18px; }
  .admin-brand { gap: 8px; }
  .admin-brand img { width: 29px; height: 29px; }
  .admin-brand strong { font-size: 1.1rem; }
  .admin-header nav { gap: 15px; font-size: .75rem; }
  .dashboard { padding: 4rem 18px; }
  .dashboard-title { display: block; }
  .dashboard-actions { align-items: flex-start; justify-content: space-between; margin-top: 20px; }
  .primary-action { padding: 9px 12px; font-size: .74rem; }
  .manager-heading { display: block; }
  .manager-heading > p { margin-top: 10px; }
  .manager-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .manage-info { min-height: 76px; padding: 9px; }
  .manage-info strong { font-size: .7rem; }
  .manage-info small { font-size: .58rem; }
  .status-text { font-size: .52rem; }
  .card-delete { right: 7px; bottom: 7px; }
  .field-row { grid-template-columns: 1fr; }
  .dialog-header { padding: 20px 18px; }
  .upload-dialog > form { padding: 8px 18px 22px; }
}
