:root{
  /* Light glass */
  --bg0: #f7f8ff;
  --bg1: #eef2ff;

  --card: rgba(255,255,255,.78);
  --card2: rgba(255,255,255,.92);

  --border: rgba(15,23,42,.10);
  --border2: rgba(15,23,42,.14);

  --text: rgba(15,23,42,.92);
  --muted: rgba(15,23,42,.62);

  --accent: rgba(99,102,241,1);
  --accentSoft: rgba(99,102,241,.12);
  --accentRing: rgba(99,102,241,.26);

  --danger: rgba(239,68,68,1);
  --dangerSoft: rgba(239,68,68,.10);
  --dangerRing: rgba(239,68,68,.20);

  --tableBorder: rgba(15,23,42,.08);

  --radius: 18px;
  --shadow: 0 18px 60px rgba(15,23,42,.10);
  --shadow2: 0 10px 24px rgba(15,23,42,.10);

  --blur: blur(12px);
}

*{ box-sizing:border-box; }
html, body{ height:100%; }

body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(1000px 520px at 12% -10%, rgba(99,102,241,.18), transparent 60%),
    radial-gradient(900px 520px at 92% 0%, rgba(245,158,11,.12), transparent 55%),
    linear-gradient(180deg, var(--bg1), var(--bg0));
  padding: 18px;
}

body, button, input, select, textarea{
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a{ color: rgba(67,56,202,.92); text-decoration:none; }
a:hover{ text-decoration: underline; }

.muted{ color: var(--muted); }

/* Fullscreen container */
.container{
  width: 100%;
  max-width: none;
  margin: 0;
}

/* headings */
h1{ margin:0; font-size: 20px; letter-spacing: .2px; }
h2{ margin: 18px 0 10px; font-size: 15px; letter-spacing: .2px; }
h3{ margin: 16px 0 10px; font-size: 14px; letter-spacing: .2px; }
.sub{ margin-top: 4px; color: var(--muted); font-size: 13px; }

/* ===== Header (glass) ===== */
header{
  display:flex;
  justify-content:space-between;
  align-items:flex-end;
  gap:14px;
  flex-wrap:wrap;

  padding: 14px;
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255,255,255,.92), rgba(255,255,255,.70));
  border: 1px solid var(--border);
  box-shadow: var(--shadow2);
  backdrop-filter: var(--blur);
}

.logo{
  width:44px; height:44px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(99,102,241,.92), rgba(245,158,11,.85));
  box-shadow: 0 14px 26px rgba(15,23,42,.18);
}

/* ===== Controls ===== */
.controls{
  margin: 14px 0 16px;
  display:flex;
  gap:10px;
  align-items:center;
  flex-wrap:wrap;

  padding: 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: rgba(255,255,255,.74);
  box-shadow: 0 10px 22px rgba(15,23,42,.06);
  backdrop-filter: var(--blur);
}

label{
  display:flex;
  align-items:center;
  gap:8px;
  color: var(--muted);
  font-size: 13px;
}

/* ===== Inputs + buttons ===== */
select, button,
input[type="text"], input[type="number"], input[type="password"], input[type="color"]{
  appearance:none;
  border-radius: 14px;
  border: 1px solid rgba(15,23,42,.14);
  background: rgba(255,255,255,.95);
  color: var(--text);
  padding: 8px 12px;
  font-size: 13px;
  outline: none;
  box-shadow: 0 1px 0 rgba(15,23,42,.03);
}

select:focus, button:focus,
input[type="text"]:focus, input[type="number"]:focus, input[type="password"]:focus, input[type="color"]:focus{
  box-shadow: 0 0 0 4px var(--accentRing);
  border-color: rgba(99,102,241,.45);
}

button{
  cursor:pointer;
  transition: transform .06s ease, background .14s ease, border-color .14s ease, box-shadow .14s ease;
  font-weight: 900;
}

button:hover{
  background: var(--accentSoft);
  border-color: rgba(99,102,241,.22);
  box-shadow: 0 10px 20px rgba(99,102,241,.10);
}
button:active{ transform: translateY(1px); }

button.danger{
  border-color: rgba(239,68,68,.22);
  background: rgba(255,255,255,.95);
  color: rgba(185,28,28,.92);
}
button.danger:hover{
  background: var(--dangerSoft);
  border-color: rgba(239,68,68,.30);
  box-shadow: 0 10px 20px rgba(239,68,68,.10);
}

