/* Pamja e faqes: stili D ("Dark dashboard"), vetëm varianti i çelët.
   Pa mënyrë të errët, pa font të jashtëm, pa CDN. Forma SAD është te sad.css. */
:root {
  --bg: #f1f6f7;
  --surface: #ffffff;
  --surface-2: #e8f1f2;
  --text: #0f2a2e;
  --muted: #4c6a6f;
  --border: #cfe0e2;
  --border-strong: #8fb0b5;
  --accent: #0f766e;
  --accent-text: #ffffff;
  --focus: #0d9488;
  --field: #ffffff;
  --warn-bg: #fff1c2;
  --warn-border: #d4a72c;
  --warn-text: #5a4300;
  --danger: #b42318;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --r: 8px;
  --r-sm: 6px;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { color-scheme: light; background: var(--bg); }
body {
  font-family: var(--font); font-size: 14.5px; line-height: 1.45;
  color: var(--text); background: var(--bg);
  max-width: 1000px; margin: 0 auto; padding: 0 1rem 3rem;
}
h1, h2, h3, h4 { font-family: var(--font); }
h3 { font-size: 1rem; margin: 1rem 0 .4rem; }
h4 { font-size: .92rem; margin: .8rem 0 .3rem; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
button, select, input { font: inherit; color: inherit; }

/* kreu */
.kreu-faqes { padding: 1rem 0; display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.kreu-faqes h1 { margin: 0; font-size: 1.3rem; }
.kreu-faqes p { margin: 0; color: var(--muted); font-size: .85rem; }
.pill { border: 1px solid var(--accent); color: var(--accent); border-radius: 999px; padding: .1rem .7rem; font-size: .8rem; white-space: nowrap; }

/* njoftime kompakte */
.njoftim, .shënim, #gemini-banner, #backend-warning, #demo-banner {
  padding: .6rem .8rem; border-radius: var(--r-sm); margin: .6rem 0;
  background: var(--warn-bg); border: 1px solid var(--warn-border); color: var(--warn-text);
}
#demo-banner { font-weight: 700; }
#demo-banner p { margin: .3rem 0; font-weight: 400; }
#demo-butonat { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .5rem; font-weight: 400; }
#demo-butonat button { min-height: 36px; padding: .3rem .8rem; }

/* kartat e hapave */
.hap { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 1rem; margin: .9rem 0; }
.hap > h2, .hap-titulli {
  font-size: .9rem; margin: 0 0 .8rem; display: flex; gap: .5rem; align-items: center;
  text-transform: uppercase; letter-spacing: .06em;
}
.badge { color: var(--accent-text); background: var(--accent); border-radius: 4px; padding: 0 .45rem; font-size: .85rem; }

/* fusha dhe butona */
label { display: block; font-size: .88rem; color: var(--muted); margin: 0; }
input, select {
  background: var(--field); border: 1px solid var(--border-strong); border-radius: var(--r-sm);
  padding: .3rem .6rem; min-height: 36px; width: 100%; max-width: 100%;
}
label input, label select { margin-top: .2rem; color: var(--text); }
button, label.buton-skedari {
  min-height: 40px; padding: .4rem 1rem; border-radius: var(--r-sm);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
  margin: 0; font-size: 1rem;
}
button:disabled { opacity: .55; cursor: not-allowed; }
.primar, #lexo, #ndërto, #shkarko-xml {
  background: var(--accent); color: var(--accent-text); border-color: var(--accent); font-weight: 600;
}
#lexo, #ndërto { margin-top: .6rem; }
.fshehur { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
#skedari:focus-visible + label.buton-skedari { outline: 3px solid var(--focus); outline-offset: 2px; }

#zona { border: 2px dashed var(--border-strong); border-radius: var(--r); padding: 1rem; background: var(--surface-2); text-align: center; }
#zona.mbi { background: #d6ecee; border-color: var(--accent); }
#zona p { margin: .5rem 0 0; color: var(--muted); font-size: .88rem; }
#numri-skedarëve { margin: 0 .5rem; }
#totali { margin: .3rem 0; color: var(--muted); }
.gabim { color: var(--danger); margin: .4rem 0 0; font-weight: 600; }
.gabim:empty { display: none; }
.konflikt { color: var(--danger); }

/* fusha në rrjetë */
.rrjeta, .makina { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: .7rem; }
fieldset { border: 1px solid var(--border); border-radius: var(--r); padding: .8rem; margin: .8rem 0; background: var(--surface); min-width: 0; }
legend { font-weight: 600; padding: 0 .4rem; }

/* tabela */
.tabela-mbështjellës { overflow-x: auto; margin: .6rem 0; }
table { border-collapse: collapse; width: 100%; font-size: .9rem; }
th { text-align: left; font-size: .7rem; overflow-wrap: anywhere; hyphens: auto; color: var(--muted); padding: .4rem; border-bottom: 2px solid var(--border-strong); }
td { padding: .3rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
td input, td select { min-width: 0; min-height: 34px; padding: .2rem .4rem; }
/* kokat e tabelës: fjalët thyhen vetëm te hapësirat, jo shkronjë më shkronjë */
th { white-space: normal; overflow-wrap: normal; word-break: normal; hyphens: manual; }
#kreu th:last-child { min-width: 7.5rem; }
#kutitë th:first-child { min-width: 3.5em; }
#trupi td input { min-width: 5.5em; }
#trupi td:first-child input { min-width: 12em; }
pre { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-sm); padding: .8rem; overflow: auto; max-height: 24rem; font-size: .8rem; }
ul { padding-left: 1.2rem; margin: .3rem 0; }

#rezultati.bosh { background: none; border: 0; padding: 0; margin: 0; max-height: none; overflow: visible; font-family: var(--font); font-size: .9rem; color: var(--muted); white-space: normal; }

/* eksporti */
#xml-kuti { margin-top: .8rem; }
.eksporti-fushat { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .7rem; margin: .6rem 0; }
.butonat { display: flex; flex-wrap: wrap; gap: .6rem; margin: .6rem 0; }

/* disa deklarata */
.dk-fatura { background: var(--warn-bg); border: 1px solid var(--warn-border); color: var(--warn-text); border-radius: var(--r-sm); padding: .6rem .8rem; margin: .8rem 0; }
.dk-fatura h3 { margin: .2rem 0 .3rem; }
.dk-fatura .shënim { background: none; border: 0; padding: 0; margin: .5rem 0 0; }
#dk-skedat {
  display: flex; gap: .3rem; overflow-x: auto; padding: 3px; margin: 1rem 0 .6rem;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r);
  -webkit-overflow-scrolling: touch;
}
#dk-skedat button {
  flex: 0 0 auto; white-space: nowrap; border: 0; background: transparent; min-height: 40px; padding: 0 1rem;
}
#dk-skedat button[aria-selected="true"] { background: var(--accent); color: var(--accent-text); font-weight: 600; }
.dk-paneli { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: .8rem; margin: .3rem 0; }
.dk-paneli > div:last-child > label { margin: .3rem 0; }

