:root{
  --bg:#f5f6f8;
  --card:#ffffff;
  --text:#0f172a;
  --muted:#6b7280;
  --border:#d1d5db;
  --border-strong:#c7cdd6;
  --accent:#2563eb;
  --shadow:0 12px 30px rgba(15, 23, 42, .10);
  --radius:16px;
}

*{box-sizing:border-box}

html,body{height:100%}

body{
  margin:0;
  background:var(--bg);
  color:var(--text);
  font-family:Inter,system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif;
  line-height:1.4;
}

.sheet{
  max-width:980px;
  margin:24px auto;
  background:var(--card);
  border:1px solid var(--border);
  border-radius:var(--radius);
  box-shadow:var(--shadow);
  overflow:hidden;
}

.sheet__header{
  padding:28px 28px 18px;
  border-bottom:1px solid var(--border);
  background:linear-gradient(180deg, rgba(37,99,235,.06), rgba(37,99,235,0));
}

.brand{
  display:flex;
  gap:18px;
  align-items:center;
}

.brand__logo img{
  max-height:40px;
  height:auto;
  width:auto;
}

.brand__title h1{
  margin:0;
  font-size:20px;
  font-weight:800;
  letter-spacing:-.01em;
}

.brand__title p{
  margin:6px 0 0;
}

.notice{
  margin-top:16px;
  padding:12px 14px;
  border:1px solid var(--border);
  border-radius:12px;
  background:#fff;
}

.muted{color:var(--muted)}

.card{
  padding:18px 28px;
}

.card + .card{
  border-top:1px solid var(--border);
}

.card__head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:16px;
  margin-bottom:14px;
}

.card__head h2{
  margin:0;
  font-size:16px;
  font-weight:800;
  letter-spacing:-.01em;
}

.card__meta{min-width:220px}

.grid{
  display:grid;
  grid-template-columns:repeat(2, minmax(0,1fr));
  gap:12px 18px;
}

.grid--2{
  grid-template-columns:repeat(2, minmax(0,1fr));
}

.field{
  display:flex;
  flex-direction:column;
  gap:6px;
  min-width:0;
}

.field--inline{
  align-items:flex-end;
}

.field__label{
  font-size:12px;
  font-weight:700;
  color:var(--text);
}

.field__help{
  margin:0;
  font-size:12px;
  color:var(--muted);
}

.req{color:#dc2626}

input, textarea{
  width:100%;
  font:inherit;
  padding:10px 12px;
  border:1px solid var(--border-strong);
  border-radius:12px;
  background:#fff;
}

textarea{
  min-height:92px;
  resize:vertical;
}

input:focus, textarea:focus{
  outline:3px solid rgba(37,99,235,.20);
  border-color:rgba(37,99,235,.55);
}

.table-wrap{
  overflow:auto;
  border:1px solid var(--border);
  border-radius:12px;
}

.table{
  width:100%;
  border-collapse:separate;
  border-spacing:0;
}

.table thead th{
  text-align:left;
  font-size:12px;
  padding:10px 12px;
  background:rgba(15,23,42,.04);
  border-bottom:1px solid var(--border);
}

.table tbody td{
  padding:10px 12px;
  border-bottom:1px solid var(--border);
}

.table tbody tr:last-child td{border-bottom:0}

.table input, .table textarea{
  padding:8px 10px;
  border-radius:10px;
}

.th-qty{width:120px}

.actions{
  display:flex;
  gap:10px;
  align-items:center;
  justify-content:flex-end;
}

.table-actions{
  display:flex;
  gap:10px;
  align-items:center;
  justify-content:flex-end;
  margin-top:10px;
}

.btn{
  border:1px solid var(--border-strong);
  background:#fff;
  color:var(--text);
  border-radius:12px;
  padding:10px 12px;
  font-weight:700;
  cursor:pointer;
}

.btn:hover{border-color:rgba(37,99,235,.55)}

.btn:disabled{
  opacity:.5;
  cursor:not-allowed;
}

.btn--ghost{
  background:transparent;
}

.btn--primary{
  border-color:rgba(37,99,235,.55);
  background:rgba(37,99,235,.10);
}

.sign{
  padding:18px 28px 10px;
}

.sign__line{
  border-top:1px dashed var(--border-strong);
  padding-top:8px;
  margin-top:10px;
}

.sign__label{
  font-size:12px;
  color:var(--muted);
}

.footer{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:16px 28px 22px;
  border-top:1px solid var(--border);
  background:#fff;
}

.footer__small{
  font-size:12px;
  color:var(--muted);
}

/* Viditelnost podle režimu (obrazovka / tisk) */
.print-only{display:none}

/* Responsive úpravy jen pro obrazovku – aby se v tisku nepřepínal layout do 1 sloupce */
@media screen and (max-width: 820px){
  .sheet{margin:0;border-radius:0}
  .sheet__header,.card,.footer,.sign{padding-left:16px;padding-right:16px}
  .brand{flex-direction:column;align-items:flex-start}
  .grid{grid-template-columns:1fr}
  .card__meta{min-width:0}
}

@media print{
  /* Minimalistický tisk: čisté, kompaktní, bez zbytečných rámečků */
  @page{size:A4;margin:6mm}
  body{background:#fff;font-size:10px;line-height:1.15}
  .sheet{max-width:none}
  .sheet__header{padding:6px 0 5px;border-bottom:0}
  .brand{gap:12px}
  .brand__logo img{max-height:34px}
  .brand__title h1{font-size:14px}
  .notice{margin-top:6px;padding:0;border:0;background:transparent}
  .card{padding:5px 0}
  .card + .card{border-top:0}
  .card__head{margin-bottom:6px}
  .card__head h2{font-size:13px}

  /* V tisku vždy 2 sloupce (nezávisle na šířce náhledu) */
  .grid{grid-template-columns:repeat(2, minmax(0,1fr));gap:4px 8px}
  .grid--2{grid-template-columns:repeat(2, minmax(0,1fr))}
  .field{break-inside:avoid}
  .field__label{font-size:11px}
  .field__help{font-size:11px}

  /* Pole: bez rámečků, jen jemná linka */
  input{
    padding:2px 0 1px;
    border:0;
    border-bottom:1px solid #999;
    border-radius:0;
    background:transparent;
  }
  textarea{
    padding:4px 6px;
    border:1px solid #bbb;
    border-radius:0;
    background:transparent;
    min-height:54px;
  }

  /* Tabulka: čistá, bez obalových rámečků */
  .table-wrap{border:0;border-radius:0;overflow:visible}
  .table{border-collapse:collapse}
  .table thead th{padding:4px 6px;background:transparent;border-bottom:1px solid #999}
  .table tbody td{padding:3px 6px;border-bottom:1px solid #ddd}
  .table input, .table textarea{border:0;border-bottom:0;padding:0;background:transparent}
  .table textarea{border:0;min-height:40px;padding:0}

  .sign{padding:6px 0 0}
  .sign__line{border-top:1px solid #999}
  .sign__label{font-size:10px}

  .sheet{margin:0;box-shadow:none;border:0;border-radius:0}
  .no-print{display:none !important}
  .print-only{display:block !important}
  .sheet__header{background:#fff}
  a{color:inherit;text-decoration:none}
}
