/* Portal: teme (paleta din secamtrack) și componente comune. Dimensiunile: portal.desktop.css / portal.mobile.css */

:root {
  --bg: #e8eef5; --surface: #ffffff; --alt: #dde5ef; --text: #0f172a; --muted: #475569;
  --line: #94a3b8; --line-soft: #cbd5e1; --nav: #1e293b; --nav-text: #ffffff; --nav-muted: #94a3b8;
  --accent: #4d7c0f; --accent2: #0ea5e9; --on-accent: #ffffff; --input: #ffffff;
  --danger: #b91c1c; --warn-bg: #fef3c7; --warn-text: #78350f; --shadow: 0 8px 24px rgba(15, 23, 42, .22);
  --ic-1: #4d7c0f; --ic-2: #0369a1; --ic-3: #475569; --ic-4: #b45309; --ic-5: #be185d;
  --ic-6: #7c3aed; --ic-7: #0e7490; --ic-8: #15803d; --ic-9: #9a3412; --ic-10: #1d4ed8;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg: #0b1220; --surface: #121a2b; --alt: #1a2438; --text: #e8eef8; --muted: #9aabc4;
    --line: #2a3650; --line-soft: #222d43; --nav: #0b1220; --nav-text: #e8eef8; --nav-muted: #7d8fab;
    --accent: #2dd4bf; --accent2: #0ea5e9; --on-accent: #042f2a; --input: #0b1220;
    --danger: #f87171; --warn-bg: #3b2a0a; --warn-text: #fcd34d; --shadow: 0 8px 24px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}
[data-theme="luminos"] {
  --bg: #e8eef5; --surface: #ffffff; --alt: #dde5ef; --text: #0f172a; --muted: #475569;
  --line: #94a3b8; --line-soft: #cbd5e1; --nav: #1e293b; --nav-text: #ffffff; --nav-muted: #94a3b8;
  --accent: #4d7c0f; --accent2: #0ea5e9; --on-accent: #ffffff; --input: #ffffff; color-scheme: light;
}
[data-theme="intunecat"] {
  --bg: #0b1220; --surface: #121a2b; --alt: #1a2438; --text: #e8eef8; --muted: #9aabc4;
  --line: #2a3650; --line-soft: #222d43; --nav: #0b1220; --nav-text: #e8eef8; --nav-muted: #7d8fab;
  --accent: #2dd4bf; --accent2: #0ea5e9; --on-accent: #042f2a; --input: #0b1220;
  --danger: #f87171; --warn-bg: #3b2a0a; --warn-text: #fcd34d; --shadow: 0 8px 24px rgba(0, 0, 0, .5); color-scheme: dark;
}
[data-theme="azur"] {
  --bg: #c8e4fa; --surface: #daf0ff; --alt: #b0d8f5; --text: #0b2f4a; --muted: #1a5270;
  --line: #3d8ec0; --line-soft: #9cc9e8; --nav: #0a3d66; --nav-text: #eef8ff; --nav-muted: #9ec8ea;
  --accent: #0369a1; --accent2: #0284c7; --on-accent: #ffffff; --input: #f0f9ff; color-scheme: light;
}
[data-theme="ocean"] {
  --bg: #b9d6ef; --surface: #d0e6f8; --alt: #a8cce8; --text: #0a2740; --muted: #1e4d6e;
  --line: #4a7fa8; --line-soft: #93bbdb; --nav: #0a3558; --nav-text: #eef7ff; --nav-muted: #93bddf;
  --accent: #0369a1; --accent2: #0e7490; --on-accent: #ffffff; --input: #e6f2fc; color-scheme: light;
}
[data-theme="sepia"] {
  --bg: #e6d2b0; --surface: #f0e0c4; --alt: #ddc49a; --text: #3b2414; --muted: #6b4528;
  --line: #a67c52; --line-soft: #cfb089; --nav: #6b3a22; --nav-text: #fff7eb; --nav-muted: #e0bf9c;
  --accent: #b45309; --accent2: #9a3412; --on-accent: #ffffff; --input: #f7ead3; color-scheme: light;
}
[data-theme="ardezie"] {
  --bg: #c5ccd6; --surface: #d8dee6; --alt: #b4bdc9; --text: #0f172a; --muted: #334155;
  --line: #64748b; --line-soft: #a3adbb; --nav: #1e293b; --nav-text: #f8fafc; --nav-muted: #94a3b8;
  --accent: #334155; --accent2: #1d4ed8; --on-accent: #ffffff; --input: #e7ebf0; color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 14px/1.35 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}
[hidden] { display: none !important; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
svg .fill { fill: currentColor; stroke: none; }

/* bara de sus */
.bar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 6px;
  padding: 6px 10px; background: var(--nav); color: var(--nav-text);
}
.brand { font-size: 15px; white-space: nowrap; margin-right: 4px; }
.sp { flex: 1; }
.search {
  min-width: 0; padding: 0 10px; border: 1px solid var(--line); border-radius: 6px;
  background: var(--input); color: var(--text); font: inherit;
}
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  border: 0; border-radius: 6px; background: transparent; color: inherit; cursor: pointer; padding: 0;
  text-decoration: none;
}
.icon-btn:hover, .icon-btn:focus-visible { background: rgba(127, 127, 127, .18); outline: none; }
.txt-btn {
  border: 1px solid var(--nav-muted); border-radius: 6px; padding: 0 10px; background: transparent;
  color: var(--nav-text); font: inherit; font-size: 13px; cursor: pointer; white-space: nowrap;
}
.txt-btn:hover, .txt-btn:focus-visible { background: rgba(127, 127, 127, .18); outline: none; }

/* butoane și câmpuri */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 0 12px; border: 1px solid var(--line); border-radius: 6px;
  background: var(--surface); color: var(--text); font: inherit; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover, .btn:focus-visible { background: var(--alt); outline: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover, .btn.primary:focus-visible { filter: brightness(1.08); }
.btn.danger { color: var(--danger); }
.btn.sq { padding: 0; }
input[type=text], input[type=password], input[type=search], textarea {
  padding: 0 10px; border: 1px solid var(--line); border-radius: 6px;
  background: var(--input); color: var(--text); font: inherit;
}
textarea { padding: 6px 10px; resize: vertical; }
input:focus, textarea:focus, .search:focus { outline: 2px solid var(--accent2); outline-offset: -1px; }

/* chip-uri */
.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; padding: 0 12px; border: 1px solid var(--line-soft); border-radius: 16px;
  background: var(--surface); color: var(--text); font: inherit; font-size: 13px; cursor: pointer; white-space: nowrap;
}
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }

