/* ─────────────────────────────────────────────
   NordQR – stil
───────────────────────────────────────────── */
:root {
  --bg: #f6f8f6; --card: #fff; --line: #e4eae5; --line2: #edf1ee;
  --ink: #203a33; --ink2: #27443a; --text: #23332f; --muted: #8c9a93; --muted2: #a0ada6;
  --brand: #286c58; --brand2: #205a49; --brand-soft: #e9f4ef; --accent: #57b38f;
  --peach: #b86f58; --blue: #477e98; --warn: #e0a186; --error: #c26358;
  --radius: 11px; --radius-sm: 8px; --shadow: 0 4px 13px #294c3a0d;
  --font: 'DM Sans', system-ui, sans-serif; --head: 'Space Grotesk', sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: var(--bg); color: var(--text); font: 14px/1.5 var(--font); }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1,h2,h3 { margin: 0; font-family: var(--head); letter-spacing: -.015em; }
h1 { font-size: 30px; }
h2 { font-size: 17px; }
h3 { font-size: 14px; }
p { margin: 0; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.btn { display: inline-flex; align-items: center; gap: 7px; padding: 10px 15px; border: 0; border-radius: var(--radius-sm); font-size: 12px; font-weight: 700; transition: .18s; text-decoration: none; }
.btn.primary { color: #fff; background: var(--brand); box-shadow: 0 5px 14px #286c5833; }
.btn.primary:hover { background: var(--brand2); transform: translateY(-1px); text-decoration: none; }
.btn.secondary { color: #4d665c; background: #fff; border: 1px solid var(--line); }
.btn.secondary:hover { border-color: #9ccbb7; background: #f4faf7; text-decoration: none; }
.btn.danger { color: var(--error); background: #fbf0ee; }
.btn.danger:hover { background: #f7e3df; text-decoration: none; }
.btn.sm { padding: 7px 11px; font-size: 11px; }

/* ── Layout ── */
.app-shell { min-height: 100vh; display: flex; }
.sidebar { width: 248px; min-height: 100vh; padding: 26px 14px 16px; background: var(--card); border-right: 1px solid var(--line); display: flex; flex-direction: column; flex-shrink: 0; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; margin: 0 12px 28px; color: var(--ink); font: 700 22px var(--head); letter-spacing: -1px; text-decoration: none; }
.brand:hover { text-decoration: none; }
.brand strong { color: var(--accent); }
.brand-mark { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 9px; color: #fff; background: var(--brand); font-size: 14px; font-weight: 700; box-shadow: 0 5px 12px #2456482e; }
.workspace { display: flex; align-items: center; gap: 10px; padding: 10px; margin-bottom: 22px; border: 1px solid var(--line2); border-radius: 10px; }
.ws-avatar, .profile-avatar, .topbar-avatar { display: grid; place-items: center; color: #23604e; background: #d7eee5; font-weight: 700; font-size: 10px; }
.ws-avatar { width: 29px; height: 29px; border-radius: 8px; }
.workspace strong, .profile strong { display: block; font-size: 12px; }
.workspace small, .profile small { color: #97a49e; font-size: 10px; }
.main-nav { flex: 1; }
.nav-label { display: flex; align-items: center; padding: 0 12px; margin: 0 0 8px; color: #a2ada7; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .13em; }
.nav-label + .nav-label, .nav-label:nth-of-type(2) { margin-top: 22px; }
.nav-link { display: flex; align-items: center; gap: 11px; padding: 10px 12px; margin: 2px 0; border-radius: 9px; color: #78877f; background: transparent; font-size: 13px; font-weight: 500; text-decoration: none; transition: .2s; border: 0; width: 100%; text-align: left; }
.nav-link:hover { color: var(--ink2); background: var(--brand-soft); text-decoration: none; }
.nav-link.selected { color: var(--ink2); background: var(--brand-soft); font-weight: 700; }
.nav-link .ico { width: 18px; text-align: center; font-size: 14px; }
.nav-link .count { margin-left: auto; padding: 1px 7px; border-radius: 10px; background: #edf1ef; font-size: 10px; font-weight: 700; }
.nav-link.selected .count { color: #4d8c77; background: #dff2e9; }
.logout-btn { font-family: var(--font); }
.sidebar-bottom { margin-top: auto; }
.support-card { display: flex; gap: 10px; align-items: flex-start; margin: 20px 0 16px; padding: 12px; border-radius: 10px; background: #eff8f4; color: #387463; }
.support-ico { font-size: 16px; }
.support-card strong { display: block; color: #316353; font-size: 11px; }
.support-card small { color: #78a491; font-size: 10px; }
.profile { display: flex; align-items: center; gap: 9px; padding: 12px 8px 0; border-top: 1px solid var(--line2); }
.profile-avatar { width: 28px; height: 28px; border-radius: 50%; }
.profile > div { flex: 1; }
.profile strong { font-size: 12px; color: #4e665c; }

.content { flex: 1; min-width: 0; }
.topbar { height: 74px; padding: 0 4.5%; display: flex; align-items: center; justify-content: space-between; gap: 20px; border-bottom: 1px solid var(--line); background: var(--card); }
.breadcrumb { color: #9ca8a2; font-size: 12px; }
.breadcrumb span { padding: 0 9px; color: #c8cfcb; }
.global-search { display: flex; align-items: center; gap: 8px; width: 230px; border-bottom: 1px solid #dfe7e2; color: #92a098; }
.global-search input { width: 100%; padding: 8px 0; border: 0; outline: 0; background: transparent; font-size: 12px; color: #30463d; }
.global-search input::placeholder { color: #adb8b2; }
.search-ico { font-size: 13px; }
.topbar-avatar { width: 30px; height: 30px; border-radius: 50%; }
.mobile-menu { display: none; border: 0; background: transparent; font-size: 20px; color: #49665b; }

.page-body { padding: 40px 4.5% 50px; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 25px; margin-bottom: 28px; flex-wrap: wrap; }
.eyebrow { display: flex; align-items: center; gap: 7px; color: var(--accent); font-size: 10px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
.status-dot { width: 6px; height: 6px; border-radius: 50%; background: #57b38f; box-shadow: 0 0 0 4px #dcf1e8; }
h1 { margin: 9px 0 6px; color: var(--ink); }
.page-heading > div > p { color: var(--muted); font-size: 13px; }

/* ── Stat cards ── */
.stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 30px; }
.stat-card { display: flex; gap: 14px; align-items: flex-start; padding: 19px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow); }
.stat-icon { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 9px; font-size: 17px; }
.stat-icon.green { color: #34836d; background: #e2f3eb; }
.stat-icon.blue { color: #477e98; background: #e3f0f5; }
.stat-icon.peach { color: #b86f58; background: #fbebe4; }
.stat-card p { margin-bottom: 6px; color: var(--muted); font-size: 11px; }
.stat-card strong { display: block; color: var(--ink2); font: 700 23px var(--head); }
.stat-card small { display: block; margin-top: 5px; color: var(--muted2); font-size: 10px; }

/* ── Panel / card ── */
.panel { padding: 22px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow); margin-bottom: 18px; }
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 18px; gap: 15px; flex-wrap: wrap; }
.panel-head h2 { color: var(--ink2); }
.panel-head p { margin-top: 4px; color: var(--muted); font-size: 11px; }

/* ── Tabs & toolbar ── */
.toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap; gap: 12px; }
.tabs { display: flex; gap: 22px; }
.tab { padding: 0 1px 12px; border: 0; color: #a2aea8; background: transparent; font-size: 12px; font-weight: 600; text-decoration: none; position: relative; }
.tab span { margin-left: 5px; padding: 2px 6px; border-radius: 10px; background: #edf1ef; font-size: 10px; }
.tab.active { color: var(--brand); }
.tab.active:after { content: ''; position: absolute; bottom: -1px; left: 0; right: 0; height: 2px; border-radius: 2px; background: var(--accent); }
.tab.active span { color: #4d8c77; background: #dff2e9; }
.filters { display: flex; gap: 8px; padding-bottom: 8px; flex-wrap: wrap; }
.select-control { display: flex; align-items: center; gap: 7px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 7px; background: #fff; font-size: 11px; color: #718278; }
.select-control select { border: 0; outline: 0; background: transparent; font-size: 11px; color: #65776e; max-width: 140px; }

/* ── QR/EAN grid ── */
.grid-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.item-card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); overflow: hidden; transition: .2s; }
.item-card:hover { transform: translateY(-3px); box-shadow: 0 12px 24px #37644b12; }
.item-card.archived { opacity: .62; }
.card-top { display: flex; gap: 15px; padding: 18px 18px 12px; align-items: flex-start; }
.card-top-info { flex: 1; min-width: 0; }
.card-top-info h3 { margin: 0 0 5px; color: var(--ink2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge { display: inline-block; padding: 2px 7px; border-radius: 4px; font-size: 9px; font-weight: 700; }
.badge.live { color: #4b9d7e; background: #e8f6ef; }
.badge.off { color: #969f9a; background: #eef1f0; }
.badge.direct { color: #5b9bb0; background: #e6f2f6; }
.card-body { padding: 0 18px 18px; }
.dest { display: flex; gap: 5px; align-items: center; margin: 0 0 12px; color: var(--muted2); font-size: 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meta-row { display: flex; gap: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--line2); color: var(--muted2); font-size: 10px; flex-wrap: wrap; }
.card-footer { display: flex; align-items: center; justify-content: space-between; padding-top: 12px; font-size: 10px; color: var(--muted2); gap: 8px; flex-wrap: wrap; }
.card-footer strong { color: #57736a; }
.card-actions { display: flex; gap: 6px; margin-top: 12px; }

/* ── Tables ── */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 12px; }
table.data th { text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
table.data td { padding: 12px; border-bottom: 1px solid var(--line2); color: #4e665c; vertical-align: top; }
table.data tr:hover td { background: #fafdfb; }
.mono { font-family: 'Space Grotesk', monospace; font-weight: 600; color: var(--ink2); }

/* ── Forms ── */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; color: #61766c; font-size: 11px; font-weight: 700; }
.form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: 10px 12px; border: 1px solid #dce6e0; border-radius: 7px; outline: 0; color: #335147; background: #fff; font-size: 13px; font-family: var(--font);
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { border-color: #71b69b; box-shadow: 0 0 0 3px #e4f5ed; }
.form-group textarea { resize: vertical; min-height: 80px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-actions { display: flex; gap: 9px; justify-content: flex-end; margin-top: 18px; }
.toggle-row { display: flex; justify-content: space-between; align-items: center; padding: 12px 0; border-top: 1px solid var(--line2); }
.toggle-row strong { color: #3f5c51; font-size: 12px; }
.toggle-row small { display: block; margin-top: 2px; color: var(--muted2); font-size: 10px; }
.switch { position: relative; width: 38px; height: 22px; flex-shrink: 0; }
.switch input { opacity: 0; width: 100%; height: 100%; margin: 0; position: absolute; z-index: 2; cursor: pointer; }
.switch .slider { position: absolute; inset: 0; border-radius: 20px; background: #dbe4df; transition: .2s; }
.switch .slider:after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: .2s; }
.switch input:checked + .slider { background: var(--accent); }
.switch input:checked + .slider:after { transform: translateX(16px); }

/* ── Modal ── */
.modal-backdrop { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 20px; background: #1d393266; backdrop-filter: blur(4px); }
.modal { width: min(560px, 100%); max-height: 92vh; overflow: auto; padding: 26px; border-radius: 14px; background: #fff; box-shadow: 0 20px 60px #1e46382e; }
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 22px; }
.modal-head h2 { font-size: 21px; color: var(--ink); }
.modal-head .eyebrow { margin-bottom: 6px; }
.close-btn { border: 0; background: transparent; font-size: 22px; color: var(--muted); line-height: 1; padding: 0; }
.close-btn:hover { color: var(--ink); }

/* ── Empty state ── */
.empty { padding: 50px 20px; border: 1px dashed #cbdcd2; border-radius: 12px; color: #7a9187; text-align: center; }
.empty h3 { margin: 12px 0 5px; color: #355448; font-size: 17px; }
.empty p { margin-bottom: 18px; font-size: 12px; }

/* ── Alerts ── */
.alert { padding: 14px 16px; border-radius: 9px; margin-bottom: 18px; font-size: 12px; }
.alert.success { background: #e8f6ef; color: #2e6b56; }
.alert.error { background: #fbf0ee; color: #a14e44; }
.alert ul { margin: 8px 0 0; padding-left: 18px; }
.alert code { background: #00000010; padding: 1px 5px; border-radius: 4px; }

/* ── Toast ── */
.toast { position: fixed; right: 25px; bottom: 25px; z-index: 40; padding: 12px 17px; border-radius: 8px; color: #fff; background: var(--brand); box-shadow: 0 8px 25px #24564840; font-size: 12px; animation: slideIn .25s; }
@keyframes slideIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* ── Bars (stats) ── */
.bars { display: grid; gap: 16px; }
.bar-row { display: grid; grid-template-columns: 150px 1fr 55px; gap: 14px; align-items: center; font-size: 11px; color: #75847b; }
.bar-track { height: 9px; border-radius: 7px; background: #edf3ef; overflow: hidden; }
.bar-fill { display: block; height: 100%; border-radius: inherit; background: var(--accent); }
.bar-row strong { color: #4a675b; text-align: right; }

/* ── Notes / comments ── */
.notes-box { padding: 14px 16px; border-radius: 9px; background: #f3f8f5; color: #4e6c5f; font-size: 12px; line-height: 1.6; white-space: pre-wrap; }
.comment { padding: 12px 0; border-bottom: 1px solid var(--line2); }
.comment:last-child { border-bottom: 0; }
.comment-meta { color: var(--muted2); font-size: 10px; margin-bottom: 4px; }
.comment-body { color: #4e665c; font-size: 12px; }

/* ── Login & install ── */
.auth-page, .install-page { display: grid; place-items: center; min-height: 100vh; background: var(--bg); padding: 20px; }
.auth-card, .install-card { width: min(400px, 100%); padding: 36px 32px; border: 1px solid var(--line); border-radius: 14px; background: #fff; box-shadow: 0 10px 40px #1e463818; }
.auth-card .brand, .install-card .brand { justify-content: center; margin-bottom: 26px; }
.auth-card h1, .install-card h1 { text-align: center; font-size: 22px; margin-bottom: 6px; }
.auth-card .sub { text-align: center; color: var(--muted); font-size: 12px; margin-bottom: 24px; }
.install-card .btn { width: 100%; justify-content: center; margin-top: 10px; }

/* ── Backup ── */
.backup-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 18px; }
.backup-card { padding: 22px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow); }
.backup-card h2 { margin-bottom: 6px; }
.backup-card p { color: var(--muted); font-size: 12px; line-height: 1.6; max-width: 320px; }
.backup-icon { width: 38px; height: 38px; display: grid; place-items: center; margin-bottom: 16px; border-radius: 9px; font-size: 18px; color: #3f906f; background: #e5f4ec; }
.backup-icon.peach { color: #c37862; background: #fbede7; }
.backup-card .btn { margin-top: 18px; }
.sftp-status { display: flex; align-items: center; gap: 9px; margin-top: 16px; color: #a0776d; font-size: 11px; }
.history-row { display: flex; align-items: center; gap: 12px; padding: 13px 0; border-top: 1px solid var(--line2); }
.history-icon { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 7px; font-size: 13px; color: #4c9b7b; background: #e8f6ef; }
.history-row > div:nth-child(2) { flex: 1; }
.history-row strong { display: block; font-size: 12px; color: #4e665c; }
.history-row small { color: var(--muted2); font-size: 10px; }
.history-row > span { color: var(--muted2); font-size: 10px; }

/* ── EAN image upload ── */
.ean-thumb-img { width: 110px; height: 110px; border-radius: 8px; object-fit: cover; flex-shrink: 0; border: 1px solid var(--line); }
.image-preview { display: flex; gap: 16px; align-items: center; padding: 16px; border: 1px solid var(--line); border-radius: 9px; background: #f9fbfa; }
.image-preview img { width: 160px; height: 160px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.image-preview-actions { flex: 1; display: flex; flex-direction: column; gap: 10px; }
.image-preview-buttons { display: flex; gap: 8px; flex-wrap: wrap; }
.image-filename { font-size: 12px; color: var(--muted); }
.form-group input[type="file"] { padding: 9px 0; border: 0; background: transparent; font-size: 12px; }

/* ── Code image links & download ── */
.code-image-link { display: block; flex-shrink: 0; border-radius: 8px; overflow: hidden; transition: .18s; }
.code-image-link:hover { opacity: .85; }
.qr-thumb { width: 110px; height: 110px; border-radius: 8px; object-fit: contain; background: #f4f8f5; flex-shrink: 0; }
.ean-thumb { width: 110px; height: 110px; border-radius: 8px; background: #eef5f1; display: grid; place-items: center; flex-shrink: 0; }
.ean-thumb span { font-family: var(--head); font-size: 13px; font-weight: 700; color: #4e8773; text-align: center; line-height: 1.2; word-break: break-all; padding: 8px; }
.link-dest { color: var(--accent); text-decoration: none; cursor: pointer; }
.link-dest:hover { text-decoration: underline; }
.qr-display { display: flex; gap: 24px; align-items: flex-start; flex-wrap: wrap; }
.qr-display-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 28px; }

/* ── Responsive ── */
@media (max-width: 1024px) { .backup-grid { grid-template-columns: 1fr; } }
@media (max-width: 760px) {
  .sidebar { display: none; position: fixed; z-index: 50; height: 100vh; }
  .sidebar.open { display: flex; }
  .mobile-menu { display: block; }
  .topbar { padding: 0 20px; }
  .global-search { width: 130px; }
  .page-body { padding: 28px 20px 40px; }
  .form-row { grid-template-columns: 1fr; }
  .bar-row { grid-template-columns: 90px 1fr 40px; gap: 8px; font-size: 10px; }
}