/* ===== Status blocks ===== */
.loading, .error{
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: rgba(255,255,255,.76);
  box-shadow: 0 10px 22px rgba(15,23,42,.06);
  backdrop-filter: var(--blur);
}
.error{
  border-color: rgba(239,68,68,.22);
  background: rgba(239,68,68,.10);
}

/* ===== Card (Admin sections) ===== */
.card{
  border: 1px solid var(--border);
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow2);
  padding: 14px;
  backdrop-filter: var(--blur);
}

.list{ margin: 10px 0 0; padding-left: 18px; }

/* ===== Scroll wrappers ===== */
.wrap,
.table-wrap{
  overflow: auto;
  max-width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: rgba(255,255,255,.78);
  box-shadow: var(--shadow);
  backdrop-filter: var(--blur);
}

/* ===== Base table ===== */
table{
  border-collapse: separate;
  border-spacing: 0;
}

/* Plan/Manager tables: wider than viewport => sideways scroll */
.wrap table,
#planTable,
#grid{
  width: max-content;
  min-width: 100%;
}

/* dôležité: fixný layout => nič sa nerozširuje po zmene obsahu */
#planTable,
#grid{
  table-layout: fixed !important;
}

th, td{
  padding: 8px 10px;
  border-right: 1px solid var(--tableBorder);
  border-bottom: 1px solid var(--tableBorder);
  font-size: 13px;
  vertical-align: middle;
}

/* Sticky header (plan + manager) */
.wrap thead th,
#planTable thead th,
#grid thead th{
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(248,250,252,.90);
  backdrop-filter: var(--blur);
  font-weight: 900;
  color: rgba(15,23,42,.74);
}

/* Sticky first column (names) */
.wrap th:first-child, .wrap td:first-child,
#planTable th:first-child, #planTable td:first-child,
#grid th:first-child, #grid td:first-child{
  position: sticky;
  left: 0;
  z-index: 20;
  background: rgba(255,255,255,.95);
  backdrop-filter: blur(10px);
  box-shadow: 10px 0 18px rgba(15,23,42,.06);
}

/* Top-left cell above everything */
.wrap thead th:first-child,
#planTable thead th:first-child,
#grid thead th:first-child{
  z-index: 50;
}

/* Location group row */
tr.location-row td{
  background: rgba(99,102,241,.07);
  color: rgba(15,23,42,.82);
  font-weight: 900;
  text-align: center;          /* centrovanie názvu prevádzky */
  vertical-align: middle;
}

/* Basic cells */
.emp{ font-weight: 900; }

/* Weekend */
.weekend{ background: rgba(245,158,11,.10); }
.weekend:hover{ background: rgba(245, 11, 11, 0.1); }

/* ====== COMPACT GRID SETTINGS (VIAC DNI) ====== */

/* užšie dni + menšie paddingy v plan/manager */
.dayhead{
  width: 50px;
  min-width: 50px;
  max-width: 50px;
  text-align: center;
  padding: 6px 6px;
  white-space: nowrap;
}

th.dayhead.weekend{
  background-color: rgba(245, 11, 151, 0.1) !important;
}

#planTable th, #planTable td,
#grid th, #grid td{
  padding: 6px 6px;
}

/* vyššia fixná výška = nič neskáče */
#planTable td,
#grid td{
  height: 50px;
  min-height: 50px;
  vertical-align: middle;
  text-align: center;
}

/* aby sa deň-stĺpce nikdy nerozťahovali */
#planTable tbody td:not(:first-child),
#grid tbody td:not(:first-child){
  width: 38px;
  max-width: 38px;
}

/* ===== SUMÁRNE STĹPCE (užšie + 2 riadky názov) ===== */
.sumhead{
  min-width: 64px;
  width: 64px;
  max-width: 64px;
  text-align: center;     /* centrovanie hlavičky */
  white-space: normal;
  line-height: 1.1;
  font-size: 11px;
  padding: 6px 6px;
}

.sum-title{
  display: block;
  text-align: center;
  word-break: break-word;
}

.sumcell{
  min-width: 64px;
  width: 64px;
  max-width: 64px;
  text-align: right;      /* hodnoty nechávam vpravo, ak chceš centrovať, zmeň na center */
  font-variant-numeric: tabular-nums;
  color: rgba(15,23,42,.86);
  font-size: 12px;
  padding: 6px 6px;
}

