:root {
  --bg:       #0d1117;
  --bg2:      #161b22;
  --bg3:      #1c2128;
  --card:     #1c2128;
  --bg4:      #21262d;
  --bg5:      #30363d;
  --border:   #30363d;
  --border2:  #21262d;
  --accent:   #4fc3f7;
  --accent2:  #0288d1;
  --text:     #e6edf3;
  --text2:    #8b949e;
  --text3:    #656d76;
  --green:    #3fb950;
  --cyan:     #4fc3f7;
  --amber:    #d29922;
  --orange:   #f59e0b;
  --amber-bg: rgba(210,153,34,0.1);
  --amber-border: rgba(210,153,34,0.22);
  --red:      #f85149;
  --red-bg:   rgba(248,81,73,0.1);
  --red-border: rgba(248,81,73,0.25);
  --purple:   #9b7fe8;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

/* ── FM-MODEL: iOS-safe layout (no height on html, no flex on #app) ── */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; touch-action: manipulation; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.4;
  min-height: 100vh;
  min-height: -webkit-fill-available;
  overflow-x: hidden;
  overscroll-behavior: none;
}

#app {
  max-width: 600px;
  margin: 0 auto;
  position: relative;
  overflow-x: hidden;
  width: 100%;
}

/* ── HEADER ── */
.app-header {
  position: fixed; top: 0; left: 0; right: 0;
  max-width: 600px; margin: 0 auto;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  padding: 10px 14px 11px;
  padding-top: calc(10px + env(safe-area-inset-top, 0px));
  display: flex; align-items: center; gap: 10px;
  z-index: 100;
}
.app-logo {
  width: 32px; height: 32px;
  background: none;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.app-logo img { width: 32px; height: 32px; object-fit: contain; border-radius: 0; background: none; }
.header-title { flex: 1; font-size: 15px; font-weight: 500; color: var(--text); }
.header-role {
  background: rgba(79,195,247,0.1); border: 1px solid var(--accent);
  border-radius: 10px; padding: 2px 9px;
  color: var(--text2); font-size: 11px;
}
.hdr-right { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex-shrink: 0; }
.header-pts { display: flex; align-items: center; gap: 5px; }
.header-pts .hp-item { display: flex; align-items: center; gap: 2px; font-size: 12px; font-weight: 500; }
.header-pts .hp-dot { width: 5px; height: 5px; border-radius: 50%; flex-shrink: 0; }
.header-pts .hp-sep { width: 1px; height: 10px; background: var(--border); }
.header-pts .hp-bal { font-size: 13px; font-weight: 500; }
.sidebar-user-pts { display: flex; align-items: center; gap: 5px; margin-top: 3px; }
.profile-pts-card { flex:1; background:var(--bg2); border:1px solid var(--border); border-radius:10px; padding:10px 6px; text-align:center; }
.profile-pts-num { font-size:22px; font-weight:500; line-height:1; }
.profile-pts-lbl { font-size:10px; color:var(--text3); margin-top:4px; line-height:1.3; }
.header-btn {
  background: var(--accent); border: none; border-radius: 10px;
  padding: 4px 10px; color: var(--text); font-size: 11px; font-weight: 500;
  cursor: pointer;
}
.header-icon-btn {
  background: none; border: none; color: var(--text2);
  font-size: 20px; cursor: pointer; padding: 2px; display: flex; align-items: center;
}

/* ── MAIN CONTENT ── */
.page-content {
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding-top: calc(52px + env(safe-area-inset-top, 0px));
  padding-bottom: calc(66px + env(safe-area-inset-bottom, 0px) + 8px);
  min-height: 100vh;
}
.page-content.no-nav { padding-bottom: 0; }

/* ── BOTTOM NAV ── */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  width: 100%; max-width: 600px; margin-left: auto; margin-right: auto;
  background: var(--bg2); border-top: 1px solid var(--border);
  display: flex;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  z-index: 100;
}
.nav-btn {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 8px 4px 6px; background: none; border: none; cursor: pointer;
}
.nav-btn i { font-size: 20px; color: var(--text3); }
.nav-btn span { font-size: 10px; color: var(--text3); }
.nav-btn.active i, .nav-btn.active span { color: var(--accent2); }
.nav-badge {
  position: absolute; top: 6px; right: 50%; transform: translateX(10px);
  background: var(--red); color: #fff; font-size: 9px; font-weight: 700;
  border-radius: 8px; padding: 0 4px; min-width: 16px; text-align: center;
}

/* ── SECTION LABEL ── */
.sec-lbl {
  font-size: 10px; color: var(--text3); font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.07em;
  padding: 10px 10px 3px;
}