@media (min-width: 641px) {
  #zona { text-align: left; }
}

/* telefon */
@media (max-width: 640px) {
  body { padding: 0 .7rem 2rem; }
  .hap { padding: .8rem; }
  .rrjeta, .makina { grid-template-columns: 1fr; }
  button, label.buton-skedari { min-height: 44px; }
  input, select { min-height: 44px; }
  #lexo, #ndërto, #shkarko-xml, #shkarko-xlsx, .dk-paneli button { width: 100%; }
  #dk-skedat button, .dk-paneli .sad-printo { width: auto; }
  #demo-butonat button { width: 100%; }
  label.buton-skedari { width: 100%; margin-bottom: .4rem; }

  table.kartat, table.kartat tbody, table.kartat tr, table.kartat td { display: block; width: 100%; }
  table.kartat thead { position: absolute; left: -9999px; }
  table.kartat tr { border: 1px solid var(--border); border-radius: var(--r); padding: .5rem .7rem; margin: .7rem 0; background: var(--surface); }
  table.kartat td { border: 0; display: grid; grid-template-columns: 8.5em minmax(0, 1fr); gap: .5rem; align-items: center; padding: .2rem 0; overflow-wrap: anywhere; }
  table.kartat td::before { content: attr(data-label); color: var(--muted); font-size: .8rem; }
  #trupi td input, #trupi td:first-child input { min-width: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
