/* ============================================================
   AKCIZA — Sistemi i Menaxhimit të Pullave Fiskale
   Dizajni: sistem doganar/fiskal institucional
   ============================================================ */
:root {
  --navy-900: #071d2e;
  --navy-800: #0b2942;
  --navy-700: #0d3253;
  --navy-600: #15507e;
  --navy-500: #1a6396;
  --blue-accent: #2a77b0;
  --ink:      #0b2942;
  --ink-soft: #5b7189;
  --ink-mut:  #7e93a8;
  --ink-mut2: #8a9db0;
  --line:     #e6edf3;
  --line-2:   #eef2f6;
  --line-3:   #dbe6f0;
  --line-in:  #cddceb;
  --bg:       #eef2f6;
  --white:    #ffffff;
  --th-grad:  linear-gradient(180deg, #f3f8fd, #e9f1f9);
  --red-600:  #c0392b;
  --red-100:  #fbeae8;
  --green-600:#1f8a4c;
  --green-100:#e6f5ec;
  --amber-600:#c8791a;
  --amber-100:#fff3e6;
  --gray-600: #5b6b7b;
  --gray-100: #eef1f4;
  --radius:   16px;
  --radius-sm:10px;
  --shadow:   0 1px 2px rgba(11,41,66,.05), 0 12px 32px rgba(11,41,66,.08);
  --shadow-hover: 0 14px 30px rgba(11,41,66,.13);
  --shadow-lg: 0 20px 60px rgba(7,29,46,.35);
  --mono: 'IBM Plex Mono', ui-monospace, Menlo, monospace;
  font-size: 15px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
a { color: var(--navy-600); text-decoration: none; }

/* ---------------- Buttons ---------------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  padding: 10px 16px; font: inherit; font-weight: 600; font-size: .9rem;
  cursor: pointer; transition: background .15s, box-shadow .15s, transform .15s, filter .15s;
  white-space: nowrap; line-height: 1;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: linear-gradient(140deg, #1a6396, #0d3253); color: #fff; box-shadow: 0 4px 14px rgba(13,50,83,.28); }
.btn-primary:hover { filter: brightness(1.08); }
.btn-secondary { background: #fff; color: var(--navy-600); border-color: var(--line-in); }
.btn-secondary:hover { background: #f3f8fd; }
.btn-danger { background: #fff; color: var(--red-600); border-color: #f0cfca; }
.btn-danger:hover { background: var(--red-100); }
.btn-success { background: linear-gradient(140deg, #26a05a, #1a7a40); color: #fff; box-shadow: 0 4px 14px rgba(31,138,76,.28); }
.btn-success:hover { filter: brightness(1.07); }
.btn-sm { padding: 6px 11px; font-size: .8rem; border-radius: 8px; gap: 4px; }
.btn-block { width: 100%; justify-content: center; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-link {
  background: none; border: none; color: #9fc4e2;
  font: inherit; font-size: .8rem; cursor: pointer; padding: 0; text-align: left;
}
.btn-link:hover { text-decoration: underline; color: #fff; }

/* ---------------- Login ---------------- */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(1000px 500px at 80% -10%, rgba(42,119,176,.35), transparent 60%),
    linear-gradient(160deg, #0d3253 0%, #0b2942 55%, #071d2e 100%);
  padding: 24px; position: relative; overflow: hidden;
}
.login-wrap::before {
  content: ""; position: absolute; inset: 0;
  background-image: radial-gradient(rgba(255,255,255,.05) 1px, transparent 1px);
  background-size: 24px 24px; pointer-events: none;
}
.login-card {
  position: relative; background: #fff; border-radius: 20px; box-shadow: var(--shadow-lg);
  width: 100%; max-width: 410px; padding: 40px 38px 30px;
}
.login-brand { text-align: center; margin-bottom: 26px; }
.login-logo {
  width: 62px; height: 62px; margin: 0 auto 14px; border-radius: 18px;
  background: linear-gradient(140deg, #2a77b0, #123f66);
  display: flex; align-items: center; justify-content: center;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.2), 0 8px 22px rgba(7,29,46,.35);
}
.login-brand h1 { font-size: 1.55rem; font-weight: 800; letter-spacing: .06em; color: var(--navy-800); }
.login-brand p { color: var(--ink-mut); font-size: .82rem; margin-top: 5px; }
.login-card label { display: block; font-size: .78rem; font-weight: 700; margin: 15px 0 6px; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .04em; }
.login-card input {
  width: 100%; padding: 11px 13px; border: 1px solid var(--line-in); border-radius: var(--radius-sm);
  font: inherit; background: #f3f8fd; color: var(--ink);
}
.login-card input:focus { outline: 2px solid var(--blue-accent); outline-offset: -1px; background: #fff; }
.login-card .btn { margin-top: 24px; }
.login-error {
  margin-top: 15px; background: var(--red-100); color: var(--red-600);
  border-radius: var(--radius-sm); padding: 11px 13px; font-size: .85rem;
}
.login-foot { text-align: center; color: var(--ink-mut2); font-size: .76rem; margin-top: 22px; }

/* ---------------- App shell ---------------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 250px; flex-shrink: 0; color: #dbe7f2;
  background: linear-gradient(180deg, #0d3253 0%, #0b2942 55%, #071d2e 100%);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.sidebar-brand { display: flex; align-items: center; gap: 12px; padding: 22px 22px 20px; border-bottom: 1px solid rgba(255,255,255,.08); }
.sidebar-logo {
  width: 42px; height: 42px; border-radius: 12px; flex: none;
  background: linear-gradient(140deg, #2a77b0, #123f66);
  display: flex; align-items: center; justify-content: center;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.18), 0 4px 12px rgba(0,0,0,.3);
}
.sidebar-title { font-weight: 800; font-size: .95rem; letter-spacing: .02em; color: #fff; line-height: 1.2; }
.sidebar-sub { font-size: .66rem; color: #7e9bb5; text-transform: uppercase; letter-spacing: .09em; font-weight: 600; }
.sidebar-nav { flex: 1; padding: 16px 12px; display: flex; flex-direction: column; gap: 3px; }
.sidebar-nav a {
  display: flex; align-items: center; gap: 12px; color: #c1d4e5;
  padding: 11px 14px; border-radius: var(--radius-sm); font-size: .88rem; font-weight: 600;
  transition: background .15s, color .15s;
}
.sidebar-nav a:hover { background: rgba(255,255,255,.07); color: #fff; }
.sidebar-nav a.active {
  background: linear-gradient(100deg, rgba(42,119,176,.42), rgba(42,119,176,.16));
  color: #fff; box-shadow: inset 0 0 0 1px rgba(255,255,255,.08);
}
.nav-ico { width: 20px; text-align: center; opacity: .95; font-size: 1rem; }
.sidebar-foot { padding: 14px; border-top: 1px solid rgba(255,255,255,.08); }
.user-chip { display: flex; align-items: center; gap: 11px; padding: 10px; background: rgba(255,255,255,.04); border-radius: 12px; }
.user-avatar {
  width: 38px; height: 38px; border-radius: 50%; flex: none;
  background: linear-gradient(140deg, #2a77b0, #123f66); color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 700;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.18);
}
.user-name { font-size: .82rem; font-weight: 600; color: #fff; overflow: hidden; text-overflow: ellipsis; max-width: 150px; white-space: nowrap; }
.user-role-line { margin: 1px 0 2px; }
.user-role { font-size: .64rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: #9fc4e2; }

/* Role switcher */
.role-switch { margin-bottom: 14px; }
.role-switch-lbl { font-size: .6rem; color: #7e9bb5; text-transform: uppercase; letter-spacing: .09em; font-weight: 700; margin-bottom: 8px; padding-left: 2px; }
.role-btns { display: flex; gap: 5px; }
.role-btn { flex: 1; padding: 7px 4px; border: 1px solid rgba(255,255,255,.14); background: transparent; color: #a9c1d6; border-radius: 7px; font-size: .68rem; font-weight: 700; cursor: pointer; transition: background .15s; }
.role-btn:hover { background: rgba(255,255,255,.08); }
.role-btn.on { background: var(--navy-600); color: #fff; border-color: var(--navy-600); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  background: rgba(255,255,255,.82); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
  padding: 14px 30px; display: flex; align-items: center; justify-content: space-between; gap: 16px;
  position: sticky; top: 0; z-index: 20;
}
.topbar h2 { font-size: 1.25rem; font-weight: 800; letter-spacing: -.01em; color: var(--navy-800); line-height: 1.1; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.topbar-date { color: var(--ink-mut); font-size: .78rem; font-weight: 500; }
.content { padding: 26px 30px 60px; }

/* ---------------- Hero banner ---------------- */
.hero {
  position: relative; overflow: hidden; border-radius: var(--radius);
  background: linear-gradient(120deg, #0d3253 0%, #0b2942 60%, #071d2e 100%);
  color: #fff; padding: 26px 30px; margin-bottom: 24px;
}
.hero::before {
  content: ""; position: absolute; right: -70px; top: -110px; width: 300px; height: 300px;
  border-radius: 50%; border: 1.5px solid rgba(255,255,255,.12);
}
.hero::after {
  content: ""; position: absolute; right: -20px; top: -60px; width: 190px; height: 190px;
  border-radius: 50%; border: 1.5px solid rgba(255,255,255,.09);
}
.hero-eyebrow { font-size: .66rem; text-transform: uppercase; letter-spacing: .14em; color: #8fb0cd; font-weight: 700; position: relative; }
.hero h1 { font-size: 1.6rem; font-weight: 800; margin-top: 8px; letter-spacing: -.02em; position: relative; }
.hero p { font-size: .88rem; color: #b9d0e3; margin-top: 6px; max-width: 620px; position: relative; }

/* ---------------- Cards & stats ---------------- */
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 20px 22px; }
.card-title { font-size: .82rem; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--navy-600); margin-bottom: 16px; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px; margin-bottom: 24px; }
.stat-card {
  position: relative; overflow: hidden; padding: 0;
  transition: transform .25s, box-shadow .25s;
}
.stat-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-hover); }
.stat-card .bar { height: 4px; background: var(--navy-600); }
.stat-card.accent-green .bar { background: var(--green-600); }
.stat-card.accent-amber .bar { background: var(--amber-600); }
.stat-card.accent-red .bar { background: var(--red-600); }
.stat-card .orb {
  position: absolute; top: -26px; right: -26px; width: 96px; height: 96px;
  border-radius: 50%; background: var(--navy-600); opacity: .09; pointer-events: none;
}
.stat-card.accent-green .orb { background: var(--green-600); }
.stat-card.accent-amber .orb { background: var(--amber-600); }
.stat-card.accent-red .orb { background: var(--red-600); }
.stat-card .inner { padding: 20px 22px; }
.stat-label { font-size: .72rem; font-weight: 700; color: var(--ink-mut); text-transform: uppercase; letter-spacing: .07em; }
.stat-value { font-size: 2.05rem; font-weight: 800; letter-spacing: -.03em; margin-top: 10px; color: var(--navy-800); }
.stat-hint { font-size: .78rem; color: var(--ink-mut2); margin-top: 4px; }

.grid-2 { display: grid; grid-template-columns: 1.5fr 1fr; gap: 22px; }
@media (max-width: 1050px) { .grid-2 { grid-template-columns: 1fr; } }

.section-head {
  padding: 16px 22px; border-bottom: 1px solid var(--line-2);
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px;
}
.section-head h3 { font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--navy-600); }
.legend { display: flex; gap: 16px; font-size: .72rem; font-weight: 600; color: var(--ink-soft); }
.legend span { display: flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.dot-blue { background: linear-gradient(180deg, #3d7fb5, #15507e); }
.dot-green { background: linear-gradient(180deg, #35b06f, #1f8a4c); }

/* Bar chart */
.bars { display: flex; align-items: flex-end; gap: 22px; height: 210px; padding: 20px 26px 14px; overflow-x: auto; }
.bar-col { display: flex; flex-direction: column; align-items: center; gap: 8px; min-width: 60px; flex: 1; }
.bar-stack { display: flex; align-items: flex-end; gap: 6px; height: 150px; }
.bar-b, .bar-g { width: 20px; border-radius: 5px 5px 0 0; min-height: 3px; }
.bar-b { background: linear-gradient(180deg, #3d7fb5, #15507e); }
.bar-g { background: linear-gradient(180deg, #35b06f, #1f8a4c); }
.bar-lbl { font-size: .72rem; color: var(--ink-soft); font-weight: 600; text-align: center; max-width: 90px; }

/* Status rows */
.status-row { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.status-row-lbl { width: 90px; }
.status-row-n { width: 40px; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--navy-800); }

/* Chip count */
.chip-count { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: .72rem; font-weight: 700; background: #f3f8fd; color: var(--navy-600); border: 1px solid var(--line-3); }

/* Items table (new order positions) */
.items-block { margin-top: 8px; border: 1px solid var(--line-2); border-radius: 12px; overflow: hidden; }
.items-head { display: flex; align-items: center; justify-content: space-between; padding: 11px 14px; background: #f3f8fd; font-size: .78rem; font-weight: 700; color: var(--navy-600); text-transform: uppercase; letter-spacing: .04em; }
.items-table { width: 100%; border-collapse: collapse; }
.items-table th { text-align: left; padding: 8px 14px; font-size: .66rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-mut); background: #fff; border-bottom: 1px solid var(--line-2); }
.items-table th.num { text-align: right; }
.items-table td { padding: 6px 14px; border-bottom: 1px solid var(--line-2); }
.items-table td:last-child { text-align: center; }
.items-table input { width: 100%; padding: 7px 10px; border: 1px solid var(--line-in); border-radius: 7px; font: inherit; font-size: .85rem; }
.items-table input.num { text-align: right; }

/* ---------------- Toolbar / filters ---------------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; margin-bottom: 18px; }
.toolbar .spacer { flex: 1; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: .68rem; font-weight: 700; color: var(--ink-mut); text-transform: uppercase; letter-spacing: .05em; }
.field input, .field select, .field textarea {
  padding: 9px 12px; border: 1px solid var(--line-in); border-radius: 8px;
  font: inherit; font-size: .88rem; background: #fff; min-width: 150px; color: var(--ink);
}
.field textarea { min-height: 74px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--blue-accent); outline-offset: -1px; }
.field .req { color: var(--red-600); }

/* ---------------- Tables ---------------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; background: #fff; font-size: .86rem; }
table.data th {
  background: var(--th-grad); color: var(--ink-soft); text-align: left;
  padding: 12px 18px; font-size: .66rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  border-bottom: 1px solid var(--line-3); white-space: nowrap; user-select: none;
}
table.data th.sortable { cursor: pointer; }
table.data th.sortable:hover { color: var(--navy-600); }
table.data td { padding: 12px 18px; border-bottom: 1px solid var(--line-2); vertical-align: middle; color: var(--ink); }
table.data tbody tr { transition: background .12s; }
table.data tbody tr:hover { background: #f5f9fd; }
table.data .num { text-align: right; font-variant-numeric: tabular-nums; }
table.data .actions { text-align: right; white-space: nowrap; }
table.data .id-cell { font-family: var(--mono); font-weight: 700; color: var(--navy-600); }
.table-foot { display: flex; justify-content: space-between; align-items: center; padding: 14px 22px; color: var(--ink-mut); font-size: .82rem; border-top: 1px solid var(--line-2); }
.serial-range { font-family: var(--mono); font-size: .78rem; font-weight: 600; color: var(--navy-600); background: #f3f8fd; border: 1px solid var(--line-3); border-radius: 7px; padding: 3px 8px; white-space: nowrap; }
.empty-state { text-align: center; color: var(--ink-mut); padding: 50px 20px; }
.empty-state .big { font-size: 42px; margin-bottom: 12px; opacity: .8; }

/* ---------------- Badges ---------------- */
.badge {
  display: inline-block; padding: 3px 11px; border-radius: 20px;
  font-size: .72rem; font-weight: 700; white-space: nowrap;
}
.badge-krijuar  { background: var(--gray-100);  color: var(--gray-600); }
.badge-miratuar { background: var(--amber-100); color: var(--amber-600); }
.badge-paguar   { background: #e7f0fb;          color: var(--navy-600); }
.badge-pranuar  { background: var(--green-100); color: var(--green-600); }
.badge-anuluar  { background: var(--red-100);   color: var(--red-600); }

.progress { background: #e9eef4; border-radius: 999px; height: 8px; overflow: hidden; min-width: 90px; }
.progress > div { height: 100%; background: linear-gradient(90deg, #26a05a, #1f8a4c); border-radius: 999px; }

/* ---------------- Modals ---------------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(7,29,46,.55); backdrop-filter: blur(3px);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 5vh 16px; z-index: 100; overflow-y: auto;
}
.modal {
  background: #fff; border-radius: 18px; box-shadow: var(--shadow-lg);
  width: 100%; max-width: 640px; animation: pop .2s ease-out;
}
.modal.modal-lg { max-width: 840px; }
@keyframes pop { from { transform: translateY(16px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 24px; border-bottom: 1px solid var(--line-2);
  background: var(--th-grad); border-radius: 18px 18px 0 0;
}
.modal-head h3 { font-size: 1rem; font-weight: 800; color: var(--navy-800); }
.modal-close { background: none; border: none; font-size: 24px; line-height: 1; cursor: pointer; color: var(--ink-mut); }
.modal-close:hover { color: var(--red-600); }
.modal-body { padding: 24px; }
.modal-foot { padding: 16px 24px; border-top: 1px solid var(--line-2); display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }
.form-hint { font-size: .78rem; color: var(--ink-mut); margin-top: 4px; }
.form-error { background: var(--red-100); color: var(--red-600); border-radius: var(--radius-sm); padding: 11px 13px; font-size: .85rem; margin-bottom: 14px; }

/* Detail modal */
.detail-section-title { font-size: .82rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--navy-600); margin: 20px 0 10px; }
.detail-section-title:first-child { margin-top: 0; }
.detail-rows { display: grid; grid-template-columns: 180px 1fr; border: 1px solid var(--line-2); border-radius: 12px; overflow: hidden; }
.detail-rows > div { padding: 9px 13px; border-bottom: 1px solid var(--line-2); font-size: .87rem; }
.detail-rows > div:nth-last-child(-n+2) { border-bottom: none; }
.detail-rows > .k { font-weight: 600; color: var(--ink-soft); background: #f3f8fd; }
.history-table { width: 100%; border-collapse: collapse; font-size: .84rem; }
.history-table th { text-align: left; padding: 9px 13px; background: var(--th-grad); color: var(--ink-soft); font-size: .66rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; border-bottom: 1px solid var(--line-3); }
.history-table td { padding: 9px 13px; border-bottom: 1px solid var(--line-2); }

/* ---------------- Toasts ---------------- */
.toast-root { position: fixed; bottom: 22px; right: 22px; display: flex; flex-direction: column; gap: 10px; z-index: 200; }
.toast {
  background: var(--navy-800); color: #fff; padding: 13px 18px; border-radius: 12px;
  box-shadow: var(--shadow-lg); font-size: .88rem; max-width: 360px;
  animation: pop .2s ease-out; display: flex; gap: 10px; align-items: center;
}
.toast.ok { border-left: 4px solid var(--green-600); }
.toast.err { border-left: 4px solid var(--red-600); }

/* ---------------- Reports / print ---------------- */
.report-meta { color: var(--ink-mut); font-size: .82rem; }
@media print {
  .sidebar, .topbar, .toolbar, .hero, .no-print, .toast-root { display: none !important; }
  .content { padding: 0; }
  .card { box-shadow: none; border: 1px solid #ddd; }
  body { background: #fff; }
  table.data th { background: #eee !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ---------------- Responsive ---------------- */
@media (max-width: 860px) {
  .app { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; }
  .sidebar-nav { flex-direction: row; flex-wrap: wrap; }
  .content { padding: 20px 16px 50px; }
  .topbar { padding: 12px 16px; }
}