/* ── CARDS ── */
.card {
  margin: 3px 10px; background: var(--bg3);
  border: 1px solid var(--border); border-radius: 10px;
  cursor: pointer; transition: border-color 0.15s;
}
.card:active { background: var(--bg4); }
.card.no-hover { cursor: default; }
.card-body { padding: 10px 13px; }
.card-row { display: flex; align-items: flex-start; gap: 7px; margin-bottom: 3px; }
.card-title { font-size: 13px; font-weight: 500; color: var(--text); flex: 1; line-height: 1.35; }
.card-sub { font-size: 11px; color: var(--text3); }
.card-zone { font-size: 11px; color: var(--text3); margin-top: 2px; }

/* ── BADGES ── */
.bdg {
  font-size: 10px; padding: 1px 6px; border-radius: 6px;
  font-weight: 600; flex-shrink: 0; margin-top: 1px; white-space: nowrap;
}
.b-daily   { background:rgba(63,185,80,0.1);   color:#3fb950; border:1px solid rgba(63,185,80,0.2); }
.b-weekly  { background:rgba(79,195,247,0.08);  color:#4fc3f7; border:1px solid rgba(79,195,247,0.18); }
.b-monthly { background:rgba(155,127,232,0.1);  color:#9b7fe8; border:1px solid rgba(155,127,232,0.2); }
.b-6mo     { background:rgba(155,127,232,0.1);  color:#9b7fe8; border:1px solid rgba(155,127,232,0.2); }
.b-once    { background:rgba(210,153,34,0.12);  color:#c8901a; border:1px solid rgba(210,153,34,0.22); }
.b-pending { background:rgba(79,195,247,0.08);  color:#4fc3f7; border:1px solid rgba(79,195,247,0.18); }
.b-claimed { background:rgba(63,185,80,0.08);   color:#3fb950; border:1px solid rgba(63,185,80,0.18); }
.b-review  { background:rgba(210,153,34,0.12);  color:#c8901a; border:1px solid rgba(210,153,34,0.22); }
.b-approved{ background:rgba(63,185,80,0.1);    color:#3fb950; border:1px solid rgba(63,185,80,0.2); }
.b-returned{ background:rgba(248,81,73,0.1);    color:#f85149; border:1px solid rgba(248,81,73,0.22); }
.b-postponed{background:rgba(155,127,232,0.1);  color:#9b7fe8; border:1px solid rgba(155,127,232,0.2); }
.b-zone    { background:rgba(63,185,80,0.08);   color:#3fb950; border:1px solid rgba(63,185,80,0.18); }
.b-eq      { background:rgba(79,195,247,0.08);  color:#4fc3f7; border:1px solid rgba(79,195,247,0.18); }

/* ── SHIFT BANNER ── */
.shift-banner {
  padding: 8px 14px 4px; display: flex; align-items: center; justify-content: flex-start;
}
.shift-btn {
  flex: 0; padding: 8px 16px; border-radius: 8px; border: none;
  background: var(--accent); color: #fff;
  font-size: 13px; font-weight: 600; cursor: pointer;
  font-family: inherit; white-space: nowrap;
  transition: background 0.2s, color 0.2s;
}

/* ── ONCE BANNER ── */
.once-banner {
  margin: 5px 10px 3px; background: rgba(79,195,247,0.05);
  border: 1px solid rgba(79,195,247,0.18); border-radius: 10px; padding: 8px 12px;
}
.once-title { font-size: 10px; color: var(--accent); font-weight: 600; margin-bottom: 5px; text-transform: uppercase; letter-spacing: 0.05em; }
.once-card {
  background: rgba(79,195,247,0.04); border: 1px solid rgba(79,195,247,0.12);
  border-radius: 8px; padding: 8px 10px; margin-bottom: 4px;
}
.once-card:last-child { margin-bottom: 0; }

/* ── DETAIL HEADER ── */
.detail-header {
  background: var(--bg2); padding: 11px 14px;
  border-bottom: 1px solid var(--border);
}
.back-btn {
  display: flex; align-items: center; gap: 4px;
  font-size: 12px; color: var(--accent2); cursor: pointer;
  background: none; border: none; padding: 0; margin-bottom: 7px;
}
.detail-header h2 { font-size: 15px; font-weight: 500; color: var(--text); margin-bottom: 2px; }
.detail-meta { font-size: 11px; color: var(--text3); }

/* ── INFO ROWS ── */
.info-row { display: flex; padding: 8px 10px; border-bottom: 1px solid var(--bg3); }
.info-lbl { font-size: 12px; color: var(--text3); width: 110px; flex-shrink: 0; }
.info-val { font-size: 12px; color: var(--text); }
.info-val.accent { color: var(--accent2); }
.info-val.danger { color: var(--red); }
.info-val.muted  { color: var(--text3); font-style: italic; }

/* ── BUTTONS ── */
.btn {
  display: block; width: calc(100% - 20px); margin: 5px 10px 3px;
  padding: 11px; border-radius: 8px; font-size: 13px; font-weight: 500;
  cursor: pointer; text-align: center; border: none; font-family: inherit;
}
.btn-primary   { background: var(--accent); color: var(--text); }
.btn-secondary { background: transparent; color: var(--text2); border: 1px solid var(--border2) !important; }
.btn-danger    { background: var(--red-bg); color: var(--red); border: 1px solid var(--red-border) !important; }
.btn-warning   { background: var(--amber-bg); color: var(--amber); border: 1px solid var(--amber-border) !important; }
.btn-success   { background: var(--accent); color: #0d1117; border: 1px solid var(--accent) !important; font-weight: 600; }
.btn-sm { padding: 6px 10px; font-size: 12px; width: auto; display: inline-block; margin: 0; }

/* ── FORMS ── */
.form-group { padding: 6px 14px; }
.form-group label {
  font-size: 10px; color: var(--text3); font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.05em;
  display: block; margin-bottom: 4px;
}
.form-group label .req { color: var(--red); }
.form-control {
  width: 100%; background: var(--bg3); border: 1px solid var(--border2);
  border-radius: 7px; padding: 9px 11px; font-size: 13px; color: var(--text);
  font-family: inherit; outline: none;
  -webkit-appearance: none; appearance: none;
}
.form-control:focus { border-color: var(--accent2); }
.form-control option { background: var(--bg3); }
textarea.form-control { height: 70px; resize: none; }

/* ── DAY PICKER ── */
.day-picker { display: flex; gap: 5px; flex-wrap: wrap; padding: 2px 0 4px; }
.dp-row { display: flex; flex-direction: row; flex-wrap: wrap; gap: 6px; padding: 2px 0 4px; }
.dp-btn {
  width: 38px; height: 38px; border-radius: 8px;
  border: 1px solid var(--border2); background: var(--bg3);
  color: var(--text2); font-size: 12px; font-weight: 500; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.dp-btn.sel { background: var(--accent); border-color: var(--accent2); color: var(--text); }
.week-pos { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 6px; }
.wp-btn {
  padding: 5px 9px; border-radius: 6px; border: 1px solid var(--border2);
  background: var(--bg3); color: var(--text2); font-size: 11px; cursor: pointer;
}
.wp-btn.sel { background: var(--accent); border-color: var(--accent2); color: var(--text); }
.freq-summary { font-size: 11px; color: var(--accent2); padding: 5px 0 0; min-height: 18px; }

/* ── MEDIA UPLOAD ── */
.media-zone {
  margin: 3px 14px; border: 1px dashed var(--border2); border-radius: 8px;
  padding: 13px; display: flex; align-items: center; justify-content: center;
  gap: 8px; color: var(--text3); font-size: 12px; cursor: pointer;
}
.media-grid { display: flex; gap: 7px; flex-wrap: wrap; padding: 5px 14px; }
.media-thumb {
  width: 72px; height: 58px; background: var(--bg4); border-radius: 7px;
  border: 1px solid var(--border); display: flex; align-items: center;
  justify-content: center; position: relative; overflow: hidden;
}
.media-thumb img, .media-thumb video { width: 100%; height: 100%; object-fit: cover; border-radius: 6px; }
.media-thumb .del-media {
  position: absolute; top: 2px; right: 2px; width: 18px; height: 18px;
  background: rgba(0,0,0,0.7); border-radius: 50%; border: none; color: #fff;
  font-size: 10px; cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.media-add {
  width: 58px; height: 58px; border-radius: 7px; border: 1px dashed var(--border2);
  background: var(--bg3); display: flex; align-items: center; justify-content: center;
  cursor: pointer; flex-direction: column; gap: 2px; color: var(--text3); font-size: 10px;
}
.media-add i { font-size: 20px; }

/* ── ZONES ── */
.zone-item { margin: 3px 10px; background: var(--bg3); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.zone-header { padding: 10px 13px; display: flex; align-items: center; gap: 8px; cursor: pointer; }
.zone-header:active { background: var(--bg4); }
.zone-icon {
  width: 32px; height: 32px; background: var(--bg4); border-radius: 6px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.zone-icon i { font-size: 16px; color: var(--accent2); }
.zone-icon.eq i { color: var(--cyan); }
.zone-name { font-size: 13px; font-weight: 500; color: var(--text); flex: 1; }
.zone-detail { border-top: 1px solid var(--border); padding: 8px 13px; background: var(--bg2); }
.zd-row { display: flex; justify-content: space-between; margin-bottom: 4px; }
.zd-lbl { font-size: 11px; color: var(--text3); }
.zd-val { font-size: 11px; color: var(--text); font-weight: 500; }

/* ── TAB ROW ── */
.tab-row {
  display:flex; gap:4px; margin:8px 12px 4px;
  background:var(--bg2); border-radius:10px; padding:3px;
}
.tab-btn { flex:1; padding:8px; border-radius:8px; border:none; background:none; color:var(--text2); font-size:13px; font-weight:500; cursor:pointer; font-family:inherit; transition:background 0.2s, color 0.2s; }
.tab-btn.active { background:var(--accent); color:#fff; font-weight:600; }

/* ── CALENDAR ── */
.cal-wrap { padding: 6px 10px 0; }
.cal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 7px; }
.cal-month { font-size: 14px; font-weight: 500; color: var(--text); }
.cal-nav { background: none; border: none; color: var(--text3); font-size: 18px; cursor: pointer; padding: 4px; }
.cal-days { display: grid; grid-template-columns: repeat(7,1fr); gap: 2px; margin-bottom: 4px; }
.cal-dlbl { text-align: center; font-size: 10px; color: var(--text3); font-weight: 600; padding: 2px 0; }
.cal-cell { display:flex; flex-direction:column; align-items:center; justify-content:flex-start; min-height:44px; padding:5px 2px 4px; font-size:13px; font-weight:500; color:var(--text2); border-radius:8px; cursor:pointer; position:relative; gap:3px; }
.cal-cell:active { background: var(--bg4); }
.cal-cell.today { background: var(--accent); color: #fff; font-weight: 700; }
.cal-cell.selected { outline: 2px solid var(--accent2); }
.cal-cell.empty { color: var(--border2); pointer-events: none; }
.cal-cell::after { display:none; }
.cal-event { background: var(--bg3); border: 1px solid var(--border); border-radius: 7px; padding: 7px 10px; margin-bottom: 3px; }
.cal-event-title { font-size: 12px; color: var(--text); font-weight: 500; }
.cal-event-sub { font-size: 10px; color: var(--text3); }

/* ── USER CARDS ── */
.user-card { margin: 3px 10px; display: flex; align-items: center; gap: 10px; padding: 9px 13px; background: var(--bg3); border: 1px solid var(--border); border-radius: 10px; }
.user-card.danger { border-color: rgba(248,81,73,0.3); }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; flex-shrink: 0; }
.avatar.green { background: rgba(63,185,80,0.12); color: var(--green); }
.avatar.red   { background: var(--red-bg); color: var(--red); }
.avatar.blue  { background: rgba(79,195,247,0.1); color: var(--cyan); }
.avatar.amber { background: var(--amber-bg); color: var(--amber); }
.user-info { flex: 1; }
.user-name { font-size: 13px; font-weight: 500; color: var(--text); }
.user-role { font-size: 11px; color: var(--text3); }
.user-points { text-align: center; min-width: 44px; }
.points-num { font-size: 16px; font-weight: 600; }
.points-lbl { font-size: 10px; color: var(--text3); }
.warn-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--red); flex-shrink: 0; }

/* ── POSTPONE BOX ── */
.postpone-box { margin: 5px 10px; background: var(--amber-bg); border: 1px solid var(--amber-border); border-radius: 10px; padding: 10px 12px; }
.postpone-title { font-size: 11px; font-weight: 600; color: var(--amber); margin-bottom: 7px; }

/* ── SPINNER / TOAST ── */
#toast {
  position: fixed; bottom: calc(70px + var(--safe-bottom)); left: 50%; transform: translateX(-50%);
  background: var(--bg4); border: 1px solid var(--border2); color: var(--text);
  border-radius: 20px; padding: 8px 18px; font-size: 13px; z-index: 999;
  opacity: 0; pointer-events: none; transition: opacity 0.25s; white-space: nowrap;
}
#toast.show { opacity: 1; }

/* ── AUTH SCREENS ── */
.auth-wrap { min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 20px; }
.auth-card { background: var(--bg3); border: 1px solid var(--border2); border-radius: 14px; padding: 28px 24px; width: 100%; max-width: 380px; }
.auth-logo { text-align: center; margin-bottom: 20px; }
.auth-logo .logo-big { width: 56px; height: 56px; border-radius: 14px; background: var(--accent); display: inline-flex; align-items: center; justify-content: center; font-size: 24px; font-weight: 700; color: var(--text); margin-bottom: 10px; }
.auth-logo h1 { font-size: 18px; font-weight: 500; color: var(--text); }
.auth-logo p { font-size: 12px; color: var(--text3); margin-top: 3px; }
.auth-error { background: var(--red-bg); border: 1px solid var(--red-border); border-radius: 8px; padding: 9px 12px; font-size: 13px; color: var(--red); margin-bottom: 10px; }
.auth-footer { text-align: center; font-size: 12px; color: var(--text3); margin-top: 14px; }

/* ── EMPTY STATE ── */
.empty-state { text-align: center; padding: 40px 20px; color: var(--text3); }
.empty-state i { font-size: 40px; display: block; margin-bottom: 10px; }
.empty-state p { font-size: 13px; }

/* ── MISC ── */
.divider { height: 1px; background: var(--border); margin: 6px 0; }
.text-accent { color: var(--accent2); }
.text-danger { color: var(--red); }
.text-success { color: var(--green); }
.text-muted { color: var(--text3); font-style: italic; }
.hidden { display: none !important; }
.mt-2 { margin-top: 8px; }
.mb-2 { margin-bottom: 8px; }
.px-14 { padding-left: 14px; padding-right: 14px; }


/* ── BOTTOM SHEET MODAL ── */
.modal-overlay { position:fixed; inset:0; background:rgba(0,0,0,0.7); z-index:200; display:flex; align-items:flex-end; opacity:0; pointer-events:none; transition:opacity 0.25s; }
.modal-overlay.open { opacity:1; pointer-events:auto; }
.modal { width:100%; max-height:92vh; background:var(--card); border-radius:20px 20px 0 0; overflow:hidden; display:flex; flex-direction:column; transform:translateY(100%); transition:transform 0.3s cubic-bezier(0.4,0,0.2,1); }
.modal-overlay.open .modal { transform:translateY(0); }
.modal-handle { width:36px; height:4px; background:var(--border); border-radius:2px; margin:10px auto 0; flex-shrink:0; }
.modal-header { display:flex; align-items:center; justify-content:space-between; padding:14px 16px 10px; border-bottom:1px solid var(--border); flex-shrink:0; }
.modal-title { font-size:17px; font-weight:700; color:var(--text); }
.modal-close { background:none; border:none; color:var(--text2); font-size:24px; cursor:pointer; padding:0 4px; line-height:1; }
.modal-body { overflow-y:auto; padding:16px; flex:1; }
.modal-footer { padding:12px 16px 28px; border-top:1px solid var(--border); display:flex; gap:8px; flex-direction:column; }

/* ── REPORTS ── */
.report-filter { display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.btn-sm { padding:6px 12px; font-size:12px; }

/* report wrap */
.rpt-wrap { font-size:13px; }
.rpt-hdr { margin-bottom:12px; }
.rpt-company { font-size:11px; color:var(--text3); margin-bottom:2px; }
.rpt-title { font-size:17px; font-weight:600; color:var(--text); }
.rpt-meta { font-size:12px; color:var(--text3); margin-top:2px; }

/* summary grid */
.rpt-summary-grid { display:grid; grid-template-columns:repeat(2,1fr); gap:8px; margin-bottom:14px; }
.rpt-stat { background:var(--bg3); border:1px solid var(--border); border-radius:8px; padding:9px 12px; }
.rpt-stat-lbl { font-size:11px; color:var(--text3); margin-bottom:2px; }
.rpt-stat-val { font-size:20px; font-weight:600; color:var(--text); }

/* room blocks */
.rpt-room-block {
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 10px;
}
.rpt-room-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 8px 12px;
  background: var(--bg3);
  border-bottom: 1px solid var(--border);
}
.rpt-room-name { font-size:12px; font-weight:600; color:var(--text); }
.rpt-badges { display:flex; gap:4px; flex-wrap:wrap; justify-content:flex-end; }
.rpt-badge { font-size:10px; padding:2px 7px; border-radius:99px; }
.rpt-badge-ok   { background:rgba(63,185,80,0.18); color:#3fb950; }
.rpt-badge-pend { background:rgba(79,195,247,0.08); color:#4fc3f7; }
.rpt-badge-err  { background:rgba(220,50,50,0.18); color:#ff6b6b; }

/* table — single table per room block */
.rpt-tbl { width:100%; border-collapse:collapse; font-size:12px; table-layout:fixed; }
.rpt-col-zone   { width:40%; }
.rpt-col-mth    { width:12%; }
.rpt-col-freq   { width:24%; }
.rpt-col-status { width:24%; }
/* room header row inside table */
.rpt-tbl tr.rpt-room-hdr-row td {
  background:var(--bg3); padding:8px 12px;
  font-size:12px; font-weight:600; color:var(--text);
  border-bottom:1px solid var(--border);
}
.rpt-tbl tr.rpt-room-hdr-row td.rpt-hdr-badge { padding:8px 4px; text-align:right; }
.rpt-tbl tr.rpt-room-hdr-row td.rpt-hdr-badge-last { padding:8px 12px 8px 4px; text-align:right; }
/* column header row */
.rpt-tbl tr.rpt-col-hdr th {
  font-size:10px; font-weight:600; color:var(--text3);
  padding:4px 8px; background:var(--bg2);
  border-bottom:1px solid var(--border);
  text-transform:uppercase; letter-spacing:0.04em;
}
.rpt-tbl tr.rpt-col-hdr th.th-zone   { text-align:left; padding-left:12px; }
.rpt-tbl tr.rpt-col-hdr th.th-center { text-align:center; }
.rpt-tbl tr.rpt-col-hdr th.th-right  { text-align:right; padding-right:12px; }
/* data cells */
.rpt-tbl td {
  padding:6px 8px;
  border-bottom:1px solid var(--border);
  color:var(--text);
  vertical-align:middle; overflow:hidden; text-overflow:ellipsis;
}
.rpt-tbl td.td-zone   { padding:6px 12px; }
.rpt-tbl td.td-center { text-align:center; }
.rpt-tbl td.td-right  { text-align:right; padding-right:12px; }
.rpt-tbl tbody tr:last-child td { border-bottom:none; }
.rpt-note-row td {
  padding:3px 12px 7px 28px; font-size:11px;
  color:var(--text3); font-style:italic;
  border-bottom:1px solid var(--border);
  border-top:1px solid var(--border);
  background:var(--bg2);
}
.rpt-note-row:last-child td { border-bottom:none; }
.rpt-ok   { color:#3fb950; }
.rpt-err  { color:#ff6b6b; }
.rpt-warn { color:#c8901a; }
.rpt-pend { color:var(--text3); }
.rpt-empty { text-align:center; padding:24px; color:var(--text3); }

/* signature block — screen: hidden, print: shown only in popup window */
.rpt-sig-block { display:none; }

/* ── CALENDAR DAY TASKS ── */
.cal-day-tasks { margin-top:8px; }
.cal-day-tasks .task-card { margin-bottom:8px; }

/* ── PRINT (fallback — main print handled by printReport() popup) ── */
@media print {
  body { background:#fff !important; color:#111 !important; }
  .app-header, .bottom-nav, .report-filter, button { display:none !important; }
  .page-content { overflow:visible !important; padding:0 !important; }
  /* Print colgroup — wider zone column, narrower freq/status */
  .rpt-col-zone   { width:64% !important; }
  .rpt-col-mth    { width:10% !important; }
  .rpt-col-freq   { width:13% !important; }
  .rpt-col-status { width:13% !important; }
}

/* ── CALENDAR FUTURE DATES ── */
.cal-day-num { font-size:13px; font-weight:500; line-height:1; }
.cal-future-card { opacity: 0.75; border-style: dashed; }
.cal-count { display:inline-flex; align-items:center; justify-content:center; min-width:18px; height:14px; padding:0 4px; border-radius:7px; font-size:9px; font-weight:800; line-height:1; pointer-events:none; background:var(--bg4); color:var(--text3); letter-spacing:0; }
.cal-cell.has-task .cal-count { background:rgba(79,195,247,0.18); color:#4fc3f7; }
.cal-cell.has-warn .cal-count { background:rgba(210,153,34,0.2); color:#d29922; }
.cal-cell.has-future .cal-count { background:rgba(79,195,247,0.1); color:var(--accent); }
.cal-cell.today .cal-count { background:rgba(0,0,0,0.25); color:#fff; }

/* ── SCHEDULE FILTER ── */
.sched-filter-row { display:flex !important; flex-wrap:wrap !important; gap:6px !important; padding:10px 14px 8px !important; }
.sched-filter-btn { display:inline-block !important; padding:6px 14px !important; border-radius:20px !important; border:none !important; outline:none !important; -webkit-appearance:none !important; appearance:none !important; background:var(--bg3) !important; color:var(--text2) !important; font-size:12px !important; font-weight:500 !important; cursor:pointer !important; white-space:nowrap !important; font-family:inherit !important; transition:background 0.15s, color 0.15s; }
.sched-filter-btn.active { background:var(--accent) !important; color:#fff !important; font-weight:600 !important; }

/* -- LIGHTBOX -- */
.lightbox-overlay {
  position:fixed; inset:0; background:rgba(0,0,0,0.92); z-index:9999;
  display:flex; align-items:center; justify-content:center;
  opacity:0; pointer-events:none; transition:opacity 0.25s;
}
.lightbox-overlay.open { opacity:1; pointer-events:auto; }
.lightbox-img {
  max-width:95vw; max-height:90vh; object-fit:contain;
  border-radius:8px; box-shadow:0 8px 40px rgba(0,0,0,0.6);
}
.lightbox-close {
  position:fixed; top:max(16px,env(safe-area-inset-top,16px)); right:16px;
  background:rgba(0,0,0,0.6); border:1px solid rgba(255,255,255,0.2); color:#fff;
  border-radius:50%; width:40px; height:40px; font-size:22px; line-height:1;
  cursor:pointer; display:flex; align-items:center; justify-content:center; z-index:10000;
}
.lightbox-close:hover { background:rgba(255,255,255,0.15); }

/* -- SKELETON LOADING -- */
.skeleton-wrap { padding:8px 0; }
.skeleton {
  background: linear-gradient(90deg, var(--bg2) 25%, var(--bg3) 50%, var(--bg2) 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.4s infinite;
  border-radius: 12px;
  margin: 8px 0;
}
.skeleton-banner { height: 68px; }
.skeleton-card { height: 88px; margin-bottom: 10px; }
@keyframes skeleton-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── Sidebar/panel: hidden on mobile, shown via media queries ── */
.app-sidebar { display: none; }
.detail-panel { display: none; }
.app-main { display: flex; flex-direction: column; flex: 1; min-width: 0; height: 100%; overflow: hidden; }
.page-header { display: none; }

/* ══════════════════════════════════════════════
   RESPONSIVE LAYOUT — sidebar (≥768px) + detail panel (≥1200px)
   ══════════════════════════════════════════════ */

@media (min-width: 768px) {
  #app {
    max-width: 100%;
    display: flex;
    flex-direction: row;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
  }
  .app-header { display: none; }
  .bottom-nav { display: none; }

  .app-sidebar {
    width: 190px; flex-shrink: 0;
    background: var(--bg2); border-right: 1px solid var(--border);
    display: flex; flex-direction: column; height: 100%; overflow: hidden;
  }
  .sidebar-logo {
    padding: 16px 14px 14px; display: flex; align-items: center; gap: 10px;
    border-bottom: 1px solid var(--border); flex-shrink: 0;
  }
  .sidebar-logo-icon {
    width: 34px; height: 34px; background: none;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  }
  .sidebar-logo-icon img { width: 34px; height: 34px; object-fit: contain; border-radius: 0; }
  .sidebar-logo-title { font-size: 14px; font-weight: 600; color: var(--text); line-height: 1.2; }
  .sidebar-logo-sub { font-size: 10px; color: var(--text3); }
  .sidebar-nav {
    flex: 1; padding: 8px; display: flex; flex-direction: column; gap: 2px; overflow-y: auto;
  }
  .sidebar-btn {
    display: flex; align-items: center; gap: 10px; padding: 9px 12px;
    border-radius: 9px; background: none; border: none; cursor: pointer;
    width: 100%; text-align: left; transition: background 0.12s;
  }
  .sidebar-btn i { font-size: 18px; color: var(--text3); flex-shrink: 0; }
  .sidebar-btn span { font-size: 13px; color: var(--text2); font-family: inherit; }
  .sidebar-btn:hover { background: var(--bg3); }
  .sidebar-btn.active { background: rgba(79,195,247,0.08); border: 1px solid rgba(79,195,247,0.18); }
  .sidebar-btn.active i { color: var(--cyan); }
  .sidebar-btn.active span { color: var(--cyan); font-weight: 500; }
  .sidebar-footer { padding: 8px; border-top: 1px solid var(--border); flex-shrink: 0; }
  .sidebar-user { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 9px; }
  .sidebar-avatar {
    width: 28px; height: 28px; background: rgba(79,195,247,0.15); border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 10px; font-weight: 600; color: var(--cyan); flex-shrink: 0;
  }
  .sidebar-user-info { flex: 1; min-width: 0; }
  .sidebar-user-name { font-size: 12px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .sidebar-user-role { font-size: 10px; color: var(--text3); }

  .app-main { flex: 1; display: flex; flex-direction: column; min-width: 0; height: 100%; overflow: hidden; }
  .page-header {
    background: var(--bg2); border-bottom: 1px solid var(--border);
    padding: 12px 18px; display: flex; align-items: center;
    justify-content: space-between; flex-shrink: 0; min-height: 52px;
  }
  .page-header-title { font-size: 15px; font-weight: 600; color: var(--text); }
  .page-header-actions { display: flex; gap: 8px; align-items: center; }
  .page-content {
    padding-bottom: 0;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
    scrollbar-gutter: stable;
  }
  .page-content > * {
    width: 100%;
    box-sizing: border-box;
  }
  .page-content::-webkit-scrollbar,
  .app-sidebar::-webkit-scrollbar,
  .detail-panel-body::-webkit-scrollbar { width: 6px; }
  .page-content::-webkit-scrollbar-track,
  .app-sidebar::-webkit-scrollbar-track,
  .detail-panel-body::-webkit-scrollbar-track { background: transparent; }
  .page-content::-webkit-scrollbar-thumb,
  .app-sidebar::-webkit-scrollbar-thumb,
  .detail-panel-body::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
  .page-content::-webkit-scrollbar-thumb:hover,
  .app-sidebar::-webkit-scrollbar-thumb:hover,
  .detail-panel-body::-webkit-scrollbar-thumb:hover { background: var(--text3); }
}

@media (min-width: 1200px) {

  .app-main { width: 700px; flex-shrink: 0; flex: none; }
  .detail-panel {
    flex: 1; min-width: 0;
    background: var(--bg2); border-left: 1px solid var(--border);
    display: flex; flex-direction: column; height: 100%; overflow: hidden;
  }
  .detail-panel-header {
    padding: 12px 16px; border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between; flex-shrink: 0;
  }
  .detail-panel-title { font-size: 14px; font-weight: 600; color: var(--text); }
  .detail-panel-close {
    background: none; border: none; color: var(--text3); font-size: 20px;
    cursor: pointer; padding: 0 2px; display: flex; align-items: center;
  }
  .detail-panel-close:hover { color: var(--text2); }
  .detail-panel-body { flex: 1; overflow-y: auto; padding: 0 0 16px; }
  .detail-panel-empty {
    display: flex; flex-direction: column; align-items: center;
    justify-content: center; height: 100%; color: var(--text3); gap: 8px; font-size: 13px;
  }
  .detail-panel-empty i { font-size: 32px; }
}

/* ── Detail panel active card highlight ── */
.card.detail-active {
  border-color: var(--cyan) !important;
  background: rgba(79,195,247,0.04);
}


/* ── Utility chip / tag класове ── */
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; color: var(--text2);
  background: var(--bg2); padding: 4px 10px;
  border-radius: 8px; border: 0.5px solid var(--border);
  white-space: nowrap;
}
.chip-wrap {
  display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px;
}
.chip i { font-size: 13px; }

/* chip за бележки — може да wrap-ва */
.chip-note {
  display: inline-flex; align-items: flex-start; gap: 5px;
  font-size: 12px; color: var(--text2);
  background: var(--bg2); padding: 4px 10px;
  border-radius: 8px; border: 0.5px solid var(--border);
  white-space: normal; word-break: break-word;
}
.chip-note i { font-size: 13px; flex-shrink: 0; margin-top: 1px; }

/* ── Icon button (прозрачен) ── */
.icon-btn {
  background: none; border: none; cursor: pointer; padding: 0 4px;
  display: inline-flex; align-items: center;
}
.icon-btn-text { color: var(--text2); font-size: 20px; }
.icon-btn-muted { color: var(--text3); }
.icon-btn-danger { color: var(--red); font-size: 12px; font-weight: 500; }

/* ── Detail панел layout ── */
.detail-inner {
  padding: 0 16px 16px;
  max-width: 680px;
}

/* ── Секция действия в детайл ── */
.action-wrap {
  padding: 4px 12px 8px;
  display: flex; flex-direction: column; gap: 6px;
}

/* ── Ред с действия в карта ── */
.card-actions {
  display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap;
}

/* ── Фreq/status badge в график ── */
.fbadge {
  display: inline-block; font-size: 11px; padding: 2px 7px;
  border-radius: 99px; font-weight: 600;
}
.fbadge-green { background: var(--green-bg, rgba(63,185,80,0.15)); color: var(--green); }
.fbadge-blue  { background: rgba(79,195,247,0.12); color: var(--accent); }
.fbadge-red   { background: var(--red-bg); color: var(--red); }
.fbadge-amber { background: var(--amber-bg); color: var(--amber); }
.fbadge-muted { background: var(--bg2); color: var(--text2); }

/* ── Rooms list row ── */
.room-row {
  display: flex; align-items: center; gap: 8px;
}
.room-row-drag {
  font-size: 20px; color: var(--text3); cursor: grab;
  touch-action: none; flex-shrink: 0;
}
.room-row-body { flex: 1; cursor: pointer; }
.room-row-name { margin-bottom: 2px; }
.room-row-sub  { color: var(--text3); font-size: 15px; }

/* ── Filter / tab toggle bar ── */
.filter-bar {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 10px 10px 8px; align-items: center;
}

/* ── Report tab toggle ── */
.report-tabs {
  display: flex; gap: 4px; background: var(--bg2);
  border-radius: 10px; padding: 3px; margin-bottom: 12px;
}
.report-tab-btn {
  flex: 1; padding: 8px; border-radius: 8px;
  border: none; outline: none;
  -webkit-appearance: none; appearance: none;
  background: transparent; color: var(--text2);
  font-size: 13px; cursor: pointer; font-family: inherit;
  transition: background 0.15s, color 0.15s;
}
.report-tab-btn.active {
  background: var(--bg3); color: var(--text); font-weight: 600;
}

/* ── Inline user checkbox row (addUser/editUser) ── */
.checkbox-row {
  display: flex; align-items: center; gap: 10px;
}
.checkbox-row input[type=checkbox] {
  width: 18px; height: 18px;
}
.checkbox-row label { margin: 0; }

/* ── Sub-label (mini uppercase) ── */
.sub-lbl {
  font-size: 10px; color: var(--text3); font-weight: 600;
  text-transform: uppercase; letter-spacing: .05em;
  display: block; margin-bottom: 4px;
}

.video-thumb video { max-width: 100%; border-radius: 8px; display: block; background: var(--bg3); }
.video-fallback { display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: var(--bg3); border-radius: 8px; padding: 16px; min-height: 100px; gap: 6px; text-align: center; }
