/* ============================================================
   Restaurantio — dopuna stila (nadogradnja 2026.08.11)
   Prečice, widgeti, karton zaposlenog, obračun zarada.
   Drži se odvojeno od style.css da se osnovni stil ne dira.
   ============================================================ */

/* ------------------------------------------------------------
   Zvezdica u zaglavlju
   ------------------------------------------------------------ */
.star-form { display: inline-flex; }
.star-btn {
    background: transparent; border: 1px solid var(--border); border-radius: var(--radius-sm);
    color: var(--muted-2); font-size: 17px; line-height: 1; cursor: pointer;
    width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center;
    transition: color .15s, background .15s, border-color .15s;
}
.star-btn:hover { color: #f59e0b; background: var(--warning-bg); border-color: #fcd34d; }
.star-btn.is-marked { color: #f59e0b; border-color: #fcd34d; background: var(--warning-bg); }
.star-btn:disabled { opacity: .5; cursor: default; }

.star-toast {
    position: fixed; right: 18px; bottom: 18px; z-index: 9999;
    background: var(--text); color: #fff; font-size: 13px; font-weight: 500;
    padding: 10px 15px; border-radius: var(--radius); box-shadow: var(--shadow-md);
    max-width: 340px; opacity: 1; transform: translateY(0); transition: opacity .3s, transform .3s;
}
.star-toast.star-toast-err { background: var(--danger); }
.star-toast.out { opacity: 0; transform: translateY(8px); }

/* ------------------------------------------------------------
   Rešetka prečica — radna površina

   Ćelija je fiksne veličine, kao ikonica na radnoj površini, pa je
   broj kolona uvek celobrojan i mesto na koje je ikonica spuštena
   ostaje isto kad se stranica ponovo otvori. Prečice sa upisanim
   koordinatama dobijaju `grid-column`/`grid-row`; one bez njih
   `grid-auto-flow: dense` sam ubaci u prva slobodna polja.
   ------------------------------------------------------------ */
.desk-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, var(--desk-cell, 132px));
    grid-auto-rows: var(--desk-cell-h, 112px);
    grid-auto-flow: row dense;
    gap: var(--desk-gap, 12px);
    margin-bottom: 8px;
    position: relative;
    align-content: start;
}
.desk-item { position: relative; }
.desk-tile {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 9px;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 14px 8px; height: 100%; text-align: center; color: var(--text);
    text-decoration: none; box-shadow: var(--shadow);
    transition: transform .12s, box-shadow .12s, border-color .12s;
    overflow: hidden;
}
.desk-tile:hover {
    text-decoration: none; transform: translateY(-2px);
    box-shadow: var(--shadow-md); border-color: var(--primary);
}
.desk-icon { font-size: 27px; line-height: 1; }
.desk-label {
    font-size: 12.5px; font-weight: 600; line-height: 1.3; word-break: break-word;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

/* --- Prevlačenje --- */
.desk-grid.dragging .desk-tile:hover { transform: none; box-shadow: var(--shadow); border-color: var(--border); }
.desk-item.is-drag { opacity: .3; pointer-events: none; }
.desk-item.is-drag .desk-tile { border-style: dashed; }

/* Ikonica koja putuje uz pokazivač */
.desk-fly {
    position: fixed; z-index: 900; pointer-events: none; margin: 0;
    width: var(--desk-cell, 132px); height: var(--desk-cell-h, 112px);
    opacity: .93; transform: scale(1.04); transform-origin: center;
}
.desk-fly .desk-tile {
    box-shadow: var(--shadow-lg, 0 10px 30px rgba(0,0,0,.28));
    border-color: var(--primary);
}

/* Mesto na koje će ikonica pasti */
.desk-slot {
    border: 2px dashed var(--primary); border-radius: var(--radius);
    background: var(--primary-bg); opacity: .75; pointer-events: none;
}
/* Kad je to mesto zauzeto, dve ikonice menjaju mesta — i to se vidi */
.desk-item.is-swap .desk-tile { border-color: var(--primary); border-style: dashed; }

.desk-hint {
    font-size: 12.5px; color: var(--muted); margin: -4px 0 12px;
    display: flex; align-items: center; gap: 7px; flex-wrap: wrap;
}

.desk-tools, .wdg-tools {
    position: absolute; top: 5px; right: 5px; display: flex; gap: 2px;
    opacity: 0; transition: opacity .12s;
}
.desk-item:hover .desk-tools, .wdg:hover .wdg-tools { opacity: 1; }
.desk-grid.dragging .desk-tools { opacity: 0 !important; }
.desk-btn, .wdg-btn {
    width: 20px; height: 20px; border: 1px solid var(--border); border-radius: 4px;
    background: var(--surface); color: var(--muted); font-size: 12px; line-height: 1;
    cursor: pointer; padding: 0; display: inline-flex; align-items: center; justify-content: center;
}
.desk-btn:hover, .wdg-btn:hover { background: var(--surface-hover); color: var(--text); }
.desk-btn:disabled, .wdg-btn:disabled { opacity: .3; cursor: default; }
.desk-btn-x:hover, .wdg-btn-x:hover { background: var(--danger-bg); color: var(--danger); border-color: var(--danger); }
.desk-tools form, .wdg-tools form { display: inline-flex; gap: 2px; }

@media (max-width: 560px) {
    .desk-grid { --desk-cell: 104px; --desk-cell-h: 100px; --desk-gap: 9px; }
    .desk-icon { font-size: 23px; }
    .desk-label { font-size: 11.5px; }
}

/* ------------------------------------------------------------
   Widgeti
   ------------------------------------------------------------ */
.wdg-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(196px, 1fr));
    gap: 14px; margin-bottom: 8px;
}
.wdg {
    position: relative; background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 16px 16px 14px; box-shadow: var(--shadow);
    border-left: 3px solid var(--wdg-fg, var(--primary));
    transition: box-shadow .12s, transform .12s;
}
.wdg:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.wdg-wide { grid-column: span 2; }
.wdg-link { display: block; color: inherit; text-decoration: none; }
.wdg-link:hover { text-decoration: none; }
.wdg-icon {
    width: 34px; height: 34px; border-radius: 9px; background: var(--wdg-bg, var(--primary-bg));
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 17px; margin-bottom: 9px;
}
.wdg-title { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.wdg-value { font-size: 23px; font-weight: 700; color: var(--wdg-fg, var(--text)); margin-top: 4px; letter-spacing: -.02em; }
.wdg-sub   { font-size: 11px; color: var(--muted-2); margin-top: 3px; }
.wdg-note  { font-size: 13px; color: var(--text); margin-top: 6px; line-height: 1.5; white-space: pre-wrap; }

/* ------------------------------------------------------------
   Izbor stranica u prozoru
   ------------------------------------------------------------ */
.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); gap: 5px; }
.pick-item {
    display: flex; align-items: center; gap: 8px; padding: 7px 9px;
    border-radius: var(--radius-sm); border: 1px solid transparent; font-size: 13px; cursor: pointer;
}
.pick-item:hover { background: var(--surface-hover); border-color: var(--border); }
.pick-item input { margin: 0; flex: 0 0 auto; }
.pick-icon { font-size: 15px; flex: 0 0 auto; }

