/* Kyosun CID:
   --kyosun-violet: #522583  (primární, Pantone 7680 C)
   --kyosun-green:  #8D9968  (sekundární)
   Font: Plus Jakarta Sans
*/
:root {
  --kyosun-violet: #522583;
  --kyosun-violet-dark: #3A1A60;
  --kyosun-violet-light: #7E4DAE;
  --kyosun-green: #8D9968;
  --kyosun-green-light: #B5BD99;
  --night: #2A1340;
  --cream: #FAF7F0;
  --warm-beige: #F5EFE0;
  --warm-border: #E8DFC9;
  --text: #2A2A2A;
  --muted: #6F6A5E;
  --shadow: 0 4px 20px rgba(82, 37, 131, 0.10);

  /* Aliases pro zachování class jmen — mapování na Kyosun */
  --green-light: var(--kyosun-green);
  --green-dark: var(--kyosun-violet);
  --violet: var(--kyosun-violet);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--cream);
  color: var(--text);
  line-height: 1.55;
}

.container {
  max-width: 980px;
  margin: 0 auto;
  padding: 48px 28px 80px;
}

/* Header ------------------------------------------------------- */
header {
  text-align: center;
  margin-bottom: 40px;
}

.brand-link {
  display: inline-block;
  margin-bottom: 18px;
}

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

.kyosun-logo-img {
  height: 56px;
  width: auto;
  display: block;
}

.enso {
  font-size: 44px;
  color: var(--kyosun-violet);
  line-height: 1;
}

h1 {
  margin: 0;
  font-size: 32px;
  font-weight: 800;
  color: var(--night);
  letter-spacing: -0.01em;
}

.tagline {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 15px;
}

/* Form / dropzone --------------------------------------------- */
.upload-form {
  background: white;
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 28px;
  margin-bottom: 32px;
}

.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 50px 24px;
  border: 2px dashed var(--warm-border);
  border-radius: 14px;
  background: var(--warm-beige);
  cursor: pointer;
  transition: all 0.18s ease;
}

.dropzone:hover, .dropzone.drag {
  border-color: var(--green-light);
  background: #F4F8EE;
  transform: translateY(-1px);
}

.dropzone-icon {
  font-size: 42px;
}

.dropzone-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: center;
}

.dropzone-text strong {
  font-size: 17px;
  color: var(--night);
}

.dropzone-text span {
  color: var(--muted);
  font-size: 14px;
}

input[type="file"] { display: none; }

.file-list {
  list-style: none;
  margin: 18px 0 0;
  padding: 0;
}

.file-list li {
  padding: 8px 14px;
  background: var(--warm-beige);
  border-radius: 8px;
  margin-bottom: 6px;
  font-size: 14px;
  color: var(--night);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* Buttons ------------------------------------------------------ */
.btn-primary {
  display: block;
  width: 100%;
  margin-top: 22px;
  padding: 16px 28px;
  background: linear-gradient(135deg, var(--kyosun-violet-light), var(--kyosun-violet));
  color: white;
  border: 0;
  border-radius: 12px;
  font-size: 17px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
  letter-spacing: 0.01em;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 22px rgba(82, 37, 131, 0.32);
}

.btn-secondary {
  display: inline-block;
  margin-top: 24px;
  padding: 12px 22px;
  border: 2px solid var(--green-dark);
  border-radius: 10px;
  color: var(--green-dark);
  text-decoration: none;
  font-weight: 600;
  transition: all 0.12s ease;
}

.btn-secondary:hover {
  background: var(--green-dark);
  color: white;
}

/* Alert -------------------------------------------------------- */
.alert {
  background: #FDECEC;
  color: #8C1F1F;
  padding: 14px 18px;
  border-radius: 10px;
  margin-bottom: 20px;
  border-left: 4px solid #C53030;
}

/* How it works ------------------------------------------------- */
.how-it-works {
  background: white;
  border-radius: 16px;
  padding: 24px 28px;
  box-shadow: var(--shadow);
}

.how-it-works h2 {
  margin: 0 0 12px;
  font-size: 18px;
  color: var(--night);
}

.how-it-works ul {
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
  font-size: 14.5px;
}

.how-it-works li { margin-bottom: 6px; }

.how-it-works code {
  background: var(--warm-beige);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 13px;
  color: var(--night);
}

/* Result page -------------------------------------------------- */
.totals-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 16px;
  margin-bottom: 36px;
}

.total-card {
  background: white;
  border-radius: 16px;
  padding: 22px 18px;
  text-align: center;
  box-shadow: var(--shadow);
  border-top: 4px solid var(--green-light);
}