/* plăci */
.tiles { display: grid; }
.tile {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 8px 4px; border-radius: 10px; color: var(--text); text-decoration: none; text-align: center; min-width: 0;
}
.tile:hover, .tile:focus-visible { background: var(--alt); outline: none; }
.tile .ic {
  position: relative; display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; letter-spacing: -.02em; box-shadow: 0 1px 3px rgba(0, 0, 0, .18);
}
.tile .nm {
  max-width: 100%; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  line-height: 1.2; word-break: break-word;
}
.tile .badge {
  position: absolute; right: -4px; bottom: -4px; width: 18px; height: 18px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface); color: var(--muted); box-shadow: 0 0 0 1.5px var(--bg);
}
.tile .badge svg { width: 12px; height: 12px; stroke-width: 2.2; }
.tile.is-hidden { opacity: .5; }
.ic-1 { background: var(--ic-1); } .ic-2 { background: var(--ic-2); } .ic-3 { background: var(--ic-3); }
.ic-4 { background: var(--ic-4); } .ic-5 { background: var(--ic-5); } .ic-6 { background: var(--ic-6); }
.ic-7 { background: var(--ic-7); } .ic-8 { background: var(--ic-8); } .ic-9 { background: var(--ic-9); }
.ic-10 { background: var(--ic-10); }

.empty { display: none; color: var(--muted); padding: 16px 10px; text-align: center; }

/* meniu (temă) */
.menu {
  position: fixed; z-index: 40; min-width: 150px; padding: 4px;
  background: var(--surface); color: var(--text); border: 1px solid var(--line-soft); border-radius: 8px; box-shadow: var(--shadow);
}
.menu button {
  display: flex; align-items: center; gap: 8px; width: 100%; padding: 0 10px; border: 0; border-radius: 5px;
  background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer;
}
.menu button:hover, .menu button:focus-visible { background: var(--alt); outline: none; }
.menu button[aria-checked="true"] { color: var(--accent); font-weight: 600; }
.menu .dot { width: 12px; height: 12px; border-radius: 6px; border: 1px solid var(--line); flex: none; }

