:root{
  --bg1:#0b1020;
  --bg2:#050713;

  --panel:rgba(255,255,255,.07);
  --panel2:rgba(255,255,255,.045);
  --stroke:rgba(255,255,255,.12);

  --text:rgba(255,255,255,.92);
  --muted:rgba(255,255,255,.70);
  --muted2:rgba(255,255,255,.55);

  --accent:rgba(120,160,255,.55);
  --accent2:rgba(120,160,255,.22);
  --accentStroke:rgba(160,190,255,.35);

  --shadow:rgba(0,0,0,.55);
}

*{box-sizing:border-box}
html,body{height:100%}

body{
  margin:0;
  min-height:100vh;
  display:flex;
  justify-content:center;
  align-items:flex-start;
  padding:28px 16px;
  background:
    radial-gradient(1100px 650px at 30% 15%, #1b2a66 0%, var(--bg1) 45%, var(--bg2) 100%);
  color:var(--text);
  font-family:system-ui,-apple-system,Segoe UI,Roboto,Inter,Arial,sans-serif;
}

.panel{
  width:min(980px, 100%);
  margin-top:18px;
  background:linear-gradient(180deg, var(--panel), var(--panel2));
  border:1px solid var(--stroke);
  border-radius:26px;
  padding:22px;
  box-shadow:0 24px 70px var(--shadow);
  backdrop-filter: blur(10px);
}

/* ===== Header ===== */
.header{
  padding:6px 6px 14px;
}

.title{
  display:flex;
  gap:14px;
  align-items:center;
}

.title-icon{
  width:54px;
  height:54px;
  display:grid;
  place-items:center;
  border-radius:16px;
  background:rgba(255,255,255,.08);
  border:1px solid rgba(255,255,255,.14);
  box-shadow:0 14px 30px rgba(0,0,0,.25);
  font-size:24px;
}

.title-text h1{
  margin:0;
  font-size:40px;
  letter-spacing:.2px;
  line-height:1.05;
}
.title-text p{
  margin:6px 0 0;
  color:var(--muted2);
  font-size:14px;
}

/* ===== Topbar ===== */
.topbar{
  display:flex;
  gap:14px;
  align-items:center;
  justify-content:space-between;
  padding:14px;
  border-radius:20px;
  border:1px solid rgba(255,255,255,.12);
  background:rgba(0,0,0,.18);
}

.file-control{
  display:flex;
  align-items:center;
  gap:12px;
  min-width:0;
}

/* ukryj natywny input */
#pdf{
  position:absolute;
  width:1px;
  height:1px;
  opacity:0;
  pointer-events:none;
}

/* przycisk wybierz plik */
.file-btn{
  display:inline-flex;
  align-items:center;
  gap:10px;
  padding:11px 14px;
  border-radius:999px;
  border:1px solid var(--accentStroke);
  background:linear-gradient(180deg, rgba(120,160,255,.28), rgba(120,160,255,.16));
  color:var(--text);
  font-weight:700;
  cursor:pointer;
  box-shadow:0 10px 25px rgba(0,0,0,.22);
  user-select:none;
  white-space:nowrap;
}
.file-btn:hover{filter:brightness(1.08)}
.file-btn:active{transform:translateY(1px)}
.file-btn-icon{
  width:26px;height:26px;
  display:grid;place-items:center;
  border-radius:10px;
  background:rgba(255,255,255,.12);
  border:1px solid rgba(255,255,255,.15);
}

.file-info{
  min-width:0;
  display:flex;
  flex-direction:column;
  gap:2px;
}
.file-name{
  font-weight:700;
  color:rgba(255,255,255,.88);
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  max-width:520px;
}
.file-meta{
  font-size:12.5px;
  color:var(--muted2);
}

/* przycisk Drukuj po prawej */
.send-btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:10px;
  border-radius:999px;
  padding:12px 18px;
  border:1px solid rgba(255,255,255,.16);
  background:linear-gradient(180deg, rgba(255,255,255,.14), rgba(255,255,255,.07));
  color:var(--text);
  font-weight:800;
  cursor:pointer;
  box-shadow:0 16px 35px rgba(0,0,0,.28);
  white-space:nowrap;
}
.send-btn:hover{filter:brightness(1.08)}
.send-btn:active{transform:translateY(1px)}
.send-btn-icon{
  width:28px;height:28px;
  display:grid;place-items:center;
  border-radius:12px;
  background:rgba(120,160,255,.22);
  border:1px solid rgba(160,190,255,.28);
}

/* ===== Notes ===== */
.notes{
  margin-top:14px;
  padding:14px;
  border-radius:20px;
  border:1px solid rgba(255,255,255,.12);
  background:rgba(0,0,0,.16);
}
.notes-label{
  display:block;
  font-size:13px;
  color:var(--muted2);
  margin-bottom:8px;
}

textarea{
  width:100%;
  min-height:96px;
  resize:vertical;
  padding:14px 14px;
  border-radius:16px;
  border:1px solid rgba(255,255,255,.14);
  background:rgba(0,0,0,.22);
  color:var(--text);
  outline:none;
}
textarea:focus{
  border-color:rgba(160,190,255,.35);
  box-shadow:0 0 0 4px rgba(120,160,255,.12);
}

/* ===== Status + Log ===== */
.status{
  margin-top:12px;
  color:var(--muted);
  min-height:20px;
  padding-left:2px;
}

.log{
  margin-top:10px;
  padding:12px;
  border-radius:16px;
  border:1px solid rgba(255,255,255,.12);
  background:rgba(0,0,0,.22);
  color:rgba(255,255,255,.85);
  overflow:auto;
  max-height:220px;
}

/* ===== Podgląd PDF ===== */
.preview{
  margin-top:14px;
  padding:14px;
  border-radius:20px;
  border:1px solid rgba(255,255,255,.12);
  background:rgba(0,0,0,.16);
}

.preview-header{
  display:flex;
  justify-content:space-between;
  align-items:baseline;
  gap:12px;
  margin-bottom:10px;
}

.preview-title{
  font-weight:800;
  color:rgba(255,255,255,.9);
}

.preview-meta{
  font-size:13px;
  color:var(--muted2);
}

.preview-wrap{
  position:relative;
  width:100%;
  border:1px solid rgba(255,255,255,.12);
  border-radius:18px;
  background:rgba(0,0,0,.20);
  overflow:hidden;
  box-shadow:0 18px 40px rgba(0,0,0,.28);
}

.preview-empty{
  position:absolute;
  inset:0;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:14px;
  text-align:center;
  color:var(--muted2);
}

.preview-frame{
  width:100%;
  height:100%;
  border:0;
  display:block;
  background:#0b0f1f;
}

.preview-wrap.is-empty .preview-frame{
  opacity:0;
  pointer-events:none;
}
.preview-wrap:not(.is-empty) .preview-empty{
  display:none;
}

/* === Zwijanie / rozwijanie podglądu === */
.preview.is-collapsed{
  padding:0;
  border:none;
  background:transparent;
}
.preview.is-collapsed .preview-header,
.preview.is-collapsed .preview-wrap{
  display:none;
}

/* ===== RWD ===== */
@media (max-width: 720px){
  .title-text h1{font-size:32px}
  .topbar{
    flex-direction:column;
    align-items:stretch;
  }
  .send-btn{width:100%}
  .file-name{max-width:100%}
}