/* ------------------------------------------------------------
   Obrazac widgeta
   ------------------------------------------------------------ */
.w-input {
    width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm);
    font-size: 13px; font-family: inherit; background: var(--surface); color: var(--text);
}
.w-types { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.w-type { display: block; cursor: pointer; position: relative; }
.w-type input { position: absolute; opacity: 0; pointer-events: none; }
.w-type span {
    display: block; padding: 10px; border: 1px solid var(--border);
    border-radius: var(--radius-sm); text-align: center; font-size: 12.5px; line-height: 1.4;
}
.w-type span small { display: block; color: var(--muted); font-size: 11px; margin-top: 2px; }
.w-type input:checked + span { border-color: var(--primary); background: var(--primary-bg); }

.w-colors { display: flex; gap: 8px; flex-wrap: wrap; }
.w-color { cursor: pointer; position: relative; display: inline-block; }
.w-color input { position: absolute; opacity: 0; pointer-events: none; }
.w-color > span {
    width: 30px; height: 30px; border-radius: 8px; border: 2px solid transparent;
    display: inline-flex; align-items: center; justify-content: center;
}
.w-color > span > span { width: 13px; height: 13px; border-radius: 50%; }
.w-color input:checked + span { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--text); }

/* ------------------------------------------------------------
   Karton zaposlenog
   ------------------------------------------------------------ */
.entity-head {
    display: flex; gap: 18px; align-items: flex-start; background: var(--surface);
    border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px;
    box-shadow: var(--shadow); margin-bottom: 18px; flex-wrap: wrap;
}
.entity-photo {
    width: 76px; height: 76px; border-radius: 14px; flex: 0 0 auto; overflow: hidden;
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 26px; font-weight: 700;
}
.entity-photo img { width: 100%; height: 100%; object-fit: cover; }
.entity-main { flex: 1 1 260px; min-width: 0; }
.entity-main h1 { margin: 2px 0 6px; font-size: 22px; }
.entity-meta { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12.5px; color: var(--muted); }
.entity-side { display: flex; flex-direction: column; gap: 7px; align-items: flex-end; }
.crumb { font-size: 12px; color: var(--muted); }
.crumb a { color: var(--muted); }