/* dialog */
.scrim {
  position: fixed; inset: 0; z-index: 30; background: rgba(15, 23, 42, .45);
  display: flex; align-items: flex-start; justify-content: center; padding: 8vh 10px 10px;
}
.dlg {
  background: var(--surface); color: var(--text); border-radius: 10px; box-shadow: var(--shadow);
  width: auto; max-width: 100%; max-height: 84vh; overflow: auto; padding: 12px 14px;
}
.dlg h3 { margin: 0 0 10px; font-size: 15px; }
.dlg .row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.dlg .acts { display: flex; gap: 6px; justify-content: flex-end; margin-top: 12px; }
.dlg .acts .left { margin-right: auto; }
.err { color: var(--danger); font-size: 13px; min-height: 0; margin-top: 6px; }
.err:empty { display: none; }
.fld { display: grid; grid-template-columns: auto 1fr; gap: 8px 10px; align-items: center; }
.fld > label { font-size: 13px; color: var(--muted); white-space: nowrap; }
.fld .full { grid-column: 1 / -1; }

/* buton segmentat */
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.seg button {
  border: 0; border-right: 1px solid var(--line); padding: 0 10px; background: var(--surface); color: var(--text);
  font: inherit; font-size: 13px; cursor: pointer; white-space: nowrap;
}
.seg button:last-child { border-right: 0; }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }
.seg button:focus-visible { outline: 2px solid var(--accent2); outline-offset: -2px; }

/* culori iconiță */
.swatches { display: flex; gap: 6px; flex-wrap: wrap; }
.swatches button { width: 26px; height: 26px; border-radius: 6px; border: 2px solid transparent; cursor: pointer; padding: 0; }
.swatches button[aria-pressed="true"] { border-color: var(--text); }

/* autocomplete */
.ac { position: relative; }
.ac-list {
  position: absolute; left: 0; right: 0; top: calc(100% + 2px); z-index: 50; max-height: 220px; overflow: auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: 6px; box-shadow: var(--shadow); padding: 3px;
}
.ac-list div { padding: 0 8px; border-radius: 4px; cursor: pointer; display: flex; align-items: center; }
.ac-list div.on, .ac-list div:hover { background: var(--alt); }

