:root {
    --wine: #690b26;
    --wine-dark: #4d071b;
    --wine-soft: #fff1f4;
    --gold: #caa447;
    --green: #00bd78;
    --green-dark: #087b50;
    --purple: #c800e5;
    --cyan: #00b8ce;
    --ink: #1f2937;
    --muted: #737b86;
    --line: #e5e8ec;
    --bg: #f4f6f8;
    --white: #fff;
    --shadow: 0 10px 28px rgba(29, 39, 52, .07);
}

* { box-sizing: border-box; }
html { min-width: 320px; }
body { margin: 0; color: var(--ink); background: var(--bg); font-family: Inter, Arial, Helvetica, sans-serif; font-size: 14px; }
a { color: inherit; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.admin-shell { display: grid; grid-template-columns: minmax(0, 1fr) 278px; grid-template-areas: "main sidebar"; min-height: 100vh; }
.admin-main { grid-area: main; min-width: 0; padding: 26px 30px 48px; }
.admin-sidebar { grid-area: sidebar; display: flex; flex-direction: column; min-height: 100vh; max-height: 100vh; overflow-y: auto; padding: 23px 17px 19px; border-left: 1px solid #e1e4e8; background: #fff; position: sticky; top: 0; }

.brand-block { display: flex; align-items: center; gap: 12px; padding: 0 8px 21px; }
.brand-logo-link { display: grid; width: 47px; height: 57px; place-items: center; flex: 0 0 47px; }
.brand-block img { display: block; width: 47px; height: 57px; object-fit: contain; }
@keyframes panel-brand-float { 0%, 100% { transform: translateY(0) rotate(-1deg); } 50% { transform: translateY(-3px) rotate(1deg); } }
.brand-block img { animation: panel-brand-float 5s ease-in-out infinite; }
.brand-block strong { display: block; color: var(--wine); font-size: 21px; letter-spacing: .05em; }
.brand-block small { display: block; margin-top: 3px; color: #8b929b; font-size: 12px; }

.sidebar-search, .search-box { display: flex; align-items: center; gap: 9px; height: 43px; border: 1px solid #e1e5e9; border-radius: 9px; background: #fff; }
.sidebar-search { margin: 0 0 18px; padding: 0 11px; }
.sidebar-search span, .search-box span { color: #9aa1aa; font-size: 21px; line-height: 1; }
.sidebar-search input, .search-box input { width: 100%; min-width: 0; border: 0; outline: 0; color: var(--ink); background: transparent; }
.sidebar-search button { padding: 0 10px; border: 0; color: var(--wine); background: transparent; font-size: 20px; cursor: pointer; }
.admin-loading { position: fixed; z-index: 10000; inset: 0; display: grid; place-items: center; background: rgba(24, 25, 31, .58); opacity: 0; pointer-events: none; transition: opacity .18s ease; }
.admin-loading.is-visible { opacity: 1; pointer-events: auto; }
.admin-loading__box { display: flex; min-width: 260px; align-items: center; flex-direction: column; gap: 9px; padding: 26px 32px; border-radius: 14px; color: var(--ink); background: #fff; box-shadow: 0 20px 60px rgba(0,0,0,.22); text-align: center; }
.admin-loading__box small { color: #858d96; }
.loading-spinner { width: 34px; height: 34px; border: 4px solid #f0dfe4; border-top-color: var(--wine); border-radius: 50%; animation: admin-spin .75s linear infinite; }
@keyframes admin-spin { to { transform: rotate(360deg); } }
.sidebar-search input::placeholder, .search-box input::placeholder { color: #a0a7af; }

.sidebar-nav { display: flex; flex-direction: column; gap: 3px; }
.nav-item { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 9px; color: #303743; text-decoration: none; font-weight: 750; transition: background .15s ease, color .15s ease; }
.nav-item:hover, .nav-item.active { color: var(--wine); background: var(--wine-soft); }
.nav-icon { width: 27px; flex: 0 0 27px; color: var(--green); font-size: 21px; line-height: 1; text-align: center; }
.nav-item:nth-child(3) .nav-icon { color: #ff9c00; }
.nav-item:nth-child(4) .nav-icon { color: var(--cyan); }
.nav-item:nth-child(5) .nav-icon { color: #4f5359; }
.nav-item:nth-child(6) .nav-icon { color: var(--green); }
.nav-item:nth-child(7) .nav-icon { color: #0d8e75; }
.nav-item:nth-child(8) .nav-icon { color: var(--gold); }
.nav-item:nth-child(9) .nav-icon { color: #ff9800; }
.nav-item:nth-child(10) .nav-icon { color: #6d5855; }
.nav-item:nth-child(11) .nav-icon { color: var(--purple); }
.nav-item:nth-child(12) .nav-icon { color: var(--wine); }
.nav-item:nth-child(13) .nav-icon { color: #0d8e75; }

.sidebar-bottom { margin-top: auto; padding-top: 17px; border-top: 1px solid var(--line); }
.current-user { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.avatar { display: grid; width: 34px; height: 34px; place-items: center; border-radius: 50%; color: #fff; background: var(--wine); font-size: 14px; }
.current-user strong, .current-user small { display: block; max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.current-user strong { font-size: 12px; }
.current-user small { margin-top: 2px; color: var(--muted); font-size: 11px; text-transform: capitalize; }
.account-links { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 0 7px; }
.account-links a { color: var(--wine); font-size: 11px; font-weight: 850; text-decoration: none; }
.account-links a:hover { text-decoration: underline; }
.logout-link { text-transform: uppercase; }

.admin-topbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.eyebrow { margin: 0 0 6px; color: #89919a; font-size: 11px; font-weight: 850; letter-spacing: .14em; text-transform: uppercase; }
.admin-topbar h1 { margin: 0; color: #1c2735; font-size: clamp(24px, 2vw, 31px); line-height: 1.1; }
.topbar-meta { display: flex; align-items: center; gap: 13px; color: #7d8792; font-size: 13px; white-space: nowrap; }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; margin-bottom: 22px; }
.metric-card { position: relative; min-height: 144px; overflow: hidden; padding: 26px 28px 21px; border: 1px solid #e0e4e8; background: #fff; box-shadow: var(--shadow); }
.metric-card::before { position: absolute; top: 0; bottom: 0; left: 0; width: 5px; background: var(--gold); content: ""; }
.metric-label { display: block; color: #858c95; font-size: 12px; font-weight: 850; letter-spacing: .05em; text-transform: uppercase; }
.metric-card strong { display: block; margin: 12px 0 2px; color: var(--wine); font-size: 45px; font-weight: 550; line-height: 1; font-variant-numeric: tabular-nums; }
.metric-card small { color: var(--gold); font-size: 12px; font-weight: 850; text-transform: uppercase; }
.metric-icon { position: absolute; top: 22px; right: 22px; color: currentColor; font-size: 31px; opacity: .14; }
.metric-wine::before { background: var(--wine); }
.metric-green::before { background: var(--green); }
.metric-green strong { color: var(--green); }
.metric-purple::before { background: var(--purple); }
.metric-purple strong { color: var(--purple); }
.metric-time::before { background: var(--gold); }
.metric-time strong { color: #2d333b; font-size: 39px; white-space: nowrap; }

.toolbar-card, .table-card, .form-card, .report-card { border: 1px solid #e0e4e8; background: #fff; box-shadow: var(--shadow); }
.toolbar-card { margin-bottom: 18px; padding: 14px 16px; }
.search-form { display: flex; align-items: center; gap: 10px; }
.search-box { flex: 1; padding: 0 12px; }
.search-form select { height: 43px; padding: 0 12px; border: 1px solid #e1e5e9; border-radius: 9px; color: var(--ink); background: #fff; outline: 0; }
.search-result-note { margin: 10px 2px 0; color: #737b86; font-size: 13px; }
.search-result-note strong { color: var(--wine); }
.table-card { overflow: hidden; }
.table-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 15px; padding: 22px 25px 18px; }
.table-heading h2, .form-intro h2, .report-card h2 { margin: 0; color: #202a36; font-size: 21px; line-height: 1.2; }
.table-heading h3 { margin: 0; font-size: 17px; }
.table-count { color: #8a929b; font-size: 13px; white-space: nowrap; }
.table-scroll { overflow-x: auto; }
.data-table { width: 100%; min-width: 1010px; border-collapse: collapse; }
.data-table th { padding: 14px 14px; color: #fff; background: var(--wine); font-size: 12px; font-weight: 850; letter-spacing: .03em; text-align: left; text-transform: uppercase; white-space: nowrap; }
.data-table td { padding: 14px; border-bottom: 1px solid #edf0f2; vertical-align: middle; }
.data-table tbody tr:hover { background: #fffafb; }
.code-badge { display: inline-block; padding: 8px 11px; color: #fff; background: #f21848; box-shadow: 2px 2px 0 #cdd0d3; font-weight: 850; }
.dni-badge { display: inline-block; padding: 8px 10px; color: #40464f; background: #e7e9eb; font-family: ui-monospace, monospace; font-size: 12px; font-weight: 750; letter-spacing: .03em; }
.person-name { display: block; color: var(--wine); font-size: 14px; text-transform: uppercase; }
.person-name.second { margin-top: 3px; }
.phone-link { display: flex; align-items: center; gap: 7px; color: #343a43; text-decoration: none; white-space: nowrap; }
.phone-link span { display: grid; width: 28px; height: 28px; place-items: center; border: 1px solid #bfe7ca; border-radius: 50%; color: #00b867; background: #effbf1; }
.status-pill { display: inline-block; padding: 8px 11px; color: #fff; box-shadow: 0 3px 7px rgba(0, 0, 0, .11); font-size: 10px; font-weight: 900; letter-spacing: .04em; white-space: nowrap; }
.status-pending { background: #f21848; }
.status-ok { background: #00b66d; }
.status-expired { background: #e38a00; }
.status-archived { background: #858c94; }
.validity-date { display: block; margin-top: 5px; color: #858d96; font-size: 11px; }
.row-actions { display: flex; align-items: center; gap: 5px; }
.row-actions form { margin: 0; }
.action-button { display: grid; width: 37px; height: 37px; place-items: center; border: 0; text-decoration: none; font-size: 17px; font-weight: 850; }
.action-button:hover { filter: brightness(.96); transform: translateY(-1px); }
.action-pdf { border: 1px solid #d2d4d6; color: #777; background: #f0f1f2; }
.action-pdf-view { color: #9b0b2c; background: #fff2f4; }
.action-edit { color: #00a7be; background: #d9f7fb; }
.action-cert { color: #bd00d0; background: #f8dcfb; }
.action-enable { color: #00ad70; background: #ddf9ec; }
.action-public { color: #8a6510; background: #fff4cf; }
.action-delete { color: #4f555c; background: #ededed; }
.action-disabled { color: #b8bdc2; background: #f5f5f5; }
.empty-cell { padding: 44px !important; color: #8a929b; text-align: center; }
.pagination { display: flex; align-items: center; justify-content: space-between; padding: 16px 22px; color: #858d96; }
.pagination a { margin-left: 14px; color: var(--wine); font-weight: 750; text-decoration: none; }

.primary-button, .secondary-button { display: inline-flex; align-items: center; justify-content: center; min-height: 43px; padding: 11px 17px; border: 0; border-radius: 8px; font-weight: 800; line-height: 1.1; text-decoration: none; }
.primary-button { color: #fff; background: var(--wine); }
.primary-button:hover { background: var(--wine-dark); }
.primary-button:disabled { cursor: not-allowed; opacity: .55; }
.secondary-button { color: #3e4752; background: #eef0f2; }
.secondary-button:hover { background: #e4e7ea; }
.button-link { cursor: pointer; }
.compact { min-height: 36px; padding: 8px 11px; font-size: 12px; }
.flash { margin: 0 0 18px; padding: 13px 16px; border-radius: 9px; font-weight: 700; line-height: 1.45; }
.flash.success { color: #087b50; background: #e2faef; }
.flash.error { color: #a91235; background: #ffe8ed; }
.flash.warning { color: #8b5c00; background: #fff5dc; }

.form-card { max-width: 1180px; padding: 29px; }
.form-card { position: relative; animation: panel-form-enter .5s cubic-bezier(.2,.72,.2,1) both; }
@keyframes panel-form-enter { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.form-card::before { position: absolute; top: 0; right: 0; left: 0; height: 4px; border-radius: 18px 18px 0 0; background: linear-gradient(90deg, var(--gold), var(--wine), var(--purple)); content: ""; }
.form-close { position: absolute; top: 17px; right: 20px; display: grid; width: 36px; height: 36px; place-items: center; border-radius: 50%; color: #6d102d; background: #f8e9ed; font-size: 27px; line-height: 1; text-decoration: none; }
.form-close:hover { color: #fff; background: #6d102d; transform: rotate(90deg); }
.certificate-dialog { width: min(680px, calc(100% - 30px)); max-height: 90vh; padding: 30px; border: 0; border-top: 5px solid #6d102d; border-radius: 16px; box-shadow: 0 25px 90px rgba(20,20,30,.3); }
.certificate-dialog::backdrop { background: rgba(20, 22, 28, .68); }
.dialog-close { position: absolute; top: 15px; right: 18px; border: 0; color: #6d102d; background: transparent; font-size: 29px; cursor: pointer; }
.preview-lead { color: #747e88; }
.preview-paper { margin-top: 18px; padding: 28px; border: 1px solid #e5d8dc; border-radius: 12px; background: #fffdfb; box-shadow: inset 0 0 0 5px #faf3f5; }
.preview-paper h3 { margin: 18px 0; color: #6d102d; font-size: 23px; }
.preview-paper dl { margin: 0; border-top: 1px solid #eadfe2; }
.preview-paper dl div { display: flex; justify-content: space-between; gap: 20px; padding: 11px 0; border-bottom: 1px solid #eadfe2; }
.preview-paper dt { color: #69727b; font-weight: 700; }
.preview-paper dd { margin: 0; color: #26313b; text-align: right; }
.preview-note { margin-bottom: 0; color: #8a5b00; font-size: 13px; }
.narrow-card { max-width: 850px; }
.quick-actions { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 13px; margin: 0 0 18px; }
.quick-action { display: flex; align-items: center; gap: 11px; min-width: 0; padding: 14px 15px; border: 1px solid #e2e6ea; border-left: 4px solid currentColor; border-radius: 10px; color: var(--wine); background: #fff; box-shadow: var(--shadow); text-decoration: none; transition: transform .15s ease, box-shadow .15s ease; }
.quick-action:hover { transform: translateY(-1px); box-shadow: 0 13px 28px rgba(29, 39, 52, .11); }
.quick-action__icon { display: grid; width: 35px; height: 35px; flex: 0 0 35px; place-items: center; border-radius: 9px; background: currentColor; color: #fff; font-size: 18px; font-weight: 900; }
.quick-action strong, .quick-action small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.quick-action strong { font-size: 13px; }
.quick-action small { margin-top: 3px; color: #818a94; font-size: 11px; font-weight: 500; }
.quick-action__arrow { margin-left: auto; color: currentColor; font-size: 22px; line-height: 1; }
.quick-action--gold { color: #b28a21; }
.quick-action--orange { color: #e58a00; }
.quick-action--green { color: var(--green-dark); }
.quick-action--blue { color: #286da2; }
.form-intro { margin-bottom: 25px; }
.form-intro p:last-child { margin-bottom: 0; color: #747e88; line-height: 1.55; }
.admin-form label { display: flex; flex-direction: column; gap: 7px; color: #424a54; font-weight: 750; }
.admin-form input, .admin-form select, .admin-form textarea { width: 100%; border: 1px solid #dfe3e7; border-radius: 8px; padding: 11px 12px; color: var(--ink); background: #fff; outline: 0; }
.admin-form input:focus, .admin-form select:focus, .admin-form textarea:focus { border-color: #a93b55; box-shadow: 0 0 0 3px rgba(105, 11, 38, .1); }
.admin-form textarea { min-height: 100px; resize: vertical; }
.form-grid { display: grid; gap: 16px; margin-bottom: 16px; }
.form-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.required { color: #c6173e; }
.readonly-input, .admin-form input[readonly] { color: #818992 !important; background: #f2f4f5 !important; }
.field-help { color: #858d96; font-size: 11px; font-weight: 450; line-height: 1.45; }
.section-label { margin: 25px 0 16px; padding-bottom: 9px; border-bottom: 1px solid #eceef0; color: var(--wine); font-size: 12px; font-weight: 900; letter-spacing: .11em; text-transform: uppercase; }
.upload-box { display: flex !important; flex-direction: row !important; align-items: center; gap: 14px; margin-top: 10px; padding: 17px; border: 1px dashed #bbc3ca !important; cursor: pointer; }
.upload-box input { width: auto; margin-left: auto; border: 0 !important; padding: 0 !important; box-shadow: none !important; }
.admin-form input[type="file"]::file-selector-button { margin-right: 8px; padding: 9px 12px; border: 0; border-radius: 8px; color: #fff; background: var(--wine); font-weight: 800; cursor: pointer; }
.upload-icon { display: grid; width: 42px; height: 42px; place-items: center; flex: 0 0 42px; border-radius: 10px; color: var(--wine); background: var(--wine-soft); font-size: 12px; font-weight: 900; }
.upload-box strong, .upload-box small { display: block; }
.upload-box small { margin-top: 4px; color: #858d96; font-weight: 450; }
.form-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; margin-top: 24px; }
.check-label { display: flex !important; flex-direction: row !important; align-items: center; gap: 8px; }
.check-label input { width: 17px; height: 17px; }
.security-callout { margin: 0 0 20px; padding: 13px 15px; border-left: 4px solid var(--gold); border-radius: 6px; color: #59616a; background: #fffaf0; line-height: 1.5; }
.security-callout code { padding: 2px 4px; border-radius: 4px; background: #f2ead6; font-size: 11px; }
.update-results { margin: 0; padding: 0 0 0 19px; color: #59636d; line-height: 1.8; }

.certificate-preview-grid { display: grid; grid-template-columns: minmax(0, 1fr) 310px; gap: 27px; align-items: start; }
.qr-preview { padding: 20px; border: 1px solid #e2e5e8; border-radius: 12px; background: #fbfcfd; text-align: center; }
.qr-preview h3 { margin: 0 0 15px; color: var(--wine); font-size: 17px; }
.qr-preview #qr-code { display: grid; min-height: 260px; place-items: center; }
.qr-preview canvas, .qr-preview img { max-width: 260px; height: auto; }
.qr-preview p, .qr-preview small { color: #818a94; font-size: 12px; line-height: 1.5; }
.certificate-code { margin-top: 18px; padding: 13px 15px; border-left: 4px solid var(--wine); border-radius: 5px; background: #f8eef1; }
.certificate-code span, .certificate-code strong { display: block; }
.certificate-code span { color: #858d96; font-size: 11px; text-transform: uppercase; }
.certificate-code strong { margin-top: 4px; color: var(--wine); font-family: ui-monospace, monospace; font-size: 17px; }
.treatment-hint { display: flex; align-items: center; gap: 12px; margin: -3px 0 17px; padding: 12px 14px; border: 1px solid #eadfe3; border-radius: 12px; background: linear-gradient(135deg, #fff9fa, #fff); }
.treatment-hint__icon { display: grid; width: 38px; height: 38px; flex: 0 0 38px; place-items: center; border-radius: 11px; color: #fff; background: linear-gradient(135deg, var(--wine), #9f2a4c); font-size: 13px; font-weight: 900; box-shadow: 0 8px 18px rgba(105, 11, 38, .16); }
.treatment-hint small, .treatment-hint strong { display: block; }
.treatment-hint small { color: var(--muted); font-size: 11px; font-weight: 650; }
.treatment-hint strong { margin-top: 3px; color: var(--wine); font-size: 18px; letter-spacing: .01em; }
.preview-treatment { margin-right: 7px; color: var(--gold); }
.certificate-success-card { text-align: center; }
.success-mark { display: grid; width: 64px; height: 64px; margin: 0 auto 17px; place-items: center; border-radius: 50%; color: #fff; background: var(--green); font-size: 35px; font-weight: 900; }
.certificate-success-card h2 { margin: 0; color: var(--wine); font-size: 24px; }
.lead { color: #69737e; line-height: 1.5; }
.success-details { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 18px; }
.success-details div { padding: 14px; border: 1px solid var(--line); border-radius: 9px; background: #fafbfc; }
.success-details span, .success-details strong { display: block; }
.success-details span { color: var(--muted); font-size: 11px; text-transform: uppercase; }
.success-details strong { margin-top: 5px; color: var(--wine); }
.certificate-actions { justify-content: center; }
.certificate-pdf-note { align-self: center; }
.success-links { display: flex; justify-content: center; gap: 17px; margin-top: 20px; }
.success-links a { color: var(--wine); font-size: 12px; font-weight: 750; text-decoration: none; }
.success-links a:hover { text-decoration: underline; }

.template-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 14px; }
.file-note { color: #878f98; font-family: ui-monospace, monospace; }
.report-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 19px; }
.report-card { padding: 23px; }
.report-card h2 { margin-bottom: 16px; font-size: 17px; }
.bar-row { display: flex; justify-content: space-between; padding: 11px 0; border-bottom: 1px solid var(--line); color: #6d757e; }
.bar-row strong { color: var(--wine); }
.import-preview { margin-top: 25px; padding-top: 22px; border-top: 1px solid var(--line); }
.upload-inline { display: flex; align-items: center; gap: 12px; }
.upload-inline input { min-width: 0; flex: 1; padding: 10px; border: 1px solid #dfe3e7; border-radius: 8px; background: #fff; }
.upload-inline { padding: 13px; border: 1px solid #e5e8ec; border-radius: 13px; background: linear-gradient(135deg, #fff, #faf7f8); }
.upload-inline input[type="file"]::file-selector-button { margin-right: 8px; padding: 9px 12px; border: 0; border-radius: 8px; color: #fff; background: var(--wine); font-weight: 800; cursor: pointer; }
.compact-table { min-width: 700px; }
.detail-cell { max-width: 380px; color: #626c77; font-family: ui-monospace, monospace; font-size: 11px; white-space: normal; word-break: break-word; }
.external-import-card { margin-top: 18px; }
.media-thumb { width: 92px; height: 54px; object-fit: cover; border-radius: 7px; border: 1px solid #e2e5e8; background: #f4f6f8; }
.slide-status { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 850; }
.slide-status::before { width: 7px; height: 7px; border-radius: 50%; background: currentColor; content: ""; }
.slide-status--on { color: var(--green-dark); }
.slide-status--off { color: #8c6a14; }
.danger-button { color: #a91235; background: #ffe8ed; }
.danger-button:hover { background: #ffd9e1; }
.user-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }
.user-actions form { margin: 0; }
.user-actions .secondary-button { white-space: nowrap; }

.login-body { display: grid; min-height: 100vh; place-items: center; padding: 20px; background: radial-gradient(circle at top right, #fff, transparent 45%), linear-gradient(135deg, #f7f8fa, #f4e9ed); }
.login-card, .install-card { width: min(100%, 455px); padding: 38px; border: 1px solid rgba(105, 11, 38, .08); border-radius: 17px; background: #fff; box-shadow: 0 24px 70px rgba(44, 19, 30, .15); }
.install-card { width: min(100%, 790px); }
.login-logo { display: block; width: 75px; height: 92px; margin: 0 auto 17px; object-fit: contain; }
.login-card .eyebrow, .login-card h1, .login-description { text-align: center; }
.login-card h1, .install-card h1 { margin: 0 0 8px; color: var(--wine); }
.login-description { margin: 0 0 24px; color: #848d96; }
.login-card form label, .install-form label { display: flex; flex-direction: column; gap: 7px; margin-top: 15px; color: #454d56; font-weight: 750; }
.login-card input, .install-form input { padding: 12px; border: 1px solid #dfe3e7; border-radius: 8px; }
.login-card .primary-button { width: 100%; margin-top: 22px; }
.install-form h2 { margin: 27px 0 13px; padding-bottom: 8px; border-bottom: 1px solid var(--line); color: var(--wine); font-size: 14px; letter-spacing: .09em; text-transform: uppercase; }
.install-form .primary-button { margin-top: 23px; }
.install-card .button-link { width: 100%; }

/* Renovación visual de formularios y controles - v6 */
.form-card { max-width: 1100px; padding: clamp(23px, 3.5vw, 38px); border-radius: 18px; box-shadow: 0 15px 38px rgba(29, 39, 52, .09); }
.narrow-card { max-width: 850px; }
.form-intro { position: relative; margin-bottom: 30px; padding: 2px 0 2px 15px; }
.form-intro::before { position: absolute; top: 0; bottom: 0; left: 0; width: 4px; border-radius: 5px; background: linear-gradient(var(--gold), var(--wine)); content: ""; }
.form-intro h2 { margin-top: 2px; font-size: clamp(22px, 2.4vw, 29px); letter-spacing: -.02em; }
.form-intro p:last-child { max-width: 760px; }
.admin-form { display: block; }
.admin-form label { gap: 8px; font-size: 13px; }
.admin-form input, .admin-form select, .admin-form textarea { min-height: 48px; padding: 12px 14px; border-color: #d8dee4; border-radius: 10px; background: #fcfdfe; transition: border-color .16s ease, box-shadow .16s ease, background .16s ease; }
.admin-form input:hover, .admin-form select:hover, .admin-form textarea:hover { border-color: #bcc7d0; background: #fff; }
.admin-form input:focus, .admin-form select:focus, .admin-form textarea:focus { border-color: var(--wine); background: #fff; box-shadow: 0 0 0 4px rgba(105, 11, 38, .09); }
.admin-form input::placeholder, .admin-form textarea::placeholder { color: #a1aab3; }
.admin-form select { cursor: pointer; appearance: none; padding-right: 44px; background-color: #fff; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24'%3E%3Cpath d='m7 10 5 5 5-5' fill='none' stroke='%23690b26' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 13px center; background-size: 18px; }
.admin-form input[type="date"] { cursor: pointer; }
.admin-form input[type="checkbox"], .admin-form input[type="file"] { min-height: auto; }
.admin-form input[type="checkbox"] { accent-color: var(--wine); }
.section-label { display: flex; align-items: center; gap: 10px; margin-top: 30px; padding: 0 0 11px; border-bottom-color: #e8ebee; font-size: 11px; letter-spacing: .14em; }
.section-label::before { width: 4px; height: 19px; border-radius: 4px; background: var(--gold); content: ""; }
.required { font-weight: 900; }
.field-help { margin-top: 1px; }
.upload-box { min-height: 82px; padding: 17px 19px; border-radius: 12px; background: linear-gradient(135deg, #fff, #faf7f8); transition: border-color .16s ease, background .16s ease, transform .16s ease; }
.upload-box:hover { border-color: var(--wine) !important; background: #fff8fa; transform: translateY(-1px); }
.upload-box input { cursor: pointer; }
.form-actions { margin-top: 29px; padding-top: 19px; border-top: 1px solid #edf0f2; }
.primary-button, .secondary-button { min-height: 46px; border-radius: 10px; }
.primary-button { box-shadow: 0 7px 16px rgba(105, 11, 38, .14); }
.secondary-button { border: 1px solid #e1e5e9; }
.certificate-preview-grid { gap: 32px; }
.qr-preview { position: sticky; top: 22px; border-radius: 16px; box-shadow: 0 9px 25px rgba(29, 39, 52, .05); }
.certificate-code { border-radius: 10px; }
.flash { border: 1px solid transparent; border-radius: 11px; }
.quick-actions { gap: 15px; }
.quick-action { min-height: 74px; border-radius: 13px; }
.data-table th { letter-spacing: .06em; }
.action-button { border-radius: 8px; }

@media (max-width: 760px) {
    .form-card { padding: 22px 18px; }
    .qr-preview { position: static; }
    .form-actions { align-items: stretch; flex-direction: column-reverse; }
    .form-actions > * { width: 100%; }
}

@media (max-width: 1240px) {
    .admin-shell { grid-template-columns: minmax(0, 1fr) 245px; }
    .admin-main { padding-right: 22px; padding-left: 22px; }
    .metric-grid { gap: 13px; }
    .metric-card { padding-right: 20px; padding-left: 20px; }
    .metric-card strong { font-size: 39px; }
    .metric-time strong { font-size: 33px; }
}
@media (max-width: 960px) {
    .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .report-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .quick-actions { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
    .admin-shell { display: flex; flex-direction: column; }
    .admin-main { order: 1; padding: 18px; }
    .admin-sidebar { order: 2; min-height: 0; max-height: none; border-top: 1px solid #e1e4e8; border-left: 0; position: static; }
    .sidebar-bottom { margin-top: 18px; }
    .certificate-preview-grid { grid-template-columns: 1fr; }
    .admin-topbar { align-items: flex-start; }
    .topbar-meta { display: none; }
}
@media (max-width: 560px) {
    .admin-main { padding: 12px; }
    .admin-topbar { margin-bottom: 18px; }
    .metric-grid, .form-grid.two, .form-grid.three, .report-grid, .success-details { grid-template-columns: 1fr; }
    .search-form, .upload-inline { flex-wrap: wrap; }
    .search-box { width: 100%; flex-basis: 100%; }
    .table-heading { padding: 18px 17px 15px; }
    .form-card { padding: 21px 17px; }
    .upload-box { align-items: flex-start; flex-wrap: wrap; }
    .upload-box input { width: 100%; margin-left: 56px; }
    .success-links { flex-direction: column; gap: 9px; }
    .user-actions { align-items: stretch; flex-direction: column; }
    .user-actions .secondary-button { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
    .brand-block img, .form-card { animation: none; }
    .form-close:hover { transform: none; }
}

/* Exportación del padrón y expediente digital - v18 */
.table-heading__actions { display: flex; align-items: center; justify-content: flex-end; gap: 12px; }
.export-button { color: #216b45; background: #e8f7ef; border-color: #c9ead8; }
.export-button:hover { color: #155438; background: #d9f1e4; }
.action-expediente { color: #286da2; background: #e3f1fb; }
.action-expediente:hover { color: #18547f; background: #d4eafb; }
.action-expediente--empty { color: #8aa0b3; background: #f1f6fa; }
.table-description { margin: 7px 0 0; color: var(--muted); font-size: 13px; }
.person-link { color: var(--wine); font-weight: 800; text-decoration: none; }
.person-link:hover { text-decoration: underline; }
.file-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; }
.file-name { display: block; color: #26313b; word-break: break-word; }
.file-meta { display: block; margin-top: 4px; color: #8a929b; font-size: 11px; }
.file-missing { color: #a91235; font-size: 12px; font-weight: 800; }
.expediente-detail-card { max-width: 1100px; }
.expediente-person { display: flex; align-items: center; gap: 15px; margin: 0 0 21px; padding: 17px 18px; border: 1px solid #e6e9ed; border-radius: 14px; background: linear-gradient(135deg, #fff, #fbf7f8); }
.expediente-person__avatar { display: grid; width: 52px; height: 52px; flex: 0 0 52px; place-items: center; border-radius: 14px; color: #fff; background: linear-gradient(135deg, var(--wine), #9e2e50); box-shadow: 0 9px 20px rgba(105, 11, 38, .16); font-size: 23px; }
.expediente-person .eyebrow { margin-bottom: 4px; }
.expediente-person h3 { margin: 0; color: var(--wine); font-size: clamp(18px, 2vw, 23px); text-transform: uppercase; }
.expediente-person p { margin: 6px 0 0; color: var(--muted); }
.expediente-person p strong { color: #343c45; }
.storage-location { display: flex; align-items: center; gap: 13px; margin: 0 0 19px; padding: 14px 16px; border: 1px solid #dce9f1; border-left: 4px solid #286da2; border-radius: 11px; color: #44515c; background: #f4faff; }
.storage-location__icon { display: grid; width: 37px; height: 37px; flex: 0 0 37px; place-items: center; border-radius: 10px; color: #286da2; background: #dceefa; font-size: 18px; font-weight: 900; }
.storage-location strong, .storage-location code, .storage-location small { display: block; }
.storage-location code { margin-top: 4px; color: #205c88; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12px; word-break: break-word; }
.storage-location small { margin-top: 4px; color: #7d8994; font-size: 11px; }
.detail-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 10px; margin-top: 21px; padding-top: 19px; border-top: 1px solid #edf0f2; }
.file-type-badge { display: inline-flex; min-width: 58px; align-items: center; justify-content: center; padding: 7px 8px; border-radius: 8px; font-size: 10px; font-weight: 900; letter-spacing: .05em; }
.file-type-badge--pdf { color: #a91235; background: #ffe8ed; }
.file-type-badge--imagen { color: #176b70; background: #dcf7f2; }
.file-type-badge--word { color: #285e9b; background: #e3efff; }
.file-type-badge--archivo { color: #59636d; background: #eef0f2; }

@media (max-width: 1100px) and (min-width: 961px) {
    .quick-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
    .table-heading { align-items: flex-start; flex-direction: column; }
    .table-heading__actions { width: 100%; align-items: flex-start; justify-content: space-between; }
    .expediente-person { align-items: flex-start; }
    .detail-actions { align-items: stretch; flex-direction: column; }
    .detail-actions > * { width: 100%; }
    .file-actions .primary-button, .file-actions .secondary-button { min-height: 34px; }
}
