/* Calendar PDF Online */
:root {
  --bg: #f3f4f6; --card: #fff; --ink: #1f2937; --muted: #6b7280; --line: #e3e6ea;
  --green: #2e9e4f; --green-d: #257f40; --blue: #1f6feb; --blue-d: #1a5bc4; --red: #c8402f; --amber: #b7791f;
  --ok: #1a7f37; --radius: 8px;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif; font-size: 15px; color: var(--ink);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); line-height: 1.45; }
a { color: var(--blue); }
h1 { font-size: 1.35rem; margin: 0 0 .4rem; }
h2 { font-size: 1.1rem; margin: 1rem 0 .5rem; }
h3 { font-size: .95rem; margin: 0 0 .5rem; }
small { display: block; font-size: .8rem; color: var(--muted); }
code, pre.code { font-family: Consolas, "Courier New", monospace; font-size: .85rem; }
pre.code { background: #111827; color: #e5e7eb; padding: 12px 14px; border-radius: 6px; overflow-x: auto; white-space: pre-wrap; word-break: break-all; }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.center { text-align: center; }
.ok { color: var(--ok); }
.err, .bad { color: var(--red); }
.warn { color: var(--amber); }
.grow { flex: 1 1 auto; }

/* antet */
.top { display: flex; align-items: center; gap: 22px; padding: 10px 22px; background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--ink); text-decoration: none; white-space: nowrap; }
.brand .logo { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 7px; background: var(--green); color: #fff; font-size: .72rem; letter-spacing: .5px; }
.brand.big { font-size: 1.2rem; margin-bottom: 4px; }
.nav { display: flex; gap: 4px; flex: 1 1 auto; flex-wrap: wrap; }
.nav a { padding: 7px 12px; border-radius: 6px; color: var(--ink); text-decoration: none; }
.nav a:hover { background: var(--bg); }
.nav a.on { background: #e8f5ec; color: var(--green-d); font-weight: 600; }
.who { display: flex; gap: 14px; align-items: center; white-space: nowrap; }
.who a { color: var(--ink); text-decoration: none; }
.who small { display: inline; background: #eef2ff; color: #3730a3; border-radius: 4px; padding: 1px 6px; margin-left: 4px; }
.who .out { color: var(--muted); }
.main { max-width: 1400px; margin: 0 auto; padding: 18px 22px 60px; }

/* elemente */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 16px; }
.card.narrow { max-width: 560px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 14px; border-radius: 6px; border: 1px solid #d5d8de; background: #f7f8fa; color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: #eceef2; }
.btn:disabled, .btn[disabled] { opacity: .5; cursor: default; }
.btn.primary, .btn.blue { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn.primary:hover, .btn.blue:hover { background: var(--blue-d); }
.btn.green { background: var(--green); border-color: var(--green); color: #fff; }
.btn.green:hover { background: var(--green-d); }
.btn.danger { color: var(--red); }
.btn.ghost { background: transparent; }
.btn.sm { padding: 5px 10px; font-size: .85rem; }
.btn.huge { padding: 14px 28px; font-size: 1.15rem; letter-spacing: .3px; }
.btn.wide { width: 100%; }
.alert { padding: 10px 14px; border-radius: 6px; margin: 0 0 12px; border: 1px solid; }
.alert.ok { background: #ecfdf3; border-color: #b7ebc6; color: #14532d; }
.alert.err { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.alert.warn { background: #fffbeb; border-color: #fde68a; color: #78350f; }
.alert.banner { margin: 0; border-radius: 0; border-width: 0 0 1px; text-align: center; }
.form { display: grid; gap: 12px; }
.form.two { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); align-items: start; }
.form label { display: grid; gap: 4px; font-weight: 600; font-size: .9rem; }
.form label.check { display: flex; align-items: center; gap: 8px; font-weight: 500; }
input, select, textarea { font: inherit; padding: 8px 10px; border: 1px solid #cfd4da; border-radius: 6px; background: #fff; color: var(--ink); min-width: 0; }
input:focus, select:focus { outline: 2px solid #bfdbfe; border-color: var(--blue); }
.form small { font-weight: 400; }
.inl { display: inline; }
details { display: inline-block; vertical-align: top; }
details > summary { list-style: none; }
details > summary::-webkit-details-marker { display: none; }
details[open] .form.inline { position: absolute; z-index: 5; right: 22px; margin-top: 6px; width: 340px; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 14px; box-shadow: 0 10px 30px rgba(0,0,0,.12); }
.checks { list-style: none; padding: 0; margin: 0 0 10px; display: grid; gap: 4px; }
.checks .ok { color: var(--ok); } .checks .bad { color: var(--red); }

/* autentificare */
.pg-login { display: grid; place-items: center; min-height: 100vh; padding: 16px; }
.login { width: 100%; max-width: 380px; display: grid; gap: 12px; }
.login label { display: grid; gap: 4px; font-weight: 600; font-size: .9rem; }

/* lista de comenzi */
.toolbar { display: grid; gap: 12px; }
.tb-main { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; }
.redo { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.redo input { width: 140px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { display: inline-flex; gap: 6px; align-items: baseline; padding: 6px 12px; border-radius: 99px; background: var(--bg); color: var(--ink); text-decoration: none; font-size: .9rem; }
.chip b { font-size: 1.05rem; }
.chip.bad { background: #fef2f2; color: #991b1b; }
.info { margin: 0; font-size: .85rem; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 10px; }
.filters input[type=search] { flex: 1 1 220px; max-width: 320px; }
.tabs { display: flex; gap: 2px; flex-wrap: wrap; background: var(--bg); border-radius: 7px; padding: 3px; }
.tabs a { padding: 6px 12px; border-radius: 5px; color: var(--ink); text-decoration: none; font-size: .9rem; }
.tabs a.on { background: #fff; font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.bulk { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 8px 0 10px; border-top: 1px solid var(--line); }
.tablewrap { overflow-x: auto; }
table.grid { width: 100%; border-collapse: collapse; font-size: .9rem; }
.grid th { text-align: left; font-weight: 600; color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .3px; padding: 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.grid td { padding: 9px 8px; border-bottom: 1px solid #eef0f3; vertical-align: top; }
.grid tr.picked td { background: #f0f7ff; }
.grid tr.off td { color: var(--muted); }
.grid td.sel, .grid th.sel { width: 30px; }
.grid td.nr strong { font-size: .95rem; }
.grid td.pdf { min-width: 170px; }
.grid td.act { white-space: nowrap; text-align: right; }
.grid td.act .btn { margin-left: 4px; }
.site { color: var(--blue) !important; }
.qty { color: var(--red); }
.tag { display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 4px; font-size: .75rem; font-weight: 600; }
.tag.edit { background: #fff7e6; color: #92400e; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: .78rem; font-weight: 700; }
.s-new { background: #eef2f7; color: #374151; }
.s-queued { background: #e8f0fe; color: #1e40af; }
.s-working { background: #dbeafe; color: #1e40af; }
.s-done { background: #dcfce7; color: #166534; }
.s-error { background: #fee2e2; color: #991b1b; }
.bar { height: 6px; background: #e5e7eb; border-radius: 3px; margin: 6px 0 2px; overflow: hidden; max-width: 200px; }
.bar span { display: block; height: 100%; background: var(--blue); transition: width .4s; }
.empty { padding: 30px 0; text-align: center; }
.pager { display: flex; gap: 4px; align-items: center; margin-top: 12px; flex-wrap: wrap; }
.pager a { padding: 4px 10px; border-radius: 5px; text-decoration: none; color: var(--ink); background: var(--bg); }
.pager a.on { background: var(--blue); color: #fff; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: #111827; color: #fff; padding: 10px 18px; border-radius: 8px; max-width: min(640px, 92vw); z-index: 100; box-shadow: 0 8px 24px rgba(0,0,0,.25); }
.toast.bad { background: #991b1b; }
.pg-editor .toast { bottom: 96px; }
.spin { display: inline-block; width: 18px; height: 18px; border: 3px solid #cbd5e1; border-top-color: var(--blue); border-radius: 50%; animation: sp 0.9s linear infinite; vertical-align: middle; margin-right: 8px; }
@keyframes sp { to { transform: rotate(360deg); } }

/* editor */
.pg-editor .main { max-width: 1500px; }
.ed-head { display: flex; gap: 16px; align-items: center; margin-bottom: 12px; }
.ed-head h1 { font-size: 1.15rem; margin: 0; }
.ed-head p { margin: 2px 0 0; font-size: .88rem; }
.ed { display: grid; grid-template-columns: 200px minmax(0, 1fr) 290px; grid-template-areas: "pages mid tools" "bar bar bar"; gap: 14px; align-items: start; }
.ed-loading { grid-column: 1 / -1; padding: 40px; text-align: center; }
.ed-loading.bad { color: var(--red); }
.ed-pages { grid-area: pages; padding: 12px; position: sticky; top: 70px; }
.ed-list { display: grid; gap: 2px; max-height: 65vh; overflow-y: auto; }
.ed-pg { display: flex; justify-content: space-between; align-items: center; text-align: left; border: 0; background: transparent; padding: 7px 10px; border-radius: 6px; font: inherit; font-weight: 600; cursor: pointer; color: var(--ink); }
.ed-pg:hover { background: var(--bg); }
.ed-pg.on { background: var(--blue); color: #fff; }
.ed-pg i { width: 8px; height: 8px; border-radius: 50%; }
.ed-pg.mod i { background: #f59e0b; }
.ed-mid { grid-area: mid; }
.ed-stage { display: flex; justify-content: center; background: #e5e7eb; border-radius: var(--radius); padding: 18px; cursor: grab; touch-action: none; user-select: none; }
.ed-stage.drag { cursor: grabbing; }
.ed-sheet { position: relative; height: min(calc(100vh - 250px), 900px); min-height: 420px; max-width: 100%; background: #fff; box-shadow: 0 6px 24px rgba(0,0,0,.18); overflow: hidden; }
.ed-slot { position: absolute; overflow: hidden; background: #f3f4f6; }
.ed-photo { position: absolute; max-width: none; height: auto; user-select: none; -webkit-user-drag: none; pointer-events: none; }
.ed-tpl { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; user-select: none; }
.ed-stage.drag .ed-slot { outline: 2px solid var(--blue); outline-offset: -2px; z-index: 2; }
.ed-tools { grid-area: tools; display: grid; gap: 9px; position: sticky; top: 70px; }
.ed-tools h2 { margin: 0; }
.ed-tools .lbl { font-weight: 600; font-size: .88rem; margin-top: 4px; }
.ed-zoom { display: flex; gap: 8px; align-items: center; }
.ed-zoom input { flex: 1 1 auto; padding: 0; }
.ed-swap { display: flex; gap: 8px; }
.ed-swap select { flex: 1 1 auto; }
.btn.file { position: relative; }
.btn.file.busy { opacity: .6; pointer-events: none; }
.btn.file.busy::after { content: ""; width: 14px; height: 14px; border: 2px solid #cbd5e1; border-top-color: var(--blue); border-radius: 50%; animation: sp .9s linear infinite; }
.ed-dpi { margin: 6px 0 0; font-weight: 600; font-size: .9rem; }
.ed-dpi.good { color: var(--ok); } .ed-dpi.bad { color: var(--red); }
.ed-bar { grid-area: bar; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; position: sticky; bottom: 0; z-index: 10; box-shadow: 0 -4px 14px rgba(0,0,0,.06); }

@media (max-width: 1100px) {
  .ed { grid-template-columns: 1fr; grid-template-areas: "mid" "tools" "pages" "bar"; }
  .ed-pages, .ed-tools { position: static; }
  .ed-list { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); max-height: none; }
  .ed-sheet { height: auto; width: min(100%, 560px); }
}
@media (max-width: 760px) {
  .top { flex-wrap: wrap; gap: 10px; padding: 10px 14px; }
  .main { padding: 14px; }
  .grid td.ost, .grid th:nth-child(5), .grid td.prod, .grid th:nth-child(4) { display: none; }
  .btn.huge { width: 100%; }
}