.card-tabs { display: flex; gap: 3px; border-bottom: 1px solid var(--border); margin-bottom: 16px; flex-wrap: wrap; }
.card-tab {
    background: none; border: none; border-bottom: 2px solid transparent; cursor: pointer;
    padding: 9px 14px; font-size: 13px; font-weight: 600; color: var(--muted); font-family: inherit;
}
.card-tab:hover { color: var(--text); }
.card-tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.card-tab .cnt {
    display: inline-block; margin-left: 5px; background: var(--bg); border: 1px solid var(--border);
    border-radius: 9px; padding: 0 6px; font-size: 10.5px; font-weight: 700; color: var(--muted);
}
.tab-pane { display: none; }
.tab-pane.active { display: block; }

.def-list { display: grid; grid-template-columns: minmax(120px, 38%) 1fr; gap: 7px 14px; margin: 0; font-size: 13px; }
.def-list dt { color: var(--muted); font-size: 12px; }
.def-list dd { margin: 0; font-weight: 500; word-break: break-word; }
.sensitive-hidden { font-family: monospace; letter-spacing: .12em; color: var(--muted-2); }

/* ------------------------------------------------------------
   Obračun zarada
   ------------------------------------------------------------ */
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

.slip { max-width: 840px; margin: 0 auto; }
.slip table { width: 100%; border-collapse: collapse; font-size: 13px; }
.slip th, .slip td { padding: 6px 9px; border-bottom: 1px solid var(--border); text-align: left; }
.slip td.num, .slip th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.slip tr.sum td { font-weight: 700; background: var(--bg); border-top: 2px solid var(--border); }
.slip h4 { margin: 18px 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }

.pr-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.pr-table th {
    padding: 9px 10px; font-size: 11px; text-transform: uppercase; letter-spacing: .05em;
    font-weight: 700; color: var(--muted); background: var(--bg); text-align: left;
    border-bottom: 1px solid var(--border); white-space: nowrap;
}
.pr-table td { padding: 9px 10px; border-bottom: 1px solid var(--border); }
.pr-table tbody tr:hover { background: var(--bg); }
.pr-table tfoot td { font-weight: 700; background: var(--bg); border-top: 2px solid var(--border); }

/* ------------------------------------------------------------
   Štampa
   ------------------------------------------------------------ */
@media print {
    .sidebar, .topbar, .page-actions, .no-print, .flash { display: none !important; }
    .app { display: block; }
    .main { display: block; }
    .content { padding: 0; }
    .card { box-shadow: none; border: none; }
}

/* ------------------------------------------------------------
   Uski ekrani
   ------------------------------------------------------------ */
@media (max-width: 720px) {
    .wdg-wide { grid-column: span 1; }
    .w-types { grid-template-columns: 1fr; }
    .def-list { grid-template-columns: 1fr; gap: 2px 0; }
    .def-list dd { margin-bottom: 8px; }
    .entity-side { align-items: flex-start; flex-direction: row; flex-wrap: wrap; }
}

/* ------------------------------------------------------------
   Upozorenje da sesija ističe
   ------------------------------------------------------------ */
.ses-warn {
    position: fixed; right: 18px; bottom: 18px; z-index: 1200;
    width: min(360px, calc(100vw - 36px));
    background: var(--surface); color: var(--text);
    border: 1px solid var(--border); border-left: 3px solid var(--warning);
    border-radius: var(--radius); box-shadow: 0 10px 30px rgba(0, 0, 0, .18);
    padding: 14px 16px;
    animation: ses-in .22s ease-out;
}
@keyframes ses-in { from { opacity: 0; transform: translateY(10px); } }

.ses-warn h4 { margin: 0 0 4px; font-size: 14px; display: flex; gap: 7px; align-items: center; }
.ses-warn p  { margin: 0; font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.ses-warn .ses-num { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--text); }
.ses-warn .ses-acts { display: flex; gap: 8px; margin-top: 12px; }
.ses-warn .ses-acts .btn { flex: 1; }

/* Traka pokazuje koliko je od upozorenja do isteka ostalo */
.ses-bar { height: 4px; border-radius: 99px; background: var(--surface-2); margin-top: 11px; overflow: hidden; }
.ses-bar i { display: block; height: 100%; width: 100%; background: var(--warning); border-radius: 99px; }
.ses-warn.ses-hot { border-left-color: var(--danger); }
.ses-warn.ses-hot .ses-bar i { background: var(--danger); }

@media (prefers-reduced-motion: reduce) {
    .ses-warn { animation: none; }
    .ses-bar i { transition: none; }
}
@media (max-width: 560px) {
    .ses-warn { right: 10px; left: 10px; bottom: 10px; width: auto; }
}

