:root {
  font-family: "Segoe UI", Arial, sans-serif;
  color: #252823;
  background: #f5f4ef;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --ink: #252823;
  --muted: #85877f;
  --line: #e8e7e0;
  --paper: #fff;
  --green: #426b54;
  --green-dark: #315640;
  --green-pale: #eaf1eb;
  --shadow: 0 10px 32px rgb(44 49 39 / 5%);
}

* { box-sizing: border-box; }
body { min-width: 360px; min-height: 100vh; margin: 0; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible {
  outline: 3px solid rgb(66 107 84 / 30%);
  outline-offset: 2px;
}
[hidden] { display: none !important; }

.app-shell { min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; z-index: 2; display: flex; width: 248px; flex-direction: column;
  padding: 30px 18px 18px; background: #fff; border-right: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 11px; padding: 0 8px; color: var(--ink); text-decoration: none; font-family: "Segoe UI", Arial, sans-serif; font-size: 17px; font-weight: 800; letter-spacing: -.7px; }
.brand-period, .heading-period { color: #8aab83; }
.brand-icon { display: grid; width: 34px; height: 34px; place-items: center; flex: 0 0 auto; border-radius: 11px; background: var(--green); color: #fff; font: 800 16px "Segoe UI", Arial, sans-serif; }
.sidebar-label { margin: 54px 10px 13px; color: #a0a198; font-size: 10px; font-weight: 700; letter-spacing: 1.4px; }
.tools-label { margin-top: 29px; }
.primary-nav { display: grid; gap: 5px; }
.nav-item { display: flex; align-items: center; gap: 13px; width: 100%; padding: 12px 12px; border: 0; border-radius: 9px; background: transparent; color: #64665e; text-align: left; font-size: 13px; font-weight: 600; }
.nav-item:hover { background: #f7f7f3; color: var(--ink); }
.nav-item.is-active { background: var(--green-pale); color: var(--green-dark); }
.nav-icon { width: 19px; color: #8a8d82; font-size: 17px; text-align: center; }
.nav-item.is-active .nav-icon { color: var(--green); }
.nav-count { margin-left: auto; color: #999b93; font-size: 11px; font-weight: 500; }
.sidebar-bottom { margin-top: auto; }
.profile { display: flex; align-items: center; gap: 10px; padding: 14px 4px 3px; border-top: 1px solid var(--line); }
.avatar { display: grid; width: 34px; height: 34px; flex: 0 0 auto; place-items: center; border-radius: 50%; background: #eee9dc; color: #75664e; font-size: 12px; font-weight: 700; }
.profile-copy { display: grid; min-width: 0; gap: 3px; }
.profile-copy strong { overflow: hidden; max-width: 145px; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.profile-copy small { color: var(--muted); font-size: 9px; }

.main-content { min-height: 100vh; margin-left: 248px; }
.topbar { display: flex; min-height: 78px; align-items: center; justify-content: space-between; gap: 20px; padding: 13px 42px; border-bottom: 1px solid var(--line); background: rgb(255 255 255 / 77%); }
.breadcrumb { display: flex; align-items: center; gap: 10px; color: #a1a299; font-size: 9px; font-weight: 700; letter-spacing: 1px; }
.breadcrumb-slash { color: #d2d2ca; }
.breadcrumb strong { color: #55574f; font-size: 11px; letter-spacing: 0; }
.topbar-actions { display: flex; align-items: center; gap: 14px; }
.collection-actions { display: flex; align-items: center; gap: 8px; }
.search-box { display: flex; width: min(330px, 34vw); height: 39px; align-items: center; gap: 9px; padding: 0 11px; border: 1px solid #e7e7e0; border-radius: 8px; background: #fff; color: #95978e; }
.search-box > span { font-size: 21px; line-height: 1; }
.search-box input { width: 100%; min-width: 0; border: 0; outline: 0; color: var(--ink); font-size: 11px; }
.search-box input::placeholder { color: #a6a79f; }
.search-box kbd { flex: 0 0 auto; padding: 3px 5px; border: 1px solid #e9e9e3; border-radius: 4px; color: #92948b; font: 9px "Segoe UI", Arial, sans-serif; }
.button-primary, .button-secondary { display: inline-flex; min-height: 39px; align-items: center; justify-content: center; gap: 8px; padding: 0 15px; border: 1px solid transparent; border-radius: 8px; font-size: 11px; font-weight: 700; transition: background .15s, transform .15s; }
.button-primary { background: var(--green); color: #fff; }
.button-primary:hover { background: var(--green-dark); transform: translateY(-1px); }
.button-primary:disabled { cursor: wait; opacity: .65; }
.button-secondary { border-color: #e4e4dc; background: #fff; color: #575950; }
.button-secondary:hover { background: #f8f8f4; }
.add-button { white-space: nowrap; }
.add-button span { font-size: 17px; font-weight: 400; }
.import-button { white-space: nowrap; }
.import-button span { font-size: 15px; }
.database-toolbar { display: flex; align-items: end; gap: 12px; margin: 0 0 14px; }
.database-filter { width: 220px; }
.database-toolbar .load-status { margin: 0 auto 10px 0; }
.database-table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 10px; background: #fff; box-shadow: 0 2px 6px rgb(44 49 39 / 2%); }
.database-table { width: 100%; min-width: 1500px; border-collapse: separate; border-spacing: 0; font-size: 10px; }
.database-table th { position: sticky; top: 0; z-index: 1; padding: 0; border-bottom: 1px solid #e6e6de; background: #f8f8f4; text-align: left; white-space: nowrap; }
.sort-button { width: 100%; padding: 12px 10px; border: 0; background: transparent; color: #676960; text-align: left; font-size: 9px; font-weight: 700; white-space: nowrap; }
.sort-button:hover { background: #efefe9; color: var(--green-dark); }
.database-table td { max-width: 240px; padding: 10px; overflow: hidden; border-bottom: 1px solid #efefe9; color: #6f7169; text-overflow: ellipsis; white-space: nowrap; }
.database-table tbody tr:hover { background: #fafaf7; }
.database-table tbody tr:last-child td { border-bottom: 0; }
.database-table .database-title { max-width: 280px; color: #34362f; font-weight: 700; }
.database-table td:has(.database-cover) { width: 56px; padding: 5px 10px; }
.database-cover { display: block; width: 34px; height: 48px; border-radius: 3px; background: #f1f1ed; object-fit: cover; }
.database-table td a { color: var(--green); text-decoration: none; }
.database-table td a:hover { text-decoration: underline; }
.database-actions { display: flex; gap: 2px; }
.database-empty { padding: 45px 20px; color: var(--muted); text-align: center; font-size: 11px; }
.database-pagination { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 13px 2px; color: var(--muted); font-size: 10px; }
.database-pagination > div { display: flex; gap: 7px; }
.database-pagination .button-secondary { min-height: 33px; font-size: 10px; }

.content { width: min(1230px, 100%); margin: 0 auto; padding: 44px 42px 70px; }
.page-heading { display: flex; align-items: end; justify-content: space-between; margin-bottom: 30px; }
.eyebrow { margin: 0 0 9px; color: #96988f; font-size: 9px; font-weight: 700; letter-spacing: 1.45px; }
h1, h2, h3, p { margin-top: 0; }
.page-heading h1 { margin: 0; font: 800 37px/1.15 "Segoe UI", Arial, sans-serif; letter-spacing: -1.8px; }
.heading-period { margin-left: 1px; }
.section-description { margin: 8px 0 0; color: var(--muted); font-size: 12px; }
.collection-total { display: flex; align-items: baseline; gap: 7px; padding: 0 2px 5px; color: #92948b; font-size: 11px; }
.collection-total strong { color: var(--ink); font: 700 21px "Segoe UI", Arial, sans-serif; }
.subnav { display: flex; gap: 8px; overflow-x: auto; padding: 0 0 15px; border-bottom: 1px solid var(--line); }
.filter-chip { display: inline-flex; min-height: 34px; align-items: center; gap: 8px; padding: 0 13px; border: 1px solid transparent; border-radius: 18px; background: transparent; color: #7d7f77; font-size: 10px; font-weight: 600; white-space: nowrap; }
.filter-chip:hover { background: #eeeee8; }
.filter-chip.is-selected { border-color: #d9e5d8; background: #eaf1eb; color: #355b40; }
.filter-count { display: grid; min-width: 17px; height: 17px; place-items: center; border-radius: 9px; background: #fff; color: var(--green); font-size: 9px; }
.stats-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin: 22px 0 38px; }
.stat-card { display: flex; min-height: 74px; align-items: center; gap: 12px; padding: 15px 16px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.stat-icon { display: grid; width: 34px; height: 34px; flex: 0 0 auto; place-items: center; border-radius: 9px; font-size: 15px; }
.stat-icon-green { background: #edf4ed; color: #53815e; }
.stat-icon-yellow { background: #fbf3df; color: #ba933c; }
.stat-icon-purple { background: #f1eef8; color: #8975ae; }
.stat-card div { display: grid; gap: 3px; }
.stat-card strong { font: 700 18px "Segoe UI", Arial, sans-serif; }
.stat-card div span { color: var(--muted); font-size: 10px; }
.list-heading { display: flex; align-items: center; justify-content: space-between; margin: 0 0 15px; }
.list-heading > div { display: flex; align-items: baseline; gap: 11px; }
.list-heading h2 { margin: 0; font: 700 15px "Segoe UI", Arial, sans-serif; letter-spacing: -.3px; }
.list-heading > div > span { color: #9b9c94; font-size: 10px; }
.load-status { color: #999b93; font-size: 10px; }
.load-status[data-state="error"], .form-error, .empty-error { color: #a64b43; }
.form-error[data-state="info"] { color: var(--muted); }
.item-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
.item-card { position: relative; display: flex; min-height: 166px; gap: 14px; padding: 13px; border: 1px solid var(--line); border-radius: 10px; background: #fff; box-shadow: 0 2px 6px rgb(44 49 39 / 2%); transition: box-shadow .16s, transform .16s; }
.item-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.item-cover { display: flex; width: 91px; min-height: 136px; flex: 0 0 91px; flex-direction: column; align-items: center; justify-content: center; gap: 12px; overflow: hidden; border-radius: 6px; background: #e6e8df; color: #647062; }
.item-cover.has-cover { position: relative; }
.cover-image { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.item-cover.has-cover .cover-symbol, .item-cover.has-cover .cover-category { display: none; }
.cover-comic { background: #f1e6d7; color: #9f6e42; }
.cover-book { background: #e6e9dc; color: #637356; }
.cover-local_music, .cover-deezer { background: #e7e4ef; color: #75658e; }
.cover-vinyl { background: #e7e4dc; color: #746c56; }
.cover-movie, .cover-series { background: #e0e8e8; color: #597a7c; }
.cover-symbol { font-size: 32px; }
.cover-category { padding: 0 5px; font-size: 8px; font-weight: 700; text-align: center; }
.item-body { min-width: 0; flex: 1; padding: 5px 28px 2px 0; }
.item-title { overflow: hidden; margin: 0 0 5px; font: 700 13px/1.4 "Segoe UI", Arial, sans-serif; letter-spacing: -.2px; text-overflow: ellipsis; }
.item-creator, .item-details { overflow: hidden; margin: 0 0 6px; color: #81837b; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.item-details { color: #a0a198; font-size: 9px; }
.item-tags { display: flex; flex-wrap: wrap; gap: 5px; margin: 9px 0 7px; }
.status-tag, .format-tag { display: inline-block; padding: 4px 7px; border-radius: 4px; background: #f1f1ed; color: #72746b; font-size: 8px; font-weight: 600; }
.status-completed { background: #edf4ed; color: #54785a; }
.status-in_progress { background: #fbf3df; color: #997927; }
.status-wanted { background: #f4edf1; color: #95637a; }
.format-tag { background: #f0eef7; color: #786d93; }
.item-location, .item-notes, .external-reference { overflow: hidden; margin: 5px 0 0; color: #92948b; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.item-notes { max-width: 100%; color: #777970; }
.external-link { display: inline-block; max-width: 100%; overflow: hidden; margin-top: 6px; color: #55745e; font-size: 9px; text-decoration: none; text-overflow: ellipsis; white-space: nowrap; }
.external-link:hover { text-decoration: underline; }
.cover-source-actions { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.cover-source-button { padding: 4px 7px; border: 1px solid #e4e4dc; border-radius: 5px; background: #fff; color: #55745e; font-size: 9px; font-weight: 600; }
.cover-source-button:hover { background: #f2f5ef; }
.card-actions { position: absolute; top: 10px; right: 9px; display: flex; gap: 2px; opacity: .35; transition: opacity .15s; }
.item-card:hover .card-actions, .card-actions:focus-within { opacity: 1; }
.icon-button { display: grid; width: 29px; height: 29px; flex: 0 0 auto; place-items: center; border: 0; border-radius: 7px; background: transparent; color: #777970; font-size: 15px; }
.icon-button:hover { background: #f0f0eb; color: var(--ink); }
.delete-button:hover { background: #fbefed; color: #a64b43; }
.empty-state { grid-column: 1 / -1; display: flex; min-height: 270px; flex-direction: column; align-items: center; justify-content: center; padding: 32px; border: 1px dashed #dcdcd4; border-radius: 11px; background: rgb(255 255 255 / 45%); text-align: center; }
.empty-icon { margin-bottom: 12px; color: #8eaa8a; font-size: 29px; }
.empty-state h3 { margin: 0 0 7px; font: 700 15px "Segoe UI", Arial, sans-serif; }
.empty-state p { max-width: 330px; margin: 0 0 16px; color: var(--muted); font-size: 11px; line-height: 1.6; }
.empty-error { grid-column: 1 / -1; font-size: 12px; }
.auth-gate { display: grid; min-height: 100vh; place-items: center; padding: 24px; background: radial-gradient(ellipse at 50% 40%, #fdfdfa, #efeee8); }
.auth-card { display: flex; width: min(410px, 100%); flex-direction: column; align-items: center; padding: 45px 34px; border: 1px solid var(--line); border-radius: 14px; background: #fff; box-shadow: var(--shadow); text-align: center; }
.auth-card .brand-icon { width: 45px; height: 45px; margin-bottom: 25px; border-radius: 14px; font-size: 20px; }
.auth-card h1 { margin: 0 0 9px; font: 800 26px "Segoe UI", Arial, sans-serif; letter-spacing: -1px; }
.auth-card > p:not(.eyebrow) { margin: 0 0 23px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.item-dialog { width: min(650px, calc(100% - 28px)); max-width: none; max-height: min(90vh, 850px); padding: 0; overflow: auto; border: 1px solid var(--line); border-radius: 13px; background: #fff; box-shadow: 0 25px 80px rgb(32 36 28 / 20%); }
.item-dialog::backdrop { background: rgb(31 35 29 / 42%); backdrop-filter: blur(2px); }
.cover-dialog { width: min(470px, calc(100% - 28px)); max-width: none; max-height: min(90vh, 760px); padding: 0; overflow: auto; border: 1px solid var(--line); border-radius: 13px; background: #fff; box-shadow: 0 25px 80px rgb(32 36 28 / 20%); }
.cover-dialog::backdrop { background: rgb(31 35 29 / 42%); backdrop-filter: blur(2px); }
.cover-preview-panel { padding: 22px 25px 25px; }
.cover-dialog-status { margin: 0 0 12px; color: var(--muted); font-size: 11px; }
.cover-dialog-status[data-state="error"] { color: #a64b43; }
.cover-preview-image { display: block; max-width: 100%; max-height: 65vh; margin: 0 auto 12px; object-fit: contain; }
.cover-preview-panel .external-link { margin-top: 0; }
.item-form { padding: 25px 27px 23px; }
.dialog-heading { display: flex; align-items: start; justify-content: space-between; margin-bottom: 19px; }
.dialog-heading .eyebrow { margin-bottom: 6px; }
.dialog-heading h2 { margin: 0; font: 700 20px "Segoe UI", Arial, sans-serif; letter-spacing: -.7px; }
.close-button { font-size: 23px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px 14px; }
.field { display: grid; gap: 6px; color: #5d5f57; font-size: 10px; font-weight: 600; }
.field-wide { grid-column: 1 / -1; }
.field input:not([type="checkbox"]), .field select, .field textarea { width: 100%; min-height: 38px; padding: 9px 10px; border: 1px solid #e5e5dd; border-radius: 6px; background: #fff; color: var(--ink); font-size: 11px; font-weight: 400; }
.field textarea { min-height: 72px; resize: vertical; }
.field-check { display: flex; align-items: center; gap: 8px; align-self: end; min-height: 38px; }
.field-check input { width: 15px; height: 15px; accent-color: var(--green); }
.required { color: #a64b43; }
.form-error { min-height: 14px; margin: 8px 0 0; font-size: 10px; }
.dialog-actions { display: flex; justify-content: end; gap: 8px; padding-top: 13px; border-top: 1px solid var(--line); }
.import-dialog { width: min(620px, calc(100% - 28px)); }
.import-panel { padding: 25px 27px 23px; }
.import-help, .mapping-description { color: #777970; font-size: 11px; line-height: 1.65; }
.file-field { margin: 18px 0; }
.file-field input { margin-top: 1px; }
.import-mapping { padding-top: 14px; border-top: 1px solid var(--line); }
.mapping-title { margin: 0 0 6px; font: 700 13px "Segoe UI", Arial, sans-serif; }
.mapping-description { margin: 0 0 12px; color: var(--muted); font-size: 10px; }
.mapping-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 13px; }
.mapping-field { font-size: 9px; }
.mapping-field select { min-height: 34px; padding: 7px; font-size: 10px; }
.import-preview { margin: 15px 0; padding: 13px; border: 1px solid var(--line); border-radius: 8px; background: #fbfbf8; }
.import-summary, .import-success { display: grid; gap: 5px; }
.import-summary strong, .import-success strong { font: 700 12px "Segoe UI", Arial, sans-serif; }
.import-summary span, .import-success span { color: #777970; font-size: 10px; }
.import-success { padding: 8px 0; }
.import-success strong { color: var(--green-dark); }
.duplicate-question { margin: 12px 0 8px; color: #55574f; font-size: 10px; line-height: 1.5; }
.duplicate-list { display: grid; max-height: 140px; gap: 6px; overflow: auto; margin: 0; padding: 0 0 0 15px; }
.duplicate-list li { padding-left: 2px; color: #777970; font-size: 9px; }
.duplicate-list li strong, .duplicate-list li span { display: block; }
.duplicate-list li strong { margin-bottom: 2px; color: #45473f; font-size: 10px; }
.duplicate-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.duplicate-actions .button-primary, .duplicate-actions .button-secondary, .import-confirm { min-height: 35px; font-size: 10px; }
.import-confirm { margin-top: 13px; }
.import-actions { margin-top: 16px; }

@media (max-width: 1000px) {
  .sidebar { width: 205px; }
  .main-content { margin-left: 205px; }
  .topbar { padding-right: 25px; padding-left: 25px; }
  .content { padding-right: 25px; padding-left: 25px; }
  .item-grid { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
  body { min-width: 320px; }
  .sidebar { position: static; width: 100%; height: auto; padding: 13px 16px 0; border-right: 0; }
  .brand { padding: 0 1px 12px; }
  .brand-icon { width: 30px; height: 30px; }
  .sidebar-label, .sidebar-bottom { display: none; }
  .primary-nav { display: flex; gap: 4px; overflow-x: auto; }
  .primary-nav[aria-label="Outils"] { padding-bottom: 7px; }
  .nav-item { width: auto; min-width: max-content; gap: 7px; padding: 10px 11px; font-size: 11px; }
  .nav-count { display: none; }
  .nav-icon { width: auto; font-size: 14px; }
  .main-content { margin-left: 0; }
  .topbar { min-height: auto; flex-wrap: wrap; gap: 11px; padding: 13px 16px; }
  .topbar-actions { width: 100%; gap: 8px; }
  .search-box { width: auto; flex: 1; }
  .search-box kbd { display: none; }
  .collection-actions { gap: 5px; }
  .add-button, .import-button { gap: 5px; padding: 0 8px; font-size: 9px; }
  .content { padding: 27px 16px 48px; }
  .page-heading { margin-bottom: 20px; }
  .page-heading h1 { font-size: 31px; }
  .section-description { max-width: 240px; font-size: 10px; }
  .stats-row { gap: 7px; margin: 17px 0 30px; }
  .stat-card { min-height: 67px; gap: 7px; padding: 10px 8px; }
  .stat-icon { width: 28px; height: 28px; font-size: 12px; }
  .stat-card strong { font-size: 15px; }
  .stat-card div span { font-size: 8px; }
  .list-heading > div { display: grid; gap: 3px; }
  .load-status { max-width: 130px; text-align: right; }
  .database-page { overflow: hidden; }
  .database-heading { align-items: start; }
  .database-toolbar { flex-wrap: wrap; }
  .database-filter { width: min(100%, 220px); }
  .database-toolbar .load-status { flex: 1; text-align: right; }
  .database-pagination { align-items: start; }
}
@media (max-width: 460px) {
  .item-card { gap: 10px; padding: 10px; }
  .item-cover { width: 72px; min-height: 122px; flex-basis: 72px; }
  .item-body { padding-right: 20px; }
  .form-grid { grid-template-columns: 1fr; }
  .field-wide { grid-column: auto; }
  .item-form { padding: 21px 17px 17px; }
  .import-panel { padding: 21px 17px 17px; }
  .mapping-grid { grid-template-columns: 1fr; }
}
