:root {
  --ink: #302b27;
  --muted: #6d6761;
  --paper: #f8f7f4;
  --surface: #fff;
  --line: #e7e1da;
  --teal: #79553a;
  --teal-dark: #573c2b;
  --brass: #956c43;
  --brass-light: #d4b895;
  --accent: #ad7952;
  --shadow: 0 8px 24px rgba(48, 43, 39, .05);
  --bs-primary: #79553a;
  --bs-primary-rgb: 121, 85, 58;
}

html { scroll-padding-top: 82px; }
body { background: var(--paper); }
a { color: var(--teal); }
a:hover { color: var(--teal-dark); }
.app-shell { display: block; min-height: 100vh; }
.skip-link { position: fixed; top: -60px; left: 16px; z-index: 2000; padding: 8px 13px; color: #fff; background: var(--teal-dark); }
.skip-link:focus { top: 8px; color: #fff; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 1030;
  min-height: 70px;
  padding: 0 clamp(18px, 3vw, 50px);
  border: 0;
  background: #302923;
  color: #fff;
}
.site-header-inner { display: flex; align-items: center; gap: clamp(18px, 2.4vw, 36px); width: min(100%, 1520px); min-height: 70px; margin: auto; }
.brand, .brand:hover { color: #fff; }
.brand { flex: 0 0 auto; gap: 10px; }
.brand-mark { width: 35px; height: 35px; border-radius: 5px; color: #35291f; background: #d0ae84; font-size: 18px; }
.brand-copy strong { font-size: 15px; }
.brand-copy small { color: #cbbeb0; }
.top-nav { align-self: stretch; align-items: stretch; gap: clamp(8px, 1.2vw, 20px); min-width: 0; }
.top-nav a { display: flex; align-items: center; padding: 0 5px; border-bottom: 2px solid transparent; color: #e5ddd5; font-size: 13px; font-weight: 600; text-decoration: none; white-space: nowrap; }
.top-nav a:hover, .top-nav a.active { color: #fff; }
.top-nav a.active { border-bottom-color: #d4b895; }
.header-actions { gap: 12px; min-width: 0; margin-left: auto; }
.header-search, .mobile-search { align-items: center; height: 38px; min-width: 0; border: 1px solid rgba(255, 255, 255, .2); border-radius: 5px; background: rgba(255, 255, 255, .09); }
.header-search { width: clamp(170px, 16vw, 235px); }
.header-search input, .mobile-search input { width: 100%; min-width: 0; padding: 0 0 0 12px; border: 0; outline: 0; color: #fff; background: transparent; font-size: 12px; }
.header-search input::placeholder { color: #c8bfb5; }
.header-search button, .mobile-search button { display: grid; place-items: center; flex: 0 0 36px; height: 36px; border: 0; color: #e5d3bf; background: transparent; }
.header-search:focus-within { outline: 2px solid #d4b895; outline-offset: 2px; }
.account-menu-button { display: flex; align-items: center; gap: 8px; max-width: 190px; padding: 0; border: 0; color: #fff; background: transparent; font-size: 12px; }
.account-menu-button::after { margin-left: 0; }
.account-menu-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.header-avatar { width: 34px; height: 34px; color: #3e3024; background: #d5ba95; text-decoration: none; }
.account-dropdown { min-width: 185px; }
.account-dropdown .dropdown-item { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.account-dropdown .dropdown-item:active { background: var(--teal); }
.mobile-menu-button { display: grid; place-items: center; width: 38px; height: 38px; border: 1px solid #7c6b5d; border-radius: 5px; color: #fff; background: transparent; font-size: 23px; }
.mobile-drawer { --bs-offcanvas-width: min(310px, 88vw); background: #faf8f5; }
.mobile-drawer .offcanvas-header { padding: 22px 20px 15px; border-bottom: 1px solid var(--line); color: var(--ink); }
.mobile-drawer .offcanvas-body { display: flex; flex-direction: column; padding: 20px; }
.mobile-search { display: flex; flex: 0 0 auto; border-color: #d8cabb; background: #fff; }
.mobile-search input { color: var(--ink); }
.mobile-search input::placeholder { color: #92877d; }
.mobile-search button { color: var(--teal); }
.mobile-nav { display: grid; gap: 3px; margin-top: 20px; }
.mobile-nav a, .mobile-account-link { display: flex; align-items: center; gap: 13px; min-height: 43px; padding: 8px 11px; border: 0; border-radius: 5px; color: var(--ink); background: transparent; font-size: 14px; font-weight: 600; text-decoration: none; text-align: left; }
.mobile-nav a i, .mobile-account-link i { width: 19px; color: var(--teal); font-size: 17px; }
.mobile-nav a:hover, .mobile-nav a.active, .mobile-account-link:hover { background: #eee5d9; color: var(--teal-dark); }
.mobile-nav-label { padding: 24px 11px 5px; color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; }
.mobile-account { display: flex; align-items: center; gap: 10px; margin-top: auto; padding: 24px 10px 13px; }
.mobile-account span:last-child { display: grid; min-width: 0; }
.mobile-account strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.mobile-account small { color: var(--muted); font-size: 12px; }
.mobile-account-link { width: 100%; }

.contribution-layout { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(280px, .8fr); gap: 18px; align-items: start; }
.contribution-form .card-body, .contribution-history .card-body { padding: clamp(20px, 2.5vw, 30px); }
.contact-overview { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(280px, .8fr); gap: clamp(32px, 5vw, 80px); max-width: 1100px; margin-top: 26px; }
.contact-overview h2 { margin: 0 0 18px; color: var(--ink); font-size: 22px; }
.contact-overview p { color: var(--muted); line-height: 1.7; }
.contact-about p { max-width: 68ch; }
.contact-details { min-width: 0; padding-left: clamp(24px, 3vw, 44px); border-left: 1px solid var(--line); }
.contact-details .eyebrow { display: block; margin-bottom: 12px; }
.contact-email { display: inline-flex; align-items: flex-start; gap: 10px; margin-top: 12px; font-weight: 600; overflow-wrap: anywhere; }
.contact-email i { flex: 0 0 auto; }
.submission-list, .review-list { display: grid; gap: 14px; }
.submission-item { display: grid; gap: 5px; padding: 13px 0; border-top: 1px solid var(--line); }
.submission-item:first-child { border-top: 0; padding-top: 0; }
.submission-item > div:first-child { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.submission-status { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: 13px; }
.status-pill { display: inline-flex; align-items: center; padding: 3px 9px; border-radius: 4px; font-size: 11px; font-weight: 700; text-transform: uppercase; }
.status-pending { color: #795319; background: #f7ebcf; }
.status-approved { color: #226148; background: #deefe5; }
.status-rejected { color: #8b3b35; background: #f8e4e1; }
.review-card .card-body { padding: clamp(18px, 2vw, 26px); }
.review-heading, .review-component-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.review-components { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; margin-top: 20px; }
.review-component { min-width: 0; padding-top: 14px; border-top: 1px solid var(--line); }
.review-component h3 { margin: 0; font-size: 15px; font-weight: 700; }
.review-text { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 320px; overflow: auto; font-size: 14px; line-height: 1.55; }
.review-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }

@media (max-width: 1599.98px) {
  .top-nav, .header-search, .header-actions .dropdown { display: none !important; }
  .mobile-menu-button { display: grid !important; }
}
@media (max-width: 900px) {
  .contribution-layout, .review-components, .contact-overview { grid-template-columns: minmax(0, 1fr); }
  .contact-details { padding: 24px 0 0; border-left: 0; border-top: 1px solid var(--line); }
}

.content-wrap { width: min(100%, 1520px); padding: 28px clamp(18px, 3vw, 50px) 72px; }
.card, .modal-content, .dropdown-menu { box-shadow: var(--shadow) !important; }
.btn-primary { --bs-btn-bg: var(--teal); --bs-btn-border-color: var(--teal); --bs-btn-hover-bg: var(--teal-dark); --bs-btn-hover-border-color: var(--teal-dark); --bs-btn-active-bg: var(--teal-dark); --bs-btn-active-border-color: var(--teal-dark); }
.btn-outline-primary { --bs-btn-color: var(--teal); --bs-btn-border-color: #b9a28b; --bs-btn-hover-bg: var(--teal); --bs-btn-hover-border-color: var(--teal); }
.btn-outline-secondary { --bs-btn-color: #625b54; --bs-btn-border-color: #c8beb3; --bs-btn-hover-bg: #625b54; --bs-btn-hover-border-color: #625b54; }
.form-control, .form-select, .input-group-text { border-color: #d7cfc6; }
.form-control:focus, .form-select:focus { border-color: var(--teal); box-shadow: 0 0 0 .2rem rgba(121, 85, 58, .15); }
.page-heading .eyebrow, .eyebrow { color: var(--brass); }
.page-link { color: var(--teal); }
.active > .page-link, .page-link.active { background: var(--teal); border-color: var(--teal); }
.bg-light { background-color: #f1ece6 !important; }
.table thead th { background: #f2ebe4 !important; color: #554438; }
.table td { border-bottom-color: #ece6df; }
.badge.text-bg-light { color: #4c5c4e !important; background: #edf1eb !important; }
.upload-area { background: #f5f0e9; border-color: #d7c2ad !important; }
.upload-area:hover { background: #eee4d8; }

.dashboard-hero {
  display: flex;
  align-items: center;
  min-height: 350px;
  overflow: hidden;
  border-radius: 7px;
  color: #fff;
  background: linear-gradient(90deg, rgba(43, 32, 24, .97) 0%, rgba(43, 32, 24, .92) 39%, rgba(43, 32, 24, .42) 100%), url('/static/durrah.png') right 43% / cover;
}
.dashboard-hero-content { width: min(100%, 700px); padding: clamp(32px, 5vw, 74px); }
.dashboard-hero .eyebrow { color: #e3c7a8; }
.dashboard-hero h1 { margin: 12px 0 13px; font-size: clamp(35px, 3.7vw, 55px); line-height: 1.08; font-weight: 760; }
.dashboard-hero p { max-width: 550px; margin: 0; color: #ece3d9; font-size: 16px; line-height: 1.65; }
.dashboard-hero-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 20px; margin-top: 26px; }
.dashboard-hero-actions .btn { padding: 10px 19px; color: #38291e; background: #dec09a; border-color: #dec09a; font-size: 13px; }
.dashboard-hero-actions .btn:hover { color: #fff; background: var(--teal); border-color: var(--teal); }
.dashboard-hero-actions .btn i { margin-left: 8px; }
.hero-secondary-link { color: #fff; font-size: 13px; font-weight: 650; text-decoration: none; }
.hero-secondary-link:hover { color: #e6c6a4; }
.hero-secondary-link i { margin-left: 5px; }

.section-heading { margin-top: 32px; }
.section-heading h2 { font-size: 20px; }
.section-heading-sub { margin-top: 28px; }
.section-heading-sub h2 { font-size: 17px; }
.section-actions { display: flex; align-items: center; gap: 22px; }
.collection-grid { gap: 18px; }
.collection-grid-two { margin-top: 0; }
.collection-card { border-color: var(--line); border-radius: 7px; }
.collection-card-image { display: flex; align-items: center; justify-content: center; height: clamp(280px, 30vw, 390px); aspect-ratio: auto; padding: 10px; background: #f0ebe5; }
.collection-card-image img { width: auto; height: auto; max-width: 100%; max-height: 100%; object-fit: contain; object-position: center; filter: drop-shadow(0 8px 7px rgba(46, 42, 38, .15)); }
.collection-card-body { padding: 15px 18px 18px; }
.collection-card-body h3 { font-size: 15px; }
.collection-card-body p { margin-bottom: 8px; }
.collection-card-body small { color: var(--brass); }
.dashboard-metrics { margin-top: 27px; border: 1px solid var(--line); border-radius: 7px; background: #fff; }
.dashboard-metric { display: flex; align-items: baseline; gap: 10px; padding: 18px 22px; }
.dashboard-metric + .dashboard-metric { border-left-color: var(--line); }
.dashboard-metric strong { color: var(--teal-dark); font-size: 25px; }
.dashboard-metric small { color: var(--muted); font-size: 12px; }
.summary-panel { border-color: var(--line); }
.summary-row .progress { background: #eee9e2; }
.summary-row .progress-bar { background: #697d66; }

.content-wrap .translation-search { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; padding: 12px; background: #fff; border-color: var(--line); }
.translation-search > .form-select { flex: 0 1 220px; min-width: 180px; border: 0; background-color: #f7f4ef; }
.library-search-input { display: flex; align-items: center; gap: 8px; flex: 1 1 250px; min-width: 0; padding: 0 12px; border-left: 1px solid var(--line); }
.library-search-input i { color: var(--brass); }
.library-search-input .form-control { min-width: 0; border: 0; box-shadow: none; }
.content-wrap .library-cover { height: clamp(300px, 30vw, 390px); padding: 8px; object-fit: contain; background: #f0ebe5; }
.library-card .card-body { padding: 18px; }
.library-title { min-height: 0; font-size: 15px; }
.library-description { min-height: 0; }
.library-empty { padding: 40px 24px; border: 1px solid var(--line); border-radius: 7px; background: #fff; text-align: center; }
.library-empty i { color: var(--brass); font-size: 31px; }
.library-empty h2 { margin: 8px 0 4px; font-size: 18px; }
.library-empty p { color: var(--muted); }
.reader-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin-bottom: 16px; padding: 13px 18px; border: 1px solid var(--line); border-radius: 7px; background: #fff; color: var(--muted); font-size: 13px; }
.reader-toolbar strong { color: var(--ink); }
.reader-progress-visual { flex: 1 1 400px; max-width: 700px; min-width: 0; }
.reader-progress-track { height: 13px; border-radius: 7px; }
.reader-progress-track .reading-progress-fill { border-radius: inherit; }
.reader-progress-track.reader-progress-error { outline: 2px solid #b74b3f; outline-offset: 2px; }
.reading-position { color: var(--teal); font-size: 13px; font-weight: 600; }
.reading-progress { margin-top: auto; }
.reading-progress-label { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 7px; color: var(--muted); font-size: 12px; }
.reading-progress-label span:last-child { color: var(--teal-dark); font-weight: 600; text-align: right; }
.reading-progress-track { height: 7px; overflow: hidden; border-radius: 4px; background: #e9e1d7; }
.reading-progress-fill { display: block; height: 100%; background: var(--brass); transition: width .25s ease; }
.reader-page-size { display: flex; align-items: center; gap: 9px; }
.reader-page-size label { white-space: nowrap; font-weight: 650; }
.reader-page-size select { width: 76px; }
.content-wrap .media-panel { background: #f8f5f0; border-color: #e8ded1; }
.content-wrap .manuscript-page-image { background: #f2ede6; border-color: var(--line); }

.metadata-form-fields h4 { font-size: 19px; margin: 0 0 20px; }
.metadata-fieldset { min-width: 0; margin: 0 0 22px; padding: 20px 0 0; border: 0; border-top: 1px solid var(--line); }
.metadata-fieldset legend { float: none; width: auto; margin: 0 0 14px; padding: 0; color: var(--teal-dark); font-size: 15px; font-weight: 700; }
.metadata-fieldset .form-label { font-size: 13px; }
.manuscript-metadata { margin: 0 0 20px; padding: 23px 0 25px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); scroll-margin-top: 100px; }
.manuscript-metadata-heading h2 { margin: 3px 0 0; font-size: 21px; }
.manuscript-metadata-description { margin: 12px 0 0; color: var(--muted); }
.manuscript-metadata-group { margin-top: 22px; }
.manuscript-metadata-group h3 { margin: 0 0 10px; color: var(--teal-dark); font-size: 15px; font-weight: 700; }
.manuscript-metadata-list { margin: 0; }
.manuscript-metadata-row { display: grid; grid-template-columns: minmax(170px, 260px) minmax(0, 1fr); gap: 12px 24px; padding: 10px 0; border-top: 1px solid var(--line); }
.manuscript-metadata-row dt { color: var(--muted); font-size: 13px; font-weight: 600; }
.manuscript-metadata-row dd { min-width: 0; margin: 0; overflow-wrap: anywhere; white-space: pre-wrap; font-size: 14px; }
.manuscript-preview-layout { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); align-items: start; gap: clamp(20px, 3vw, 40px); }
.manuscript-preview-page { min-width: 0; margin: 0; }
.manuscript-preview-page img { display: block; width: 100%; max-height: 82vh; object-fit: contain; background: #f2ede6; border: 1px solid var(--line); border-radius: 7px; }
.manuscript-preview-page figcaption { margin-top: 9px; color: var(--muted); font-size: 12px; }
.manuscript-preview-empty { display: grid; min-height: 300px; place-items: center; padding: 24px; border: 1px solid var(--line); border-radius: 7px; background: #f2ede6; color: var(--muted); text-align: center; }
@media (max-width: 850px) {
  .manuscript-preview-layout { grid-template-columns: minmax(0, 1fr); }
  .manuscript-preview-page img { max-height: 72vh; }
}
@media (max-width: 600px) {
  .manuscript-metadata-row { grid-template-columns: minmax(0, 1fr); gap: 3px; }
}

.auth-page { background: #f3eee8; }
.auth-brand { color: var(--ink); }
.auth-visual { background: linear-gradient(0deg, rgba(43, 32, 24, .9), rgba(43, 32, 24, .42) 80%), url('/static/durrah.png') center 23% / cover; }
.auth-kicker { color: #f1d8b8; }
.auth-visual p { color: #eee1d3; }

@media (max-width: 1199.98px) {
  .top-nav { gap: 7px; }
  .account-menu-name { max-width: 100px; }
}
@media (max-width: 991.98px) {
  html { scroll-padding-top: 74px; }
  .site-header, .site-header-inner { min-height: 62px; }
  .content-wrap { padding-top: 20px; }
}
@media (max-width: 700px) {
  .dashboard-hero { min-height: 355px; background-position: 68% 43%; background-image: linear-gradient(90deg, rgba(43, 32, 24, .96), rgba(43, 32, 24, .68)), url('/static/durrah.png'); }
  .dashboard-hero-content { padding: 27px 23px; }
  .dashboard-hero h1 { font-size: 35px; }
  .dashboard-hero p { font-size: 14px; }
  .dashboard-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .dashboard-metric { display: block; min-width: 0; padding: 13px; }
  .dashboard-metric + .dashboard-metric { border-left: 1px solid var(--line); }
  .dashboard-metric strong { display: block; font-size: 20px; }
  .dashboard-metric small { font-size: 11px; }
  .section-actions { gap: 11px; }
  .content-wrap .translation-search { align-items: stretch; }
  .translation-search > .form-select { flex: 1 1 100%; }
  .library-search-input { flex: 1 1 100%; border-left: 0; border-bottom: 1px solid var(--line); }
  .reader-toolbar { align-items: flex-start; flex-direction: column; }
  .reader-progress-visual { flex: auto; width: 100%; max-width: none; }
}
@media (max-width: 560px) {
  .collection-card-image { height: 300px; }
  .section-heading { align-items: flex-start; }
  .section-actions { flex-wrap: wrap; justify-content: flex-end; }
  .reader-page-size { flex-wrap: wrap; }
}