/* ===== SHIFTBOX ===== */

/* default (používa sa aj v admin/legend), nechávame ako "pill" */
.shiftbox{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-width: 36px;
  height: 28px;
  padding: 0 8px;
  border-radius: 999px;
  font-weight: 900;
  font-size: 12px;
  letter-spacing: .2px;
  box-shadow: inset 0 0 0 1px rgba(15,23,42,.10), 0 8px 16px rgba(15,23,42,.10);
  gap: 6px;
}

/* ALE v kalendári (plan + manager) ho zmenšíme a dáme na 2 riadky */
#planTable .shiftbox,
#grid .shiftbox{
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;

  width: 34px;
  height: 34px;
  min-width: 34px;
  max-width: 34px;
  padding: 4px 0;

  border-radius: 12px;
  font-weight: 900;
  font-size: 12px;
  line-height: 1;

  box-sizing: border-box;
  overflow: hidden;
}

#planTable .shiftbox .shift-code,
#grid .shiftbox .shift-code{
  display:block;
  font-size: 12px;
  line-height: 1;
}

#planTable .shiftbox .shift-hrs,
#grid .shiftbox .shift-hrs{
  display:block;
  font-size: 11px;
  line-height: 1;
  opacity: .9;
  font-weight: 800;
}

/* Editable cells (Manager) */
.cell{
  text-align:center;
  cursor:pointer;
  user-select:none;
}
.cell:hover{
  outline: 2px solid rgba(99,102,241,.28);
  outline-offset: -2px;
  border-radius: 10px;
}
.cell.weekend:hover{
  box-shadow: inset 0 0 0 999px rgba(245,158,11,.06);
}

/* ===== Modal ===== */
.backdrop{
  position:fixed;
  inset:0;
  background: rgba(15,23,42,.36);
  display:none;
  align-items:center;
  justify-content:center;
  padding: 16px;
}

.modal{
  width: min(640px, 100%);
  background: rgba(255,255,255,.94);
  color: var(--text);
  border-radius: 22px;
  border: 1px solid rgba(15,23,42,.12);
  box-shadow: 0 36px 90px rgba(15,23,42,.22);
  backdrop-filter: var(--blur);
}

.modal header{
  padding: 12px 14px;
  border-bottom: 1px solid rgba(15,23,42,.08);
  background: transparent;
  box-shadow: none;
  border-radius: 22px 22px 0 0;
}

.modal h2{ font-size: 15px; margin:0; color: rgba(15,23,42,.92); }
.modal .body{ padding: 12px 14px; }

.grid{ display:flex; flex-wrap:wrap; gap:10px; }

.pick{
  width: calc(50% - 5px);
  border-radius: 16px;
  padding: 10px 12px;
  border: 1px solid rgba(15,23,42,.10);
  background: rgba(255,255,255,.92);
  display:flex;
  align-items:center;
  gap:10px;
  text-align:left;
  transition: background .14s ease, border-color .14s ease, box-shadow .14s ease, transform .06s ease;
}
.pick:hover{
  border-color: rgba(99,102,241,.22);
  background: rgba(99,102,241,.06);
  box-shadow: 0 12px 24px rgba(99,102,241,.10);
}
.pick:active{ transform: translateY(1px); }

.btnrow{
  display:flex;
  gap:10px;
  justify-content:flex-end;
  padding: 12px 14px;
  border-top: 1px solid rgba(15,23,42,.08);
}

/* ===== Legend ===== */
.legend{
  margin-top: 14px;
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  align-items:center;
}
.legend-title{ font-weight: 900; color: rgba(15,23,42,.84); }

.legend-pill{
  display:inline-flex;
  gap:10px;
  align-items:center;
  padding: 8px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,.86);
  border: 1px solid rgba(15,23,42,.10);
  box-shadow: 0 10px 20px rgba(15,23,42,.06);
}

/* legenda nech ostane "pill" */
.legend-pill .shiftbox{
  min-width: 36px;
  width: auto;
  height: 28px;
  padding: 0 8px;
  flex-direction: row;
  border-radius: 999px;
  gap: 6px;
}

