:root {
  color-scheme: dark;
  --bg: #07101d;
  --surface: #0d1828;
  --surface-2: #132136;
  --surface-3: #182941;
  --line: #223550;
  --text: #eef5ff;
  --muted: #92a4bb;
  --accent: #f59e0b;
  --accent-2: #fbbf24;
  --danger: #fb7185;
  --success: #34d399;
  --shadow: 0 18px 50px rgba(0,0,0,.28);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body { min-height: 100vh; margin: 0; background: radial-gradient(circle at 80% 0%, rgba(245,158,11,.08), transparent 28rem), var(--bg); color: var(--text); }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }
.hidden { display: none !important; }
.mobile-only { display: none; }
.muted { color: var(--muted); }
code { padding: .12rem .35rem; border-radius: .35rem; background: #081321; color: #dcecff; }

.login-screen { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; }
.login-card { width: min(440px,100%); padding: 2rem; border: 1px solid var(--line); border-radius: 24px; background: rgba(13,24,40,.95); box-shadow: var(--shadow); }
.login-card h1 { margin: 2rem 0 .4rem; font-size: 2rem; }
.login-card > p { margin: 0 0 1.5rem; color: var(--muted); }
.brand { display: flex; align-items: center; gap: .8rem; }
.brand-mark { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 13px; background: linear-gradient(135deg,var(--accent-2),#ea580c); color: #15100a; font-weight: 900; box-shadow: 0 8px 30px rgba(245,158,11,.25); }
.brand strong, .brand span { display: block; }
.brand strong { letter-spacing: .02em; }
.brand span { margin-top: .15rem; color: var(--muted); font-size: .78rem; }
.brand-large .brand-mark { width: 52px; height: 52px; font-size: 1.3rem; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 260px minmax(0,1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 1.2rem; border-right: 1px solid var(--line); background: rgba(8,18,31,.96); overflow-y: auto; z-index: 30; }
.sidebar-header { display: flex; align-items: center; justify-content: space-between; padding: .4rem .2rem 1.2rem; }
.nav { display: flex; flex-direction: column; gap: .25rem; flex: 1; }
.nav-label { margin: 1.15rem .65rem .35rem; color: #61758e; font-size: .68rem; font-weight: 800; text-transform: uppercase; letter-spacing: .14em; }
.nav-item { display: flex; align-items: center; gap: .75rem; width: 100%; padding: .7rem .8rem; border: 1px solid transparent; border-radius: 11px; background: transparent; color: #a9b8ca; text-align: left; transition: .18s ease; }
.nav-item span { width: 1.3rem; color: #70849e; font-size: 1.05rem; text-align: center; }
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { border-color: rgba(245,158,11,.32); background: rgba(245,158,11,.09); color: #ffd88d; }
.nav-item.active span { color: var(--accent-2); }
.sidebar-footer { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: 1rem .35rem .1rem; border-top: 1px solid var(--line); color: var(--muted); font-size: .82rem; }

.workspace { min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 20; min-height: 82px; display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 2rem; border-bottom: 1px solid rgba(34,53,80,.8); background: rgba(7,16,29,.86); backdrop-filter: blur(16px); }
.topbar h1 { margin: .1rem 0 0; font-size: 1.4rem; }
.topbar p { margin: 0; color: var(--muted); font-size: .75rem; text-transform: uppercase; letter-spacing: .1em; }
.content { width: min(1500px,100%); margin: 0 auto; padding: 2rem; }
.panel { display: none; animation: enter .2s ease; }
.panel.active { display: block; }
@keyframes enter { from { opacity: 0; transform: translateY(4px); } }

.hero { display: flex; justify-content: space-between; align-items: flex-end; gap: 2rem; min-height: 220px; padding: 2.2rem; border: 1px solid #2d4261; border-radius: 24px; background: radial-gradient(circle at 82% 20%,rgba(245,158,11,.2),transparent 18rem), linear-gradient(135deg,#10213a,#0b1524); box-shadow: var(--shadow); }
.hero h2 { max-width: 700px; margin: .5rem 0 .65rem; font-size: clamp(2rem,4vw,3.5rem); line-height: 1.02; letter-spacing: -.04em; }
.hero p { max-width: 650px; margin: 0; color: #a7b8cc; font-size: 1.02rem; }
.eyebrow { color: var(--accent-2); font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .14em; }
.section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; }
.section-heading h2 { margin: .3rem 0 .25rem; font-size: 2rem; letter-spacing: -.03em; }
.section-heading p { margin: 0; color: var(--muted); }

.grid { display: grid; gap: 1.2rem; }
.grid.two { grid-template-columns: repeat(2,minmax(0,1fr)); }
.grid.three { grid-template-columns: repeat(3,minmax(0,1fr)); }
.grid.four { grid-template-columns: repeat(4,minmax(0,1fr)); }
.grid.compact { gap: .75rem; }
.form-and-list { grid-template-columns: minmax(300px,.7fr) minmax(420px,1.3fr); align-items: start; }
.form-and-preview { grid-template-columns: minmax(320px,.85fr) minmax(320px,1.15fr); }
.wide-form { grid-template-columns: minmax(460px,1.1fr) minmax(330px,.9fr); }
.stats-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 1rem; margin: 1.2rem 0; }
.stat { min-height: 125px; padding: 1.2rem; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); }
.stat strong { display: block; margin-top: .7rem; font-size: 1.8rem; }
.stat span { color: var(--muted); font-size: .8rem; }
.card { padding: 1.25rem; border: 1px solid var(--line); border-radius: 18px; background: linear-gradient(180deg,rgba(19,33,54,.9),rgba(13,24,40,.96)); box-shadow: 0 8px 30px rgba(0,0,0,.12); }
.card h3 { margin: 0; }
.card > p { color: var(--muted); }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.card-header p { margin: .25rem 0 0; color: var(--muted); font-size: .84rem; }
.card-list { display: flex; flex-direction: column; gap: .8rem; }
.grid-cards { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); margin-top: 1rem; }
.list-card { padding: 1rem; border: 1px solid var(--line); border-radius: 15px; background: var(--surface); }
.list-card h3 { margin: 0 0 .35rem; }
.list-card p { margin: .3rem 0; color: var(--muted); white-space: pre-wrap; overflow-wrap: anywhere; }
.list-card .meta { display: flex; flex-wrap: wrap; gap: .45rem; margin-top: .8rem; color: #71869f; font-size: .75rem; }
.list-card .actions { display: flex; flex-wrap: wrap; gap: .45rem; margin-top: .9rem; }
.quick-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; }
.quick-grid button { padding: 1rem; border: 1px solid var(--line); border-radius: 12px; background: #0c192a; color: #dce8f7; text-align: left; }
.quick-grid button:hover { border-color: #436185; background: #10223a; }
.check-list { display: grid; gap: .75rem; margin: 1rem 0 0; padding: 0; list-style: none; color: #aab9cb; }
.check-list li::before { content: "✓"; margin-right: .65rem; color: var(--success); font-weight: 900; }

.stack { display: flex; flex-direction: column; gap: 1rem; }
label { display: flex; flex-direction: column; gap: .4rem; color: #b6c4d5; font-size: .82rem; font-weight: 650; }
input, textarea, select { width: 100%; border: 1px solid #2b405d; border-radius: 11px; outline: none; background: #081523; color: var(--text); padding: .78rem .85rem; transition: .16s ease; }
input:focus, textarea:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(245,158,11,.12); }
textarea { resize: vertical; min-height: 90px; }
input[type="file"] { padding: .65rem; color: var(--muted); }
.check { flex-direction: row; align-items: center; gap: .55rem; }
.check input { width: 1rem; height: 1rem; }
.inline-form { display: flex; align-items: end; gap: .8rem; }
.inline-form .grow { flex: 1; }
.field-end { display: flex; justify-content: flex-end; align-items: end; }
.toolbar { display: flex; gap: .6rem; }
.toolbar input { flex: 1; }
.form-error { min-height: 1.2rem; margin: 0; color: var(--danger); font-size: .82rem; }

.button, .icon-button { border: 1px solid transparent; border-radius: 10px; color: var(--text); background: var(--surface-3); transition: .16s ease; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; min-height: 42px; padding: .65rem 1rem; text-decoration: none; font-weight: 750; }
.button:hover, .icon-button:hover { transform: translateY(-1px); filter: brightness(1.08); }
.button.primary { background: linear-gradient(135deg,var(--accent-2),#f97316); color: #211504; box-shadow: 0 8px 25px rgba(245,158,11,.2); }
.button.ghost { border-color: var(--line); background: transparent; color: #c2d0df; }
.button.danger { border-color: rgba(251,113,133,.25); background: rgba(251,113,133,.1); color: #ff9caf; }
.button.small { min-height: 34px; padding: .42rem .7rem; font-size: .75rem; }
.button:disabled { cursor: not-allowed; opacity: .45; transform: none; }
.icon-button { width: 38px; height: 38px; font-size: 1rem; }
.status-pill { padding: .42rem .7rem; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: .72rem; }
.status-pill.ok { border-color: rgba(52,211,153,.25); background: rgba(52,211,153,.08); color: #78edbd; }
.status-pill.bad { border-color: rgba(251,113,133,.25); background: rgba(251,113,133,.08); color: #ff9caf; }
.badge { display: inline-flex; align-items: center; padding: .24rem .48rem; border-radius: 999px; background: #14253a; color: #a9bdd3; font-size: .68rem; }
.badge.success { background: rgba(52,211,153,.1); color: #77e7b8; }
.badge.warning { background: rgba(245,158,11,.1); color: #ffd077; }
.badge.danger { background: rgba(251,113,133,.1); color: #ff9caf; }

.mail-layout { display: grid; grid-template-columns: 270px minmax(320px,.9fr) minmax(360px,1.1fr); gap: 1rem; align-items: stretch; }
.mail-layout > .card { min-height: 560px; padding: 1rem; }
.select-list, .message-list { display: flex; flex-direction: column; gap: .45rem; }
.select-row, .message-row { width: 100%; padding: .8rem; border: 1px solid transparent; border-radius: 11px; background: #0a1727; color: #aebdd0; text-align: left; }
.select-row:hover, .message-row:hover, .select-row.active, .message-row.active { border-color: #355276; background: #10213a; color: var(--text); }
.select-row strong, .message-row strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.select-row span, .message-row span { display: block; margin-top: .25rem; color: #7388a1; font-size: .73rem; }
.message-row.unread strong { color: #ffd078; }
.mail-reader-content h3 { margin-top: 0; }
.mail-reader-content pre { max-height: 390px; overflow: auto; padding: 1rem; border-radius: 12px; background: #081321; color: #c6d4e4; white-space: pre-wrap; overflow-wrap: anywhere; font-family: inherit; line-height: 1.55; }
.empty-state { display: grid; place-items: center; min-height: 180px; color: #627891; text-align: center; }

.file-table { border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.file-row { display: grid; grid-template-columns: minmax(0,1fr) 110px 190px; align-items: center; gap: 1rem; padding: .9rem 1rem; border-bottom: 1px solid var(--line); background: var(--surface); }
.file-row:last-child { border-bottom: 0; }
.file-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-actions { display: flex; justify-content: flex-end; gap: .45rem; }
.result-box { padding: 1rem; border: 1px solid rgba(52,211,153,.26); border-radius: 13px; background: rgba(52,211,153,.07); color: #9ce8c8; }
.qr-preview { min-height: 450px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1rem; }
.qr-preview img { width: min(340px,100%); border-radius: 16px; background: white; padding: .8rem; }
.menu-builder { display: flex; flex-direction: column; gap: .8rem; }
.menu-category { padding: .9rem; border: 1px solid var(--line); border-radius: 13px; background: #0a1727; }
.menu-category-header { display: grid; grid-template-columns: 1fr auto; gap: .5rem; align-items: center; }
.menu-item { display: grid; grid-template-columns: 1.2fr 1.5fr .55fr .8fr auto; gap: .45rem; margin-top: .55rem; }
.menu-item input { padding: .55rem .6rem; font-size: .76rem; }

.toast-region { position: fixed; right: 1rem; bottom: 1rem; z-index: 100; display: flex; flex-direction: column; gap: .6rem; width: min(380px,calc(100% - 2rem)); }
.toast { padding: .85rem 1rem; border: 1px solid #3a526f; border-radius: 12px; background: #10213a; box-shadow: var(--shadow); color: #d9e6f5; animation: toast-in .2s ease; }
.toast.error { border-color: rgba(251,113,133,.45); background: #321522; color: #ffc0cb; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

.public-menu { min-height: 100vh; padding: 2rem 1rem 5rem; background: #faf7f0; color: #1d2735; }
.public-menu .public-wrap { width: min(760px,100%); margin: 0 auto; }
.public-menu .public-header { padding: 2rem 0; border-bottom: 1px solid #d8d4ca; text-align: center; }
.public-menu h1 { margin: .5rem 0; font-size: clamp(2.2rem,7vw,4.5rem); letter-spacing: -.05em; }
.public-menu .public-header p { color: #68707b; }
.public-menu .public-category { margin-top: 2.5rem; }
.public-menu .public-category h2 { padding-bottom: .55rem; border-bottom: 2px solid currentColor; font-size: 1.35rem; }
.public-menu .public-item { display: grid; grid-template-columns: 1fr auto; gap: 1rem; padding: 1rem 0; border-bottom: 1px solid #ddd9d0; }
.public-menu .public-item h3 { margin: 0; }
.public-menu .public-item p { margin: .35rem 0 0; color: #68707b; }
.public-menu .public-price { font-weight: 850; }
.public-menu .public-allergens { font-size: .75rem; }
.public-menu.theme-blue { --public-accent:#2563eb; } .public-menu.theme-green { --public-accent:#15803d; } .public-menu.theme-rose { --public-accent:#be123c; } .public-menu.theme-violet { --public-accent:#7c3aed; } .public-menu.theme-amber { --public-accent:#b45309; }
.public-menu .public-category h2, .public-menu .public-price { color: var(--public-accent); }

@media (max-width: 1180px) {
  .stats-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .grid.three, .grid-cards { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .mail-layout { grid-template-columns: 240px 1fr; }
  .mail-reader { grid-column: 1 / -1; min-height: 380px !important; }
  .menu-item { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 860px) {
  .mobile-only { display: inline-grid; place-items: center; }
  .app-shell { display: block; }
  .sidebar { position: fixed; left: -280px; width: 260px; transition: .2s ease; }
  .sidebar.open { left: 0; box-shadow: var(--shadow); }
  .sidebar-overlay { position: fixed; inset: 0; z-index: 25; display: block; background: rgba(0,0,0,.55); }
  .topbar { padding: 1rem; justify-content: flex-start; }
  .topbar-actions { margin-left: auto; }
  .content { padding: 1rem; }
  .hero { align-items: flex-start; flex-direction: column; padding: 1.5rem; }
  .grid.two, .grid.three, .grid.four, .form-and-list, .form-and-preview, .wide-form, .mail-layout { grid-template-columns: 1fr; }
  .mail-reader { grid-column: auto; }
  .inline-form { flex-direction: column; align-items: stretch; }
  .file-row { grid-template-columns: 1fr; }
  .file-actions { justify-content: flex-start; }
}
@media (max-width: 560px) {
  .stats-grid, .grid-cards, .quick-grid { grid-template-columns: 1fr; }
  .section-heading { align-items: stretch; flex-direction: column; }
  .topbar-actions { display: none; }
  .toolbar { flex-direction: column; }
  .menu-item { grid-template-columns: 1fr; }
  .login-card { padding: 1.35rem; }
}

/* Multiusuario y administración */
.session-user { min-width: 0; padding: .35rem .5rem; border: 0; border-radius: 8px; background: transparent; color: #c7d5e6; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; }
.session-user:hover { background: var(--surface-2); color: white; }
.alert { margin-bottom: 1rem; padding: 1rem 1.1rem; border: 1px solid var(--line); border-radius: 14px; }
.alert.warning { border-color: rgba(245,158,11,.4); background: rgba(245,158,11,.1); color: #ffdda0; }
.permission-summary { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1rem; }
.admin-layout { display: grid; grid-template-columns: minmax(360px,.8fr) minmax(520px,1.2fr); gap: 1.2rem; align-items: start; margin: 1.2rem 0; }
.admin-users-list { display: flex; flex-direction: column; gap: .55rem; max-height: 760px; overflow: auto; }
.admin-user-row { display: grid; grid-template-columns: 42px minmax(0,1fr) auto; align-items: center; gap: .75rem; width: 100%; padding: .75rem; border: 1px solid var(--line); border-radius: 13px; background: #0a1727; color: var(--text); text-align: left; }
.admin-user-row:hover { border-color: #496689; background: #10213a; }
.avatar { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 50%; background: linear-gradient(135deg,#24415f,#13243a); color: #ffcf74; font-weight: 900; }
.admin-user-main, .admin-user-usage { display: flex; min-width: 0; flex-direction: column; gap: .25rem; }
.admin-user-main strong, .admin-user-main small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-user-main small, .admin-user-usage small { color: var(--muted); }
.admin-user-usage { align-items: flex-end; }
.permissions-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: .75rem; }
.permission-group { min-width: 0; margin: 0; padding: .8rem; border: 1px solid var(--line); border-radius: 12px; background: #091523; }
.permission-group legend { padding: 0 .35rem; color: var(--accent-2); font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.permission-check { margin: .45rem 0; font-size: .78rem; }
.audit-list { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 13px; overflow: hidden; }
.audit-row { display: grid; grid-template-columns: 150px 130px minmax(180px,1fr) minmax(100px,.8fr) 130px; gap: .75rem; align-items: center; padding: .7rem .8rem; border-bottom: 1px solid var(--line); background: #091523; font-size: .76rem; }
.audit-row:last-child { border-bottom: 0; }
.audit-row code { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.audit-row small, .audit-row > span { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@media (max-width: 1180px) {
  .admin-layout { grid-template-columns: 1fr; }
  .audit-row { grid-template-columns: 125px 110px minmax(170px,1fr) 100px; }
  .audit-row small { display: none; }
}
@media (max-width: 700px) {
  .permissions-grid { grid-template-columns: 1fr; }
  .admin-user-row { grid-template-columns: 38px minmax(0,1fr); }
  .admin-user-usage { grid-column: 2; align-items: flex-start; flex-direction: row; }
  .audit-row { grid-template-columns: 1fr; gap: .25rem; }
  .audit-row > * { white-space: normal; }
}

/* WolfingPi 4: correo real y transferencias */
.provider-note { margin-top: 1rem; color: var(--muted); font-size: .76rem; text-align: right; }
.provider-note a { color: var(--accent-2); }
.select-row-wrap { display: grid; grid-template-columns: minmax(0,1fr) 36px; gap: .35rem; align-items: center; }
.select-row-wrap .select-row { min-width: 0; }
.danger-icon { color: #ff9caf; }
.share-layout { align-items: start; }
.share-list-card { margin-top: 1rem; }
.share-list { display: flex; flex-direction: column; gap: .65rem; }
.share-row { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 1rem; align-items: center; padding: 1rem; border: 1px solid var(--line); border-radius: 14px; background: #091523; }
.share-main h3 { margin: .5rem 0 .25rem; }
.share-main p, .share-main small { margin: 0; color: var(--muted); }
.share-main .badge + .badge { margin-left: .4rem; }
.share-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .45rem; }
.copy-line { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: .5rem; margin-top: .7rem; }
.copy-line input { min-width: 0; }
.share-public-page { min-height: 100vh; display: grid; place-items: center; padding: 1rem; background: radial-gradient(circle at top,#153252 0,#08111f 48%,#050a11 100%); color: var(--text); }
.share-public-card { width: min(620px,100%); padding: 2rem; border: 1px solid var(--line); border-radius: 22px; background: rgba(9,21,35,.96); box-shadow: var(--shadow); }
.share-public-card h1 { margin: 1rem 0 .5rem; font-size: clamp(1.8rem,6vw,3rem); overflow-wrap: anywhere; }
.share-meta { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: .65rem; margin: 1.4rem 0; }
.share-meta div { padding: .8rem; border: 1px solid var(--line); border-radius: 12px; background: #07111d; }
.share-meta dt { color: var(--muted); font-size: .72rem; }
.share-meta dd { margin: .25rem 0 0; overflow-wrap: anywhere; font-weight: 800; }
.small-print { margin-top: 1rem; font-size: .72rem; text-align: center; }
@media (max-width: 700px) {
  .share-row { grid-template-columns: 1fr; }
  .share-actions { justify-content: flex-start; }
  .share-meta { grid-template-columns: 1fr; }
  .copy-line { grid-template-columns: 1fr; }
}

/* WolfingPi Hub 5: PWA móvil y PDF Studio */
html { scroll-behavior: smooth; }
body { -webkit-tap-highlight-color: transparent; }
button, input, select, textarea { min-height: 44px; }
input[type="checkbox"], input[type="radio"] { min-height: auto; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible { outline: 3px solid rgba(251,191,36,.45); outline-offset: 2px; }

.pdf-heading { align-items: center; }
.pdf-help { display: grid; grid-template-columns: minmax(0,1fr) minmax(420px,.9fr); gap: 1rem; align-items: center; margin-bottom: 1rem; }
.pdf-help > div { display: flex; flex-direction: column; gap: .35rem; }
.pdf-help span { color: var(--muted); font-size: .82rem; line-height: 1.55; }
.pdf-inspect-inline { display: grid; grid-template-columns: minmax(160px,1fr) minmax(140px,.65fr) auto; gap: .55rem; align-items: end; }
.pdf-inspect-inline input { min-width: 0; }
.pdf-inspect-result { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: .75rem; margin: 0 0 1rem; padding: 1rem; border: 1px solid rgba(52,211,153,.28); border-radius: 16px; background: rgba(52,211,153,.07); }
.pdf-inspect-result > div { min-width: 0; padding: .8rem; border-radius: 12px; background: rgba(5,15,25,.5); }
.pdf-inspect-result span { display: block; margin-bottom: .25rem; color: var(--muted); font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; }
.pdf-inspect-result strong { display: block; overflow-wrap: anywhere; }
.pdf-group { margin: 1rem 0; border: 1px solid var(--line); border-radius: 18px; background: rgba(9,21,35,.58); overflow: clip; }
.pdf-group > summary { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 1.15rem; background: linear-gradient(90deg,rgba(245,158,11,.08),transparent); cursor: pointer; list-style: none; user-select: none; }
.pdf-group > summary::-webkit-details-marker { display: none; }
.pdf-group > summary::after { content: '⌄'; color: var(--accent-2); font-size: 1.15rem; transition: transform .18s ease; }
.pdf-group[open] > summary::after { transform: rotate(180deg); }
.pdf-group > summary span { display: flex; align-items: center; gap: .7rem; font-weight: 850; }
.pdf-group > summary b { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 10px; background: rgba(245,158,11,.14); color: #ffd785; }
.pdf-group > summary small { margin-left: auto; color: var(--muted); }
.pdf-tool-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 1rem; padding: 1rem; }
.pdf-tool { position: relative; min-width: 0; overflow: hidden; }
.pdf-tool::after { content: ''; position: absolute; right: -40px; top: -45px; width: 110px; height: 110px; border-radius: 50%; background: rgba(245,158,11,.055); pointer-events: none; }
.pdf-tool h3 { margin: 0; padding-right: 2.2rem; }
.pdf-tool p { min-height: 2.6em; margin: -.2rem 0 .1rem; color: var(--muted); font-size: .78rem; line-height: 1.45; }
.pdf-tool-icon { position: absolute; right: 1rem; top: 1rem; width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid rgba(245,158,11,.24); border-radius: 11px; background: rgba(245,158,11,.09); color: #ffd27c; font-weight: 900; }
.pdf-result { position: sticky; bottom: 1rem; z-index: 12; margin-top: 1rem; box-shadow: var(--shadow); }
.pdf-result-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.pdf-result-main { min-width: 0; }
.pdf-result-main strong, .pdf-result-main span { display: block; overflow-wrap: anywhere; }
.pdf-result-main span { margin-top: .25rem; color: #b7d7c8; font-size: .76rem; }
.pdf-result-actions { display: flex; flex-wrap: wrap; gap: .5rem; }

.mobile-dock { display: none; }

@media (max-width: 1180px) {
  .pdf-tool-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .pdf-help { grid-template-columns: 1fr; }
  .pdf-inspect-result { grid-template-columns: repeat(2,minmax(0,1fr)); }
}

@media (max-width: 860px) {
  body { padding-bottom: calc(74px + env(safe-area-inset-bottom)); }
  .workspace { padding-bottom: .5rem; }
  .topbar { min-height: 64px; padding-top: max(.7rem,env(safe-area-inset-top)); }
  .topbar h1 { font-size: 1.12rem; }
  .topbar p { display: none; }
  .content { padding-bottom: 1rem; }
  .sidebar { padding-top: max(1.2rem,env(safe-area-inset-top)); padding-bottom: calc(1.2rem + env(safe-area-inset-bottom)); }
  .mobile-dock { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; display: grid; grid-template-columns: repeat(5,1fr); min-height: calc(66px + env(safe-area-inset-bottom)); padding: .4rem .45rem calc(.4rem + env(safe-area-inset-bottom)); border-top: 1px solid #263a55; background: rgba(7,16,29,.94); backdrop-filter: blur(18px); box-shadow: 0 -12px 35px rgba(0,0,0,.3); }
  .mobile-dock button { min-width: 0; min-height: 54px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .15rem; padding: .3rem; border: 0; border-radius: 12px; background: transparent; color: #91a4bc; }
  .mobile-dock button span { font-size: 1.15rem; line-height: 1; }
  .mobile-dock button small { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .64rem; }
  .mobile-dock button.active { background: rgba(245,158,11,.11); color: #ffd27c; }
  .pdf-heading { align-items: stretch; }
  .pdf-heading #pdf-scroll-result { display: none; }
  .pdf-group > summary { align-items: flex-start; }
  .pdf-group > summary small { display: none; }
  .pdf-tool-grid { grid-template-columns: 1fr; padding: .7rem; }
  .pdf-tool { padding: 1rem; border-radius: 15px; }
  .pdf-tool p { min-height: auto; }
  .pdf-inspect-inline { grid-template-columns: 1fr; }
  .pdf-result { bottom: calc(76px + env(safe-area-inset-bottom)); }
  .pdf-result-row { align-items: stretch; flex-direction: column; }
  .pdf-result-actions { width: 100%; }
  .pdf-result-actions .button { flex: 1; }
}

@media (max-width: 560px) {
  .content { padding: .75rem; }
  .section-heading { margin-bottom: 1rem; }
  .section-heading h2 { font-size: 1.55rem; }
  .card { padding: 1rem; border-radius: 15px; }
  .pdf-help { padding: .85rem; }
  .pdf-inspect-result { grid-template-columns: 1fr; }
  .pdf-group { border-radius: 15px; }
  .pdf-group > summary { padding: .85rem; }
  .pdf-group > summary span { gap: .5rem; font-size: .88rem; }
  .pdf-group > summary b { width: 28px; height: 28px; }
  input[type="file"] { width: 100%; font-size: .76rem; }
  .button { justify-content: center; }
  .share-public-card { padding: 1.25rem; }
}

@media (display-mode: standalone) {
  .topbar { padding-top: max(1rem,env(safe-area-inset-top)); }
  .login-screen { padding-top: calc(1.5rem + env(safe-area-inset-top)); padding-bottom: calc(1.5rem + env(safe-area-inset-bottom)); }
}
