* { box-sizing: border-box; }

:root{
  --bg:#041126;
  --bg2:#071a39;
  --card:#0d2248;
  --card2:#112b59;
  --text:#f4f7ff;
  --muted:#a9b7db;
  --line:rgba(255,255,255,.08);
  --primary:#39d0c7;
  --primary-dark:#21b9af;
  --white:#ffffff;
}

body{
  margin:0;
  font-family:Arial, Helvetica, sans-serif;
  background:
    radial-gradient(circle at top left, rgba(57,208,199,.12), transparent 25%),
    linear-gradient(180deg, var(--bg2) 0%, var(--bg) 100%);
  color:var(--text);
  min-height:100vh;
}

.header{
  display:flex;
  justify-content:space-between;
  align-items:center;
  padding:24px 16px;
  background:rgba(8,24,52,.92);
  border-bottom:1px solid var(--line);
  backdrop-filter:blur(8px);
}

.header h1{
  margin:0;
  font-size:2.2rem;
}

.sub{
  margin:6px 0 0;
  color:var(--muted);
  font-size:.98rem;
}

.page{
  max-width:1200px;
  margin:0 auto;
  padding:20px 16px 32px;
}

.toolbar{
  display:flex;
  gap:12px;
  align-items:center;
  flex-wrap:wrap;
  margin-bottom:20px;
}

input, textarea, select{
  width:100%;
  padding:14px 14px;
  border-radius:14px;
  border:1px solid transparent;
  font-size:1rem;
}

input:focus, textarea:focus{
  outline:none;
  border-color:var(--primary);
}

#search{
  flex:1;
  min-width:260px;
}

.btn-primary, .btn-secondary{
  border:0;
  border-radius:14px;
  padding:12px 18px;
  font-size:1rem;
  cursor:pointer;
  transition:.2s ease;
}

.btn-primary{
  background:var(--primary);
  color:#08253a;
  font-weight:700;
}

.btn-primary:hover{
  background:var(--primary-dark);
  transform:translateY(-1px);
}

.btn-secondary{
  background:#16325f;
  color:var(--white);
  border:1px solid var(--line);
}

.btn-secondary:hover{
  background:#1b3c70;
}

.invoice-list{
  display:grid;
  grid-template-columns:repeat(auto-fill, minmax(290px, 1fr));
  gap:16px;
}

.invoice-card{
  background:linear-gradient(180deg, var(--card), var(--card2));
  border:1px solid var(--line);
  border-radius:18px;
  padding:16px;
  box-shadow:0 10px 28px rgba(0,0,0,.22);
  cursor:pointer;
  transition:.2s ease;
}

.invoice-card:hover{
  transform:translateY(-3px);
  border-color:rgba(57,208,199,.35);
}

.invoice-card h3{
  margin:0 0 10px;
  font-size:1.08rem;
}

.invoice-meta{
  color:var(--muted);
  line-height:1.55;
  font-size:.95rem;
}

.invoice-text{
  margin-top:12px;
  background:rgba(255,255,255,.05);
  border-radius:12px;
  padding:10px;
  color:#dfe7ff;
  font-size:.9rem;
  max-height:110px;
  overflow:auto;
  white-space:pre-wrap;
}

.thumb{
  width:100%;
  border-radius:12px;
  margin-top:12px;
  border:1px solid var(--line);
  object-fit:cover;
  max-height:220px;
}

.empty-state{
  padding-top:40px;
}

.empty-card{
  margin:0 auto;
  max-width:500px;
  background:linear-gradient(180deg, var(--card), var(--card2));
  border:1px solid var(--line);
  border-radius:22px;
  padding:26px;
  text-align:center;
}

.detail-wrap{
  max-width:1100px;
  margin:0 auto;
  padding:20px 16px 32px;
}

.detail-grid{
  display:grid;
  grid-template-columns:1.1fr .9fr;
  gap:18px;
}

.detail-card{
  background:linear-gradient(180deg, var(--card), var(--card2));
  border:1px solid var(--line);
  border-radius:20px;
  padding:18px;
}

.detail-preview{
  width:100%;
  border-radius:14px;
  border:1px solid var(--line);
  background:#fff;
}

.detail-fields{
  display:grid;
  gap:12px;
}

.detail-field{
  background:rgba(255,255,255,.05);
  border-radius:12px;
  padding:12px;
}

.detail-label{
  color:var(--muted);
  font-size:.88rem;
  margin-bottom:4px;
}

.detail-value{
  font-size:1rem;
  word-break:break-word;
}

.pdf-frame{
  width:100%;
  height:720px;
  border:0;
  border-radius:14px;
  background:#fff;
}
.preview-wrap{
  background:rgba(255,255,255,.04);
  border-radius:16px;
  min-height:220px;
  max-height:70vh;
  display:flex;
  align-items:center;
  justify-content:center;
  overflow:auto;
  padding:10px;
}

canvas{
  display:block;
  width:auto;
  max-width:100%;
  height:auto;
  max-height:65vh;
  margin:0 auto;
  border-radius:12px;
  background:#fff;
}
@media (max-width: 860px){
  .detail-grid{
    grid-template-columns:1fr;
  }

  .header h1{
    font-size:1.8rem;
  }
}
.header{
  box-shadow:0 10px 30px rgba(0,0,0,.25);
}

.toolbar{
  background:rgba(255,255,255,.03);
  padding:12px;
  border-radius:16px;
  border:1px solid var(--line);
}

#search{
  background:#fff;
  color:#000;
}

.invoice-card{
  position:relative;
}

.invoice-card::after{
  content:"→";
  position:absolute;
  right:14px;
  top:14px;
  font-size:1.2rem;
  color:rgba(255,255,255,.4);
}