/* ------------------------------------------------------------
   Poslovi u pozadini — dugme u gornjoj traci, spisak, obaveštenja
   Dugme se vidi samo dok korisnik ima posao u toku ili skoro
   završen; broj na njemu je koliko ih još radi.
   ------------------------------------------------------------ */
.jobs-dock { position: relative; display: inline-flex; }
.jobs-dock[hidden] { display: none; }
.jobs-btn { position: relative; }
.jobs-btn.is-active { color: var(--primary); border-color: var(--primary); }
.jobs-btn.is-active svg { animation: jobs-spin 2.4s linear infinite; }
@keyframes jobs-spin { to { transform: rotate(360deg); } }
.jobs-count {
    position: absolute; top: -6px; right: -6px; min-width: 17px; height: 17px; padding: 0 4px;
    border-radius: 99px; background: var(--primary); color: var(--on-primary, #fff);
    font-size: 10.5px; font-weight: 700; line-height: 17px; text-align: center;
    border: 2px solid var(--surface); box-sizing: content-box;
}
.jobs-count[hidden] { display: none; }

.jobs-panel {
    position: absolute; top: calc(100% + 8px); right: 0; z-index: 1100;
    width: min(380px, calc(100vw - 24px));
    background: var(--surface); color: var(--text);
    border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: 0 12px 32px rgba(0, 0, 0, .18);
}
.jobs-panel[hidden] { display: none; }
.jobs-panel-head {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 10px 14px; border-bottom: 1px solid var(--border); font-size: 13px;
}
.jobs-panel-head a { font-size: 12px; }
.jobs-list { max-height: min(420px, 60vh); overflow-y: auto; }
.jobs-row { padding: 10px 14px; border-bottom: 1px solid var(--border); font-size: 12.5px; }
.jobs-row:last-child { border-bottom: none; }
.jobs-row-title { font-weight: 600; font-size: 13px; line-height: 1.35; }
.jobs-row-text { color: var(--muted); margin-top: 2px; line-height: 1.45; overflow-wrap: anywhere; }
.jobs-failed .jobs-row-text { color: var(--danger); }
.jobs-done .jobs-row-title::before { content: "✓ "; color: var(--success); }
.jobs-row-acts { display: flex; gap: 12px; align-items: center; margin-top: 6px; font-size: 12px; }
.jobs-row-acts button {
    background: none; border: none; padding: 0; cursor: pointer; font: inherit; color: var(--muted);
}
.jobs-row-acts button:hover { color: var(--text); text-decoration: underline; }
.jobs-row-acts .jobs-stop { color: var(--danger); margin-left: auto; }
.jobs-bar { height: 6px; margin-top: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.jobs-bar i { display: block; height: 100%; background: var(--muted-2, var(--muted)); border-radius: 99px; transition: width .4s; }
.jobs-bar.is-running i { background: var(--primary); }
.jobs-panel-foot { padding: 8px 14px; border-top: 1px solid var(--border); font-size: 11.5px; color: var(--muted); }
.jobs-panel-foot[hidden] { display: none; }

.jobs-toasts {
    position: fixed; top: 64px; right: 18px; z-index: 1300;   /* top zadaje skripta — ispod gornje trake */
    display: flex; flex-direction: column; gap: 8px;
    width: min(360px, calc(100vw - 36px));
}
.jobs-toast {
    background: var(--surface); color: var(--text);
    border: 1px solid var(--border); border-left: 3px solid var(--success);
    border-radius: var(--radius); box-shadow: 0 10px 30px rgba(0, 0, 0, .18);
    padding: 10px 14px; font-size: 12.5px;
    animation: ses-in .22s ease-out; transition: opacity .4s;
}
.jobs-toast-err  { border-left-color: var(--danger); }
.jobs-toast-warn { border-left-color: var(--warning); }
.jobs-toast.out  { opacity: 0; }
.jobs-toast-title { font-weight: 600; font-size: 13px; }
.jobs-toast-text { color: var(--muted); margin-top: 3px; line-height: 1.45; overflow-wrap: anywhere;
                   max-height: 6.2em; overflow: hidden; }
.jobs-toast-acts { display: flex; gap: 14px; justify-content: flex-end; margin-top: 8px; font-size: 12px; }
.jobs-toast-acts button { background: none; border: none; padding: 0; cursor: pointer; font: inherit; color: var(--muted); }

@media (prefers-reduced-motion: reduce) {
    .jobs-btn.is-active svg, .jobs-toast { animation: none; }
    .jobs-bar i { transition: none; }
}
@media (max-width: 560px) {
    .jobs-panel { position: fixed; top: 56px; left: 12px; right: 12px; width: auto; }
    .jobs-toasts { right: 10px; left: 10px; width: auto; }
}