.total-card.grade-Appp { border-top-color: var(--kyosun-violet-dark); }
.total-card.grade-App  { border-top-color: var(--kyosun-violet); }
.total-card.grade-Ap   { border-top-color: var(--kyosun-violet-light); }
.total-card.grade-Bpp  { border-top-color: var(--kyosun-green); }
.total-card.grade-Bp   { border-top-color: var(--kyosun-green-light); }
.total-card.total-all  { border-top-color: var(--kyosun-violet); background: linear-gradient(180deg, #fff 0%, #F4EDFB 100%); }

.grade-label {
  font-weight: 700;
  font-size: 15px;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.kg-value {
  font-size: 34px;
  font-weight: 800;
  color: var(--night);
  margin: 8px 0 2px;
  font-variant-numeric: tabular-nums;
}

.kg-unit {
  font-size: 13px;
  color: var(--muted);
}

/* Detail section ---------------------------------------------- */
.detail-section, .files-section {
  background: white;
  border-radius: 16px;
  padding: 24px 28px;
  box-shadow: var(--shadow);
  margin-bottom: 24px;
}

.detail-section h2, .files-section h2 {
  margin: 0 0 14px;
  font-size: 18px;
  color: var(--night);
}

.detail-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.detail-table th, .detail-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--warm-border);
}

.detail-table thead th {
  background: var(--warm-beige);
  color: var(--night);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.detail-table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.detail-table .raw {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12.5px;
  color: var(--muted);
  max-width: 460px;
  word-break: break-word;
}

.detail-table .src {
  font-size: 12px;
  color: var(--muted);
}

.rule {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  background: var(--warm-beige);
  color: var(--green-dark);
}

.rule-A1 { background: #E8E4F0; color: var(--kyosun-violet); }
.rule-A2 { background: #ECE8F2; color: var(--kyosun-violet-light); }
.rule-B  { background: #EAEEDF; color: var(--kyosun-green); }

.warnings ul {
  margin: 0;
  padding-left: 20px;
  color: #8C1F1F;
}

@media (max-width: 720px) {
  h1 { font-size: 24px; }
  .container { padding: 28px 16px 60px; }
  .detail-table .raw { max-width: 220px; }
}

/* Action bar (tisk / PDF / zpět) -------------------------------- */
.action-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

.btn-inline {
  display: inline-block;
  width: auto;
  margin: 0;
  padding: 12px 22px;
  font-size: 15px;
  text-decoration: none;
  text-align: center;
}

/* Orders list -------------------------------------------------- */
.orders-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.order-card {
  background: var(--warm-beige);
  border-radius: 12px;
  padding: 16px 18px;
  border-left: 4px solid var(--green-light);
}

.order-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.order-num {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  background: white;
  padding: 3px 10px;
  border-radius: 6px;
}

.order-company {
  font-weight: 700;
  font-size: 16px;
  color: var(--night);
}

.order-items {
  list-style: none;
  margin: 0;
  padding: 0;
}

.order-item {
  display: grid;
  grid-template-columns: 110px 1fr 50px 80px;
  gap: 10px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid rgba(28, 51, 24, 0.08);
  font-size: 14px;
}

.order-item:last-child { border-bottom: none; }

.oi-qty {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-weight: 600;
  color: var(--night);
}

.oi-desc { color: var(--text); line-height: 1.4; }

.oi-grade {
  text-align: center;
  font-weight: 700;
  color: var(--green-dark);
  background: white;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  letter-spacing: 0.03em;
}

.oi-kg {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--night);
}

.order-item.tin {
  opacity: 0.6;
}

.oi-tin {
  grid-column: 1 / -1;
  font-size: 11px;
  color: var(--violet);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

@media (max-width: 720px) {
  .order-item {
    grid-template-columns: 1fr 70px;
    grid-template-areas: "qty grade" "desc desc" "kg kg";
  }
  .oi-qty { grid-area: qty; }
  .oi-grade { grid-area: grade; }
  .oi-desc { grid-area: desc; font-size: 13px; }
  .oi-kg { grid-area: kg; text-align: left; }
}

/* Print stylesheet — toner-economy ----------------------------- */
@media print {
  body { background: white; color: black; }
  .container { max-width: none; padding: 0; }
  .no-print { display: none !important; }

  header { margin-bottom: 12px; text-align: left; }
  .enso { display: none; }
  h1 { font-size: 18px; color: black; }
  .tagline { font-size: 11px; }

  /* Karty: bez stínů, bez barevných border-top, jen tenká šedá linka */
  .totals-grid { gap: 6px; margin-bottom: 14px; }
  .total-card,
  .total-card.grade-Appp, .total-card.grade-App, .total-card.grade-Ap,
  .total-card.grade-Bpp, .total-card.grade-Bp, .total-card.total-all {
    box-shadow: none;
    border: 1px solid #999;
    border-top-color: #999;
    background: white !important;
    padding: 8px 6px;
    page-break-inside: avoid;
  }
  .grade-label { color: black; font-size: 11px; }
  .kg-value { font-size: 18px; color: black; margin: 4px 0 0; }
  .kg-unit { font-size: 10px; color: black; }

  /* Sekce */
  .detail-section, .files-section {
    box-shadow: none;
    border: none;
    padding: 0;
    margin-bottom: 12px;
  }
  .detail-section h2 { font-size: 12px; margin: 14px 0 6px; color: black; }

  /* Per-firma karty: bez plné barvy, tenký rámeček, kompaktní */
  .order-card {
    background: white !important;
    border: none;
    border-top: 1px solid #999;
    border-left: none;
    border-radius: 0;
    padding: 6px 0 4px;
    page-break-inside: avoid;
  }
  .order-head { margin-bottom: 4px; gap: 8px; }
  .order-num {
    background: white;
    border: 1px solid #999;
    color: black;
    padding: 1px 6px;
    font-size: 11px;
  }
  .order-company { font-size: 13px; color: black; }
  .order-item {
    padding: 3px 0;
    font-size: 11px;
    border-bottom: 1px dotted #bbb;
  }
  .oi-grade {
    background: white;
    border: 1px solid #777;
    color: black;
    font-size: 10px;
    padding: 1px 6px;
  }
  .oi-qty, .oi-desc, .oi-kg { color: black; }

  a { color: black; text-decoration: none; }
}
