:root {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #0f172a;
  background: #f4f7fb;
  font-synthesis: none;
  --navy: #172554;
  --navy-2: #1e3a8a;
  --blue: #2563eb;
  --blue-light: #eff6ff;
  --green: #047857;
  --red: #b91c1c;
  --border: #dbe3ef;
  --muted: #64748b;
  --card: #ffffff;
  --shadow: 0 12px 32px rgba(15, 23, 42, .08);
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: linear-gradient(180deg, #edf3fb 0, #f8fafc 280px); }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.app-shell { width: min(1120px, calc(100% - 28px)); margin: 0 auto; padding: 24px 0 32px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.brand { display: flex; align-items: center; gap: 14px; }
.brand-mark { width: 52px; height: 52px; border-radius: 15px; display: grid; place-items: center; background: var(--navy); color: white; font-weight: 900; font-size: 14px; box-shadow: 0 8px 20px rgba(23, 37, 84, .22); }
h1 { margin: 0; font-size: clamp(22px, 4vw, 30px); letter-spacing: -.03em; }
.brand p { margin: 3px 0 0; color: var(--muted); font-size: 14px; }
.tabs { display: flex; gap: 8px; padding: 6px; border: 1px solid var(--border); background: rgba(255,255,255,.72); border-radius: 16px; margin-bottom: 18px; backdrop-filter: blur(10px); }
.tab { flex: 1; border: 0; background: transparent; color: #475569; padding: 12px 18px; border-radius: 11px; font-weight: 750; }
.tab.active { color: white; background: var(--navy); box-shadow: 0 5px 14px rgba(23,37,84,.18); }
.badge { display: inline-grid; place-items: center; min-width: 22px; height: 22px; margin-left: 5px; padding: 0 6px; border-radius: 999px; background: rgba(255,255,255,.16); font-size: 12px; }
.tab:not(.active) .badge { background: #e2e8f0; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }
.grid-layout { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: 20px; padding: 22px; box-shadow: var(--shadow); }
.primary-card, .action-card { grid-column: 1 / -1; }
.section-heading { display: flex; align-items: start; justify-content: space-between; gap: 14px; margin-bottom: 18px; }
.section-heading h2 { margin: 3px 0 0; font-size: 20px; }
.section-heading p { margin: 6px 0 0; color: var(--muted); font-size: 14px; }
.eyebrow { color: var(--blue); font-size: 11px; font-weight: 900; letter-spacing: .12em; }
.privacy-pill, .aes-pill { border-radius: 999px; padding: 6px 10px; font-size: 12px; font-weight: 800; white-space: nowrap; }
.privacy-pill { color: var(--green); background: #ecfdf5; }
.aes-pill { color: var(--blue); background: var(--blue-light); }
.drop-zone { width: 100%; min-height: 180px; border: 2px dashed #a8b7cd; border-radius: 18px; background: #f8fafc; color: var(--navy); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px; transition: .2s ease; }
.drop-zone:hover, .drop-zone.dragover { border-color: var(--blue); background: var(--blue-light); transform: translateY(-1px); }
.drop-zone span:last-child { color: var(--muted); font-size: 14px; }
.drop-icon { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; background: white; border: 1px solid var(--border); font-size: 24px; }
.file-card { display: flex; align-items: center; gap: 13px; padding: 13px; margin-top: 14px; border-radius: 14px; border: 1px solid var(--border); background: #fbfdff; }
.file-icon { width: 44px; height: 52px; display: grid; place-items: center; border-radius: 8px; background: #fee2e2; color: #b91c1c; font-weight: 900; font-size: 11px; }
.file-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.file-meta strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-meta span { font-size: 13px; color: var(--muted); }
.warning-text { color: #b45309 !important; font-weight: 700; }
.icon-btn { border: 0; width: 34px; height: 34px; border-radius: 10px; background: #f1f5f9; color: #475569; font-size: 22px; }
.option-list { display: grid; gap: 2px; }
.switch-row { display: grid; grid-template-columns: 1fr auto; grid-template-areas: "text switch"; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid #edf2f7; }
.switch-row > span:first-child { grid-area: text; display: flex; flex-direction: column; gap: 2px; }
.switch-row small { color: var(--muted); line-height: 1.35; }
.switch-row input { position: absolute; opacity: 0; pointer-events: none; }
.switch { grid-area: switch; width: 46px; height: 26px; background: #cbd5e1; border-radius: 999px; position: relative; transition: .2s; }
.switch::after { content: ""; position: absolute; width: 20px; height: 20px; top: 3px; left: 3px; border-radius: 50%; background: white; box-shadow: 0 1px 4px rgba(0,0,0,.2); transition: .2s; }
.switch-row input:checked + .switch { background: var(--blue); }
.switch-row input:checked + .switch::after { transform: translateX(20px); }
.advanced { margin-top: 15px; border: 1px solid var(--border); border-radius: 13px; padding: 12px 14px; background: #fafcff; }
.advanced summary { font-weight: 800; color: #334155; }
.advanced-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; padding-top: 13px; font-size: 14px; }
.field-label, .field-grid label, .input-action + .helper { display: block; }
.field-label, .field-grid label > span { color: #334155; font-weight: 750; font-size: 13px; margin-bottom: 6px; }
textarea, input[type="password"], input[type="text"], input[type="search"], select { width: 100%; border: 1px solid #cbd5e1; border-radius: 11px; background: white; padding: 11px 12px; color: #0f172a; outline: none; transition: .15s; }
textarea:focus, input:focus, select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(37,99,235,.10); }
textarea { resize: vertical; min-height: 76px; }
.field-grid { display: grid; gap: 12px; margin-top: 13px; }
.field-grid.three { grid-template-columns: repeat(3, 1fr); }
.check-row { display: flex; align-items: center; gap: 8px; color: #334155; font-size: 14px; margin-top: 13px; }
.check-row input { width: 17px; height: 17px; accent-color: var(--blue); }
.check-row.prominent { margin: 0 0 15px; font-weight: 750; }
.mini-toggle { display: flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 750; }
.mini-toggle input { accent-color: var(--blue); }
.input-action { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.input-action input { min-width: 0; }
.small-btn, .ghost-btn { border: 1px solid #cbd5e1; background: white; color: #334155; padding: 8px 11px; border-radius: 10px; font-size: 12px; font-weight: 800; white-space: nowrap; }
.small-btn:hover, .ghost-btn:hover { border-color: #94a3b8; background: #f8fafc; }
.small-btn.danger { color: var(--red); border-color: #fecaca; background: #fff7f7; }
.helper { margin: 6px 0 0; color: var(--muted); font-size: 12px; line-height: 1.45; }
.action-card { display: flex; flex-direction: column; align-items: stretch; }
.primary-btn, .download-btn { border: 0; border-radius: 14px; min-height: 54px; padding: 14px 20px; font-weight: 900; letter-spacing: .02em; margin-top: 15px; }
.primary-btn { background: linear-gradient(135deg, var(--navy), var(--navy-2)); color: white; box-shadow: 0 10px 20px rgba(30,58,138,.22); }
.primary-btn:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
.download-btn { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.status-box { margin-top: 14px; border-radius: 12px; padding: 12px 14px; font-size: 14px; font-weight: 700; }
.status-box.success { color: #065f46; background: #ecfdf5; border: 1px solid #a7f3d0; }
.status-box.error { color: #991b1b; background: #fef2f2; border: 1px solid #fecaca; }
.status-box.info { color: #1e40af; background: #eff6ff; border: 1px solid #bfdbfe; }
.legal-note { margin: 14px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; text-align: center; }
.spinner { width: 18px; height: 18px; display: inline-block; border: 2px solid rgba(255,255,255,.4); border-top-color: white; border-radius: 50%; animation: spin .7s linear infinite; vertical-align: middle; margin-left: 8px; }
@keyframes spin { to { transform: rotate(360deg); } }
.history-card { min-height: 420px; }
.history-header { align-items: center; }
.history-actions { display: flex; gap: 8px; }
.filters { display: grid; grid-template-columns: 1fr 190px 210px; gap: 10px; margin-bottom: 15px; }
.search-box { position: relative; display: flex; align-items: center; }
.search-box span { position: absolute; left: 12px; }
.search-box input { padding-left: 36px; }
.history-list { display: grid; gap: 10px; }
.history-item { display: grid; grid-template-columns: auto 1fr auto; gap: 13px; align-items: center; border: 1px solid var(--border); border-radius: 15px; padding: 13px; background: #fbfdff; }
.history-icon { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 12px; background: #eef2ff; color: var(--navy); font-weight: 900; font-size: 10px; }
.history-main { min-width: 0; }
.history-main strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.history-main > span { display: block; color: var(--muted); font-size: 12px; margin-top: 3px; }
.chips { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 7px; }
.chip { border-radius: 999px; background: #f1f5f9; color: #475569; font-size: 11px; font-weight: 750; padding: 4px 7px; }
.history-item-actions { display: flex; gap: 6px; }
.empty-state { min-height: 260px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; color: var(--muted); text-align: center; }
.empty-state div { font-size: 34px; }
.empty-state strong { color: #334155; }
.app-footer { display: flex; justify-content: space-between; gap: 16px; margin-top: 18px; padding: 10px 4px; color: #94a3b8; font-size: 12px; }
@media (max-width: 800px) {
  .grid-layout { grid-template-columns: 1fr; }
  .primary-card, .action-card { grid-column: auto; }
  .field-grid.three, .advanced-grid { grid-template-columns: 1fr; }
  .filters { grid-template-columns: 1fr; }
  .topbar { align-items: flex-start; }
  .brand p { display: none; }
  .history-header { align-items: flex-start; flex-direction: column; }
  .history-actions { width: 100%; }
  .history-actions button { flex: 1; }
  .history-item { grid-template-columns: auto minmax(0, 1fr); }
  .history-item-actions { grid-column: 1 / -1; }
  .history-item-actions button { flex: 1; }
  .app-footer { flex-direction: column; }
}
@media (max-width: 520px) {
  .app-shell { width: min(100% - 18px, 1120px); padding-top: 14px; }
  .card { padding: 17px; border-radius: 16px; }
  .tabs { position: sticky; top: 6px; z-index: 20; }
  .tab { padding: 10px 8px; font-size: 13px; }
  .input-action { flex-wrap: wrap; }
  .input-action input { flex-basis: 100%; }
  .input-action .small-btn { flex: 1; }
}

.topbar-actions { display: flex; align-items: center; gap: 8px; }
.help-btn { color: var(--navy); border-color: #bfdbfe; background: #f8fbff; }
.help-dialog { width: min(860px, calc(100% - 24px)); max-height: min(88vh, 900px); border: 0; border-radius: 22px; padding: 0; color: #0f172a; background: transparent; box-shadow: 0 28px 80px rgba(15, 23, 42, .30); }
.help-dialog::backdrop { background: rgba(15, 23, 42, .56); backdrop-filter: blur(3px); }
.help-modal { background: white; border: 1px solid var(--border); border-radius: 22px; padding: 24px; overflow-y: auto; max-height: min(88vh, 900px); }
.help-modal-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding-bottom: 18px; border-bottom: 1px solid #e7edf5; }
.help-modal-header h2 { margin: 4px 0 3px; font-size: 25px; }
.help-modal-header p { margin: 0; color: var(--muted); font-size: 14px; }
.help-section { padding: 18px 0; border-bottom: 1px solid #edf2f7; }
.help-section h3 { margin: 0 0 12px; font-size: 17px; color: var(--navy); }
.help-section p { margin: 8px 0; color: #475569; line-height: 1.6; font-size: 14px; }
.help-quickstart ol { margin: 0; padding-left: 22px; color: #475569; }
.help-quickstart li { margin: 9px 0; line-height: 1.55; }
.help-protection-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.help-protection-grid article { border: 1px solid var(--border); border-radius: 14px; padding: 13px; background: #fbfdff; }
.help-protection-grid article strong { display: block; color: #1e293b; font-size: 14px; }
.help-protection-grid article p { margin: 6px 0 0; font-size: 13px; line-height: 1.45; }
.help-warning { margin-top: 16px; padding: 16px; border: 1px solid #fde68a; border-radius: 14px; background: #fffbeb; }
.help-warning h3 { color: #92400e; }
.help-warning p { color: #78350f; }
.help-close-bottom { width: 100%; margin-top: 18px; }
@media (max-width: 800px) {
  .topbar-actions { flex-direction: column; align-items: stretch; }
  .help-protection-grid { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .topbar { gap: 10px; }
  .topbar-actions { flex-direction: row; }
  .help-btn { padding: 8px 9px; }
  .help-dialog { width: calc(100% - 12px); max-height: 94vh; }
  .help-modal { padding: 17px; border-radius: 17px; max-height: 94vh; }
}
