:root {
    --navy: #13263f;
    --navy-deep: #0b1728;
    --blue: #2f7df6;
    --blue-soft: #eaf2ff;
    --cyan: #51b8dc;
    --surface: #ffffff;
    --background: #f4f7fb;
    --border: #dfe6ef;
    --text: #172033;
    --muted: #6d788a;
    --success: #14865f;
    --success-soft: #e8f7f1;
    --danger: #c63d4d;
    --danger-soft: #fff0f2;
    --shadow: 0 24px 70px rgba(17, 37, 66, .13);
    --radius: 22px;
}

* { box-sizing: border-box; }
html { min-height: 100%; }
body {
    margin: 0;
    min-height: 100vh;
    color: var(--text);
    background: var(--background);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button, input { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.brand { display: inline-flex; align-items: center; gap: 13px; }
.brand-mark {
    display: inline-grid;
    place-items: center;
    width: 46px;
    height: 46px;
    border-radius: 15px;
    color: white;
    background: linear-gradient(145deg, var(--blue), var(--cyan));
    font-size: 23px;
    font-weight: 800;
    box-shadow: 0 10px 25px rgba(47, 125, 246, .28);
}
.brand strong, .brand small { display: block; }
.brand strong { font-size: 18px; letter-spacing: -.02em; }
.brand small { margin-top: 2px; color: var(--muted); font-size: 11px; }
.brand-small .brand-mark { width: 39px; height: 39px; border-radius: 12px; font-size: 19px; }
.brand-small strong { font-size: 16px; }
.brand-small small { font-size: 10px; }
.brand-centered { justify-content: center; }

.brand-logo {
    display: block;
    width: auto;
    max-width: 100%;
    height: auto;
    object-fit: contain;
    object-position: left center;
    mix-blend-mode: multiply;
}
.brand-logo-topbar { width: 290px; max-height: 50px; }
.brand-logo-drop { width: min(430px, 100%); }
.brand-logo-login { width: min(360px, 100%); margin: 0 auto; }

.eyebrow {
    display: inline-block;
    color: var(--blue);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .13em;
    text-transform: uppercase;
}
.muted { color: var(--muted); }

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 43px;
    padding: 0 18px;
    border: 1px solid transparent;
    border-radius: 12px;
    font-weight: 750;
    transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.button:hover { transform: translateY(-1px); }
.button-primary { color: white; background: linear-gradient(135deg, var(--blue), #2466d4); box-shadow: 0 9px 22px rgba(47, 125, 246, .24); }
.button-secondary { color: var(--navy); background: white; border-color: var(--border); }
.button-danger { color: var(--danger); background: var(--danger-soft); border-color: #f3c7cd; }
.button-large { min-height: 50px; padding-inline: 26px; border-radius: 14px; }
.button-small { min-height: 36px; padding-inline: 13px; border-radius: 10px; font-size: 13px; }
.button-block { width: 100%; }
.button:disabled { cursor: not-allowed; opacity: .5; transform: none; box-shadow: none; }

.field { display: grid; gap: 8px; }
.field > span, .field legend { color: var(--navy); font-size: 13px; font-weight: 750; }
.field em { color: var(--muted); font-size: 11px; font-style: normal; font-weight: 500; }
.field input {
    width: 100%;
    height: 48px;
    padding: 0 14px;
    color: var(--text);
    background: white;
    border: 1px solid var(--border);
    border-radius: 12px;
    outline: none;
    transition: border .15s, box-shadow .15s;
}
.field input:focus { border-color: var(--blue); box-shadow: 0 0 0 4px rgba(47, 125, 246, .1); }
.field small { color: var(--muted); font-size: 12px; }
fieldset.field { padding: 0; border: 0; }

.alert { margin-bottom: 18px; padding: 14px 16px; border-radius: 12px; font-size: 14px; }
.alert-danger { color: #922b39; background: var(--danger-soft); border: 1px solid #f3c7cd; }
.alert-success { color: #0c6848; background: var(--success-soft); border: 1px solid #bce8d7; }

.drop-body {
    background:
        radial-gradient(circle at 15% 0%, rgba(81,184,220,.22), transparent 33%),
        radial-gradient(circle at 92% 10%, rgba(47,125,246,.18), transparent 30%),
        linear-gradient(145deg, #edf4fb, #f8fafc 55%, #eef3f9);
}
.drop-shell { width: min(920px, calc(100% - 34px)); margin: 0 auto; padding: 34px 0 24px; }
.drop-header { margin-bottom: 25px; }
.drop-card { padding: clamp(25px, 5vw, 48px); background: rgba(255,255,255,.94); border: 1px solid rgba(255,255,255,.9); border-radius: 28px; box-shadow: var(--shadow); backdrop-filter: blur(15px); }
.drop-intro h1 { margin: 10px 0 9px; color: var(--navy-deep); font-size: clamp(28px, 5vw, 43px); line-height: 1.08; letter-spacing: -.045em; }
.drop-intro p { max-width: 680px; margin: 0; color: var(--muted); font-size: 16px; line-height: 1.6; }
.quota-card { display: grid; gap: 9px; margin: 28px 0 25px; padding: 17px 19px; background: #f7f9fc; border: 1px solid var(--border); border-radius: 16px; }
.quota-card > div:first-child { display: flex; justify-content: space-between; gap: 15px; font-size: 13px; }
.quota-card > div:first-child span, .quota-card small { color: var(--muted); }
.progress-track { height: 7px; overflow: hidden; background: #e3e9f1; border-radius: 999px; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--blue), var(--cyan)); border-radius: inherit; transition: width .25s ease; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.upload-form { display: grid; gap: 20px; }
.drop-zone {
    display: grid;
    place-items: center;
    gap: 7px;
    width: 100%;
    min-height: 235px;
    padding: 28px;
    color: var(--navy);
    background: linear-gradient(180deg, #fbfdff, #f5f9ff);
    border: 2px dashed #afc8ea;
    border-radius: 20px;
    transition: border .2s, background .2s, transform .2s;
}
.drop-zone:hover, .drop-zone.dragging { background: var(--blue-soft); border-color: var(--blue); transform: translateY(-2px); }
.drop-zone strong { font-size: 18px; }
.drop-zone span:not(.upload-icon), .drop-zone small { color: var(--muted); }
.upload-icon { display: grid; place-items: center; width: 58px; height: 58px; margin-bottom: 3px; color: white; background: linear-gradient(145deg, var(--blue), var(--cyan)); border-radius: 18px; font-size: 29px; font-weight: 800; box-shadow: 0 13px 28px rgba(47,125,246,.24); }
.upload-actions { display: flex; align-items: center; gap: 16px; }
.global-message { color: var(--muted); font-size: 13px; }
.global-message.success { color: var(--success); }
.global-message.error { color: var(--danger); }
.upload-queue { display: grid; gap: 10px; }
.queue-item { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) 130px 130px 28px; align-items: center; gap: 13px; padding: 13px 14px; background: #fafbfd; border: 1px solid var(--border); border-radius: 13px; }
.queue-file { min-width: 0; }
.queue-file strong, .queue-file span { display: block; }
.queue-file strong { overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.queue-file span, .queue-status { color: var(--muted); font-size: 11px; }
.queue-progress { height: 6px; overflow: hidden; background: #e2e8ef; border-radius: 999px; }
.queue-progress div { height: 100%; background: var(--blue); transition: width .15s; }
.queue-item.success .queue-progress div { background: var(--success); }
.queue-item.error .queue-progress div { background: var(--danger); }
.queue-item.success .queue-status { color: var(--success); }
.queue-item.error .queue-status { color: var(--danger); }
.queue-remove { width: 28px; height: 28px; padding: 0; color: var(--muted); background: transparent; border: 0; border-radius: 8px; font-size: 20px; }
.queue-remove:hover { color: var(--danger); background: var(--danger-soft); }
.drop-footer { padding: 20px; color: var(--muted); text-align: center; font-size: 12px; }
.empty-state { padding: 55px 15px; text-align: center; }
.empty-state h1 { margin: 16px 0 8px; color: var(--navy); font-size: 30px; }
.empty-state p { margin: 5px 0; color: var(--muted); }
.status-icon { display: grid; place-items: center; width: 64px; height: 64px; margin: 0 auto; border-radius: 20px; font-size: 32px; font-weight: 700; }
.status-error { color: var(--danger); background: var(--danger-soft); }
.status-muted { color: var(--muted); background: #eef1f5; }

.login-body { display: grid; place-items: center; padding: 24px; background: linear-gradient(145deg, #eaf2fb, #f7f9fc); }
.login-card { display: grid; gap: 28px; width: min(440px, 100%); padding: 38px; background: white; border: 1px solid white; border-radius: 25px; box-shadow: var(--shadow); }
.login-card h1 { margin: 9px 0 7px; font-size: 34px; letter-spacing: -.04em; }
.login-card p { margin: 0; color: var(--muted); line-height: 1.55; }
.stack-form { display: grid; gap: 20px; }

.admin-body { background: #f4f6f9; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; min-height: 72px; padding: 10px max(24px, calc((100vw - 1220px) / 2)); background: rgba(255,255,255,.94); border-bottom: 1px solid var(--border); backdrop-filter: blur(14px); }
.topnav { display: flex; align-items: center; gap: 22px; color: var(--muted); font-size: 14px; font-weight: 700; }
.topnav a:hover { color: var(--blue); }
.admin-container { width: min(1180px, calc(100% - 36px)); margin: 0 auto; padding: 42px 0 70px; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 25px; margin-bottom: 28px; }
.page-heading h1 { margin: 8px 0 7px; color: var(--navy-deep); font-size: clamp(30px, 4vw, 44px); letter-spacing: -.045em; }
.page-heading p { margin: 0; color: var(--muted); }
.compact-heading { align-items: center; margin-bottom: 22px; }
.back-link { display: inline-block; margin-bottom: 9px; color: var(--blue); font-size: 13px; font-weight: 750; }
.heading-line { display: flex; align-items: center; gap: 14px; }
.heading-line h1 { margin-bottom: 0; }
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 17px; margin-bottom: 24px; }
.stat-card { padding: 20px 22px; background: white; border: 1px solid var(--border); border-radius: 17px; box-shadow: 0 8px 25px rgba(24,39,63,.045); }
.stat-card span, .stat-card strong { display: block; }
.stat-card span { color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; }
.stat-card strong { margin-top: 8px; color: var(--navy); font-size: 27px; }
.panel { margin-bottom: 22px; padding: 24px; background: white; border: 1px solid var(--border); border-radius: 20px; box-shadow: 0 8px 28px rgba(24,39,63,.045); }
.form-panel { max-width: 780px; }
.links-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.link-card { display: grid; gap: 17px; padding: 21px; background: white; border: 1px solid var(--border); border-radius: 18px; box-shadow: 0 8px 25px rgba(24,39,63,.04); }
.link-card-head, .link-meta, .link-dates { display: flex; justify-content: space-between; gap: 12px; }
.link-card h2 { min-height: 50px; margin: 0; color: var(--navy); font-size: 18px; line-height: 1.4; }
.link-meta { color: var(--muted); font-size: 12px; }
.link-meta strong { color: var(--text); }
.link-dates { color: var(--muted); font-size: 11px; }
.badge { display: inline-flex; align-items: center; width: fit-content; min-height: 27px; padding: 0 10px; border-radius: 999px; font-size: 11px; font-weight: 800; }
.badge-success { color: var(--success); background: var(--success-soft); }
.badge-danger { color: var(--danger); background: var(--danger-soft); }
.badge-muted { color: #667184; background: #edf0f4; }
.empty-panel { padding: 55px 25px; text-align: center; }
.empty-panel h2 { margin: 0 0 7px; }
.empty-panel p { margin: 0 0 20px; color: var(--muted); }
.slim-empty { padding: 30px; }
.slim-empty p { margin: 0; }
.radio-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.radio-card { position: relative; }
.radio-card input { position: absolute; opacity: 0; }
.radio-card span { display: grid; place-items: center; min-height: 48px; padding: 8px; color: var(--muted); background: #f9fafc; border: 1px solid var(--border); border-radius: 12px; font-size: 13px; font-weight: 700; }
.radio-card input:checked + span { color: var(--blue); background: var(--blue-soft); border-color: var(--blue); box-shadow: 0 0 0 3px rgba(47,125,246,.08); }
.info-box { display: flex; justify-content: space-between; gap: 16px; padding: 15px 17px; background: #f7f9fc; border: 1px solid var(--border); border-radius: 13px; font-size: 13px; }
.info-box span { color: var(--muted); }
.share-box { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 17px; background: var(--blue-soft); border: 1px solid #cfe0fb; border-radius: 15px; }
.share-box span, .share-box code { display: block; }
.share-box span { margin-bottom: 5px; color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; }
.share-box code { overflow-wrap: anywhere; color: var(--navy); font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 14px; font-weight: 750; }
.overview-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin: 23px 0 17px; }
.overview-grid span, .overview-grid strong { display: block; }
.overview-grid span { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; }
.overview-grid strong { margin-top: 5px; color: var(--navy); }
.large-track { height: 9px; }
.management-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--border); }
.inline-expiry-form { display: flex; gap: 8px; }
.inline-expiry-form input { min-height: 43px; padding: 0 11px; border: 1px solid var(--border); border-radius: 11px; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.panel-heading h2 { margin: 0 0 5px; color: var(--navy); }
.panel-heading p { margin: 0; color: var(--muted); font-size: 13px; }
.file-list { display: grid; gap: 10px; }
.file-row { display: grid; grid-template-columns: 42px minmax(0, 1fr) auto; align-items: center; gap: 14px; padding: 15px; background: #fafbfd; border: 1px solid var(--border); border-radius: 14px; }
.file-icon { display: grid; place-items: center; width: 42px; height: 42px; color: var(--blue); background: var(--blue-soft); border-radius: 12px; font-size: 20px; font-weight: 800; }
.file-main { min-width: 0; }
.file-main strong { display: block; overflow: hidden; color: var(--navy); text-overflow: ellipsis; white-space: nowrap; }
.file-main span { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; }
.file-main p { margin: 7px 0 0; color: #465268; font-size: 12px; }
.file-actions { display: flex; gap: 7px; }
.danger-zone { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 20px 23px; background: var(--danger-soft); border: 1px solid #f3c7cd; border-radius: 17px; }
.danger-zone strong, .danger-zone span { display: block; }
.danger-zone strong { color: #8f2936; }
.danger-zone span { margin-top: 3px; color: #a45b65; font-size: 12px; }

@media (max-width: 900px) {
    .links-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .overview-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 680px) {
    .drop-shell { width: min(100% - 20px, 920px); padding-top: 18px; }
    .drop-card { border-radius: 21px; }
    .form-grid, .stats-grid, .links-grid, .radio-grid { grid-template-columns: 1fr; }
    .queue-item { grid-template-columns: minmax(0, 1fr) 30px; }
    .queue-progress, .queue-status { grid-column: 1 / -1; }
    .upload-actions, .page-heading, .share-box, .panel-heading, .danger-zone { align-items: stretch; flex-direction: column; }
    .upload-actions { display: grid; }
    .topbar { align-items: flex-start; padding: 12px 16px; }
    .brand-logo-topbar { width: 190px; max-height: 40px; }
    .topnav { gap: 11px; font-size: 12px; }
    .topnav .button { display: none; }
    .admin-container { width: min(100% - 22px, 1180px); padding-top: 25px; }
    .file-row { grid-template-columns: 42px minmax(0, 1fr); }
    .file-actions { grid-column: 1 / -1; }
    .inline-expiry-form { width: 100%; flex-direction: column; }
    .management-actions form:not(.inline-expiry-form), .management-actions form button { width: 100%; }
}

/* Límites configurables por enlace */
.limits-panel {
    display: grid;
    gap: 22px;
    padding: 20px;
    background: #f7f9fc;
    border: 1px solid var(--border);
    border-radius: 16px;
}
.limits-heading strong, .limits-heading span { display: block; }
.limits-heading strong { color: var(--navy); font-size: 15px; }
.limits-heading span { margin-top: 4px; color: var(--muted); font-size: 12px; }
.range-field { display: grid; gap: 10px; }
.range-title { display: flex; align-items: center; justify-content: space-between; gap: 16px; color: var(--navy); font-size: 13px; font-weight: 750; }
.range-title output { min-width: 76px; padding: 7px 10px; color: var(--blue); background: var(--blue-soft); border-radius: 10px; text-align: center; }
.range-field input[type="range"] {
    width: 100%;
    height: 6px;
    margin: 7px 0 0;
    padding: 0;
    accent-color: var(--blue);
    background: transparent;
    border: 0;
    box-shadow: none;
}
.range-field input[type="range"]:focus { box-shadow: none; }
.range-labels { display: flex; justify-content: space-between; color: var(--muted); font-size: 10px; font-weight: 700; }
.range-field small { color: var(--muted); font-size: 11px; }
.link-limit { margin-top: -9px; color: var(--muted); font-size: 11px; }
.overview-grid { grid-template-columns: repeat(3, 1fr); }

@media (max-width: 900px) {
    .overview-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 680px) {
    .range-title { align-items: flex-start; }
    .range-labels { font-size: 9px; }
}