/* ===== Inline forms ===== */
.form-inline{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  align-items:flex-end;
}
.form-inline label{
  display:flex;
  flex-direction:column;
  gap:6px;
  color: var(--muted);
  font-size: 12px;
}
.form-inline input,
.form-inline select{
  min-height: 36px;
  border-radius: 14px;
  border: 1px solid rgba(15,23,42,.14);
  background: rgba(255,255,255,.95);
  color: var(--text);
  padding: 8px 10px;
  font-size: 13px;
  outline:none;
}
.form-inline input:focus,
.form-inline select:focus{
  box-shadow: 0 0 0 4px var(--accentRing);
  border-color: rgba(99,102,241,.45);
}
.form-inline .w80{ width:80px; }
.form-inline .w90{ width:90px; }
.form-inline .w140{ width:140px; }
.form-inline .w200{ width:200px; }
.form-inline .w220{ width:220px; }

.form-inline.compact{
  gap:8px;
  align-items:flex-end;
}
.form-inline.compact label{ font-size: 11px; }
.form-inline.compact select,
.form-inline.compact input{
  min-height: 34px;
  padding: 7px 9px;
  font-size: 12px;
}

/* checkboxes */
input[type="checkbox"]{
  width: 18px;
  height: 18px;
  accent-color: rgb(99 102 241);
  cursor: pointer;
}
td input[type="checkbox"]{ transform: translateY(2px); }

/* preview pill */
.preview-pill{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding: 6px 10px;
  border-radius: 999px;
  font-weight: 900;
  font-size: 12px;
  box-shadow: inset 0 0 0 1px rgba(15,23,42,.10), 0 8px 16px rgba(15,23,42,.10);
}

/* row actions (admin) */
.row-actions{
  display:flex;
  flex-wrap:wrap;
  gap: 10px;
  align-items:flex-end;
}

/* code blocks */
pre{
  margin: 10px 0 0;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(15,23,42,.10);
  background: rgba(15,23,42,.04);
  color: rgba(15,23,42,.88);
  overflow:auto;
  font-size: 12px;
  line-height: 1.35;
}

hr{
  border:0;
  height:1px;
  background: rgba(15,23,42,.10);
  margin: 14px 0;
}

/* small screens */
@media (max-width: 700px){
  body{ padding: 12px; }
  .pick{ width: 100%; }
}

.wrap.is-dragging{
  cursor: grabbing !important;
  user-select: none;
}

/* ===== 1. stĺpec: FIX 240px + 2 riadky cez wrapper ===== */
#grid th:first-child,
#grid td:first-child,
#planTable th:first-child,
#planTable td:first-child{
  width: 180px !important;
  min-width: 180px !important;
  max-width: 180px !important;
}

/* hlavička prvého stĺpca nech je center */
#grid thead th:first-child,
#planTable thead th:first-child{
  text-align: center;
}

/* prvý stĺpec (bunky) */
#grid td:first-child,
#planTable td:first-child{
  text-align: left;
  padding-left: 10px;
  white-space: normal !important;
  vertical-align: middle;
}

/* 2 riadky textu (bez webkit clamp) – wrapper vo vnútri bunky */
.emp .emp-name,
.location-sticky .loc-name{
  display: block;
  line-height: 1.15;
  max-height: calc(1.15em * 2);
  overflow: hidden;
}

.loc-name{
  text-transform: uppercase;
}

/* ===== ikony / malé tlačidlá ===== */
.icon-btn{
  width: 30px;
  height: 30px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid rgba(15,23,42,.14);
  background: rgba(255,255,255,.92);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex: 0 0 auto;
}

.icon-btn:hover{
  background: rgba(99,102,241,.10);
  border-color: rgba(99,102,241,.22);
}

.icon-btn.danger{
  border-color: rgba(239,68,68,.25);
  color: rgba(185,28,28,.92);
}
.icon-btn.danger:hover{
  background: rgba(239,68,68,.10);
  border-color: rgba(239,68,68,.35);
}

.icon-btn svg{
  width: 16px;
  height: 16px;
  display:block;
}

.head-actions{
  display:flex;
  gap:8px;
  align-items:center;
  margin-left:auto;
}

.mini-btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(15,23,42,.14);
  background: rgba(255,255,255,.92);
  color: rgba(15,23,42,.86);
  font-weight: 900;
  font-size: 12px;
  text-decoration: none;
  box-shadow: 0 8px 16px rgba(15,23,42,.06);
}

.mini-btn:hover{
  background: rgba(99,102,241,.10);
  border-color: rgba(99,102,241,.22);
  text-decoration: none;
}