/* toast */
.toast {
  position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 60;
  background: var(--nav); color: var(--nav-text); padding: 8px 14px; border-radius: 8px; box-shadow: var(--shadow);
  font-size: 13px; max-width: calc(100% - 32px);
}
.toast.bad { background: var(--danger); color: #fff; }

/* panoul de admin */
.admin {
  position: fixed; inset: 0; z-index: 20; background: var(--bg); display: flex; flex-direction: column;
}
.admin .bar { position: static; }
.admin .body { flex: 1; overflow: auto; }
.admin .wrap { margin: 0 auto; }
.admin h4 { margin: 12px 0 6px; font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.admin h4 .sp { flex: 1; }
.alist { background: var(--surface); border: 1px solid var(--line-soft); border-radius: 8px; overflow: hidden; }
.arow { display: flex; align-items: center; gap: 8px; padding: 4px 8px; border-bottom: 1px solid var(--line-soft); background: var(--surface); }
.arow:last-child { border-bottom: 0; }
.arow .grip { cursor: grab; color: var(--muted); touch-action: none; display: flex; align-items: center; justify-content: center; flex: none; }
.arow .ic { color: #fff; font-weight: 700; display: flex; align-items: center; justify-content: center; flex: none; }
.arow .tx { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.arow .tx b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.arow .tx span { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.arow .warn { color: var(--warn-text); background: var(--warn-bg); border-radius: 4px; padding: 0 5px; font-size: 11px; margin-left: 6px; }
.arow.dragging { opacity: .6; box-shadow: var(--shadow); position: relative; z-index: 2; }
.arow .ghost-gap { height: 0; }
.alist .none { padding: 10px; color: var(--muted); }
.logt { width: 100%; border-collapse: collapse; font-size: 12px; background: var(--surface); border: 1px solid var(--line-soft); border-radius: 8px; overflow: hidden; }
.logt td { padding: 5px 8px; border-bottom: 1px solid var(--line-soft); text-align: left; white-space: nowrap; }
.logt td.c { text-align: center; }
.logt td.p { white-space: normal; word-break: break-all; width: 100%; }
.setgrid { background: var(--surface); border: 1px solid var(--line-soft); border-radius: 8px; padding: 10px; display: grid; grid-template-columns: auto auto auto; gap: 8px 10px; align-items: center; justify-content: start; }
.setgrid label { font-size: 13px; color: var(--muted); white-space: nowrap; }

/* pagina de login a porții și erori */
body.center { display: flex; align-items: flex-start; justify-content: center; padding: 14vh 16px 16px; min-height: 100vh; }
.box { background: var(--surface); border: 1px solid var(--line-soft); border-radius: 10px; padding: 14px 16px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 8px; align-items: flex-start; max-width: 100%; }
.box p { margin: 0; }
.box label { font-size: 13px; color: var(--muted); }
.box .row { display: flex; gap: 6px; max-width: 100%; }
.box input { height: 38px; width: 220px; max-width: 100%; min-width: 0; }
.box .btn { height: 38px; }
.box .link { color: var(--muted); font-size: 13px; }

/* răsfoire fișiere */
.crumbs { display: flex; align-items: center; min-width: 0; overflow: hidden; white-space: nowrap; font-size: 13px; }
.crumbs a { color: var(--nav-text); text-decoration: none; padding: 2px 4px; border-radius: 4px; overflow: hidden; text-overflow: ellipsis; }
.crumbs a:hover { background: rgba(127, 127, 127, .18); }
.crumbs a:last-child { font-weight: 600; flex: none; }
.crumbs i { color: var(--nav-muted); font-style: normal; padding: 0 1px; }
.flist { margin: 0 auto; }
.frows { background: var(--surface); border: 1px solid var(--line-soft); border-radius: 8px; overflow: hidden; }
.frow { display: flex; align-items: center; gap: 10px; padding: 0 10px; border-bottom: 1px solid var(--line-soft); color: var(--text); text-decoration: none; }
.frow:last-child { border-bottom: 0; }
.frow:hover, .frow:focus-visible { background: var(--alt); outline: none; }
.frow .fi { flex: none; color: var(--muted); display: flex; }
.frow .fi.dir { color: var(--accent); }
.frow .fn { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.frow .fn small { display: block; color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; }
.frow .fs, .frow .ft { flex: none; color: var(--muted); font-size: 12px; text-align: center; font-variant-numeric: tabular-nums; }
.fhead { font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); margin: 12px 2px 6px; }

/* previzualizare */
.preview { position: fixed; inset: 0; z-index: 35; background: rgba(0, 0, 0, .86); display: flex; flex-direction: column; }
.preview .pbar { display: flex; align-items: center; gap: 6px; padding: 6px 10px; color: #fff; }
.preview .pbar b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.preview .pbar .btn { background: rgba(255, 255, 255, .12); color: #fff; border-color: rgba(255, 255, 255, .25); }
.preview .pbar .icon-btn { color: #fff; }
.preview .pbody { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 0 6px 6px; }
.preview img { max-width: 100%; max-height: 100%; object-fit: contain; }
.preview iframe { width: 100%; height: 100%; border: 0; background: #fff; border-radius: 4px; }
.fld .seg, .fld .swatches { justify-self: start; }

/* aspectul paginii: plăci (implicit), listă, carduri */
.items { display: grid; }
.items .tile .tx { display: flex; flex-direction: column; min-width: 0; flex: 1; text-align: left; gap: 1px; }
.items .tile .ds { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.layout-list .tile, .layout-cards .tile { flex-direction: row; align-items: center; text-align: left; }
.layout-list .tile .nm, .layout-cards .tile .nm { -webkit-line-clamp: 1; font-weight: 600; }
.layout-list { background: var(--surface); border: 1px solid var(--line-soft); border-radius: 8px; overflow: hidden; }
.layout-list .tile { border-radius: 0; border-bottom: 1px solid var(--line-soft); }
.layout-list .tile:last-child { border-bottom: 0; }
.layout-cards .tile { background: var(--surface); border: 1px solid var(--line-soft); }
.layout-cards .tile .ds { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.layout-list .tile .badge, .layout-cards .tile .badge { width: 16px; height: 16px; right: -5px; bottom: -5px; }
.layout-list .tile .badge svg, .layout-cards .tile .badge svg { width: 10px; height: 10px; }

/* setări: aspect și temă */
.setgrid.two { grid-template-columns: auto 1fr; margin-bottom: 8px; }
.setgrid .note { grid-column: 1 / -1; font-size: 12px; color: var(--muted); }
.pick { display: flex; flex-wrap: wrap; gap: 6px; }
.pick .chip { display: inline-flex; align-items: center; gap: 6px; }
.pick .chip .dot { width: 12px; height: 12px; border-radius: 6px; border: 1px solid var(--line); flex: none; }
.setgrid .seg, .setgrid .pick { justify-self: start; }
