/* ===================== KLIMAVERSE – DESIGN SYSTEM ===================== */
:root {
  --primary: #0066CC;
  --primary-dark: #004A99;
  --primary-light: #E8F2FF;
  --secondary: #00A8A8;
  --secondary-light: #E0F7F7;
  --accent: #FF6B35;
  --success: #22C55E;
  --warning: #F59E0B;
  --danger: #EF4444;
  --text: #1A1A2E;
  --text-muted: #6B7280;
  --border: #E5E7EB;
  --bg: #F8FAFC;
  --card-bg: #FFFFFF;
  --sidebar-w: 250px;
  --header-h: 56px;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 25px rgba(0,0,0,0.1), 0 4px 10px rgba(0,0,0,0.06);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body { font-family: 'Inter', system-ui, sans-serif; background: var(--bg); color: var(--text); line-height: 1.5; -webkit-font-smoothing: antialiased; }

/* ===================== LOGIN ===================== */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0066CC 0%, #004A99 40%, #00A8A8 100%);
  padding: 20px;
}
.login-card {
  background: white;
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
  display: flex;
  overflow: hidden;
  max-width: 900px;
  width: 100%;
  min-height: 520px;
}
.login-left {
  background: linear-gradient(145deg, #0066CC, #00A8A8);
  color: white;
  padding: 48px 40px;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.login-brand { text-align: center; margin-bottom: 40px; }
.brand-icon { font-size: 56px; display: block; margin-bottom: 12px; filter: drop-shadow(0 4px 8px rgba(0,0,0,0.3)); }
.login-brand h1 { font-size: 2.2rem; font-weight: 800; letter-spacing: -0.5px; }
.login-brand p { opacity: 0.85; font-size: 0.9rem; margin-top: 6px; }
.login-features { display: flex; flex-direction: column; gap: 14px; }
.feat { display: flex; align-items: center; gap: 12px; font-size: 0.95rem; opacity: 0.9; }
.feat span { font-size: 1.3rem; }
.login-right {
  padding: 48px 40px;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-form-box { width: 100%; max-width: 340px; }
.login-form-box h2 { font-size: 1.7rem; font-weight: 700; margin-bottom: 6px; color: var(--text); }
.login-sub { color: var(--text-muted); margin-bottom: 28px; font-size: 0.9rem; }
.login-footer { text-align: center; margin-top: 20px; font-size: 0.8rem; color: var(--text-muted); }

/* ===================== APP SHELL ===================== */
.app-shell { display: flex; min-height: 100vh; }
.hidden { display: none !important; }

/* ===================== SIDEBAR ===================== */
.sidebar {
  width: var(--sidebar-w);
  background: var(--text);
  color: white;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 200;
  overflow-y: auto;
  transition: transform 0.3s ease;
}
.sidebar-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 16px 12px 14px;
  cursor: pointer;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  text-decoration: none;
}
.sidebar-brand-icon { font-size: 1.8rem; color: #60C0FF; }
.sidebar-brand-name { font-size: 1.05rem; font-weight: 700; color: white; }
.sidebar-brand-sub { font-size: 0.7rem; color: rgba(255,255,255,0.5); }
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
.sidebar-avatar {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.9rem; flex-shrink: 0;
}
.sidebar-username { font-size: 0.9rem; font-weight: 600; color: white; }
.sidebar-role { font-size: 0.72rem; color: rgba(255,255,255,0.5); }
.sidebar-nav { flex: 1; padding: 8px 0; }

/* ---- Notification bell ---- */
.notif-bell {
  position: relative; background: none; border: none; cursor: pointer;
  font-size: 1.25rem; color: rgba(255,255,255,0.7); flex-shrink: 0;
  padding: 4px; border-radius: 8px; transition: background 0.15s;
}
.notif-bell:hover { background: rgba(255,255,255,0.1); color: white; }
.notif-bell-badge {
  position: absolute; top: -2px; right: -4px;
  background: #EF4444; color: white; font-size: 0.6rem; font-weight: 700;
  min-width: 16px; height: 16px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center; padding: 0 3px;
  border: 2px solid var(--sidebar-bg, #1e293b);
}

/* ---- Notification panel ---- */
.notif-overlay {
  position: fixed; inset: 0; z-index: 1099; background: rgba(0,0,0,0.15);
}
.notif-panel {
  position: fixed; top: 0; right: 0; width: 360px; height: 100vh;
  background: #ffffff; border-left: 1px solid #E5E7EB;
  box-shadow: -6px 0 32px rgba(0,0,0,0.15); z-index: 1100;
  display: flex; flex-direction: column;
  transform: translateX(100%); transition: transform 0.25s ease;
}
.notif-panel.open { transform: translateX(0); }
.notif-panel.hidden { display: none; }
.notif-panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px; border-bottom: 1px solid #E5E7EB;
  flex-shrink: 0; background: #ffffff;
}
.notif-panel-close {
  background: none; border: none; cursor: pointer; font-size: 1rem;
  color: #6B7280; padding: 4px 8px; border-radius: 6px; line-height: 1;
}
.notif-panel-close:hover { background: #F3F4F6; color: #111; }
.notif-list { flex: 1; overflow-y: auto; padding: 4px 0; background: #ffffff; }
.notif-empty { padding: 48px 20px; text-align: center; color: #6B7280; font-size: 0.875rem; }
.notif-item {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 12px 18px; cursor: pointer; transition: background 0.12s;
  border-bottom: 1px solid #F3F4F6;
}
.notif-item:hover { background: #F8FAFC; }
.notif-item.unread { background: #EFF6FF; }
.notif-item.unread:hover { background: #DBEAFE; }
.notif-dot {
  width: 8px; height: 8px; border-radius: 50%; background: #0066CC;
  flex-shrink: 0; margin-top: 5px;
}
.notif-dot.read { background: transparent; border: 1.5px solid #D1D5DB; }
.notif-item-body { flex: 1; min-width: 0; }
.notif-item-title { font-size: 0.875rem; font-weight: 600; color: #1A1A2E; line-height: 1.35; }
.notif-item-body-text { font-size: 0.78rem; color: #6B7280; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.notif-item-time { font-size: 0.72rem; color: #9CA3AF; margin-top: 4px; }
.notif-delete { background: none; border: none; cursor: pointer; color: #9CA3AF; font-size: 0.75rem; padding: 2px 6px; border-radius: 4px; flex-shrink: 0; opacity: 0; transition: opacity 0.15s; align-self: center; }
.notif-item:hover .notif-delete { opacity: 1; }
.notif-delete:hover { color: #EF4444; background: #FEE2E2; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 16px;
  background: none;
  border: none;
  color: rgba(255,255,255,0.75);
  cursor: pointer;
  font-size: 0.875rem;
  font-family: inherit;
  text-align: left;
  transition: all 0.15s;
  border-radius: 0;
  position: relative;
}
.nav-item:hover { background: rgba(255,255,255,0.08); color: white; }
.nav-item.active { background: rgba(0,102,204,0.4); color: white; border-left: 3px solid var(--primary); }
.nav-item.active .nav-icon { color: #60C0FF; }
.nav-icon { font-size: 1.1rem; flex-shrink: 0; width: 22px; }
.sidebar-logout {
  margin: 8px 12px 16px;
  padding: 10px;
  background: rgba(239,68,68,0.15);
  border: 1px solid rgba(239,68,68,0.3);
  color: #FCA5A5;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.85rem;
  font-family: inherit;
  width: calc(100% - 24px);
  transition: all 0.15s;
}
.sidebar-logout:hover { background: rgba(239,68,68,0.3); color: white; }
.badge {
  background: var(--danger);
  color: white;
  border-radius: 99px;
  padding: 1px 7px;
  font-size: 0.72rem;
  font-weight: 700;
  margin-left: auto;
}

/* Mobile header */
.mobile-header {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: var(--text);
  color: white;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 150;
  box-shadow: var(--shadow);
}
.mobile-title { font-weight: 700; font-size: 1rem; }
.hamburger { background: none; border: none; color: white; font-size: 1.4rem; cursor: pointer; padding: 8px; }
.sidebar-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  z-index: 199; transition: opacity 0.3s;
}

/* ===================== MAIN CONTENT ===================== */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-height: 100vh;
  padding: 28px;
  max-width: calc(100vw - var(--sidebar-w));
}

/* ===================== PAGE HEADER ===================== */
.page-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.page-header h1 { font-size: 1.6rem; font-weight: 700; color: var(--text); flex: 1; }
.page-header p { width: 100%; color: var(--text-muted); margin-top: -14px; font-size: 0.9rem; }
.page-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ===================== CARDS ===================== */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  overflow: hidden;
}
.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.card-header h3 { font-size: 0.95rem; font-weight: 600; color: var(--text); }
.card-body { padding: 20px; }

/* ===================== BUTTONS ===================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  border: none;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
  white-space: nowrap;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,102,204,0.3); }
.btn-secondary { background: var(--secondary); color: white; }
.btn-secondary:hover { background: #008888; }
.btn-outline { background: white; color: var(--text); border: 1.5px solid var(--border); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #DC2626; }
.btn-sm { padding: 6px 12px; font-size: 0.8rem; }
.btn-full { width: 100%; justify-content: center; }

/* ===================== FORMS ===================== */
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group label { font-size: 0.82rem; font-weight: 500; color: var(--text-muted); }
.form-control {
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-family: inherit;
  color: var(--text);
  background: white;
  transition: border-color 0.15s, box-shadow 0.15s;
  width: 100%;
}
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(0,102,204,0.12); }
.form-control::placeholder { color: #B0B7C3; }
select.form-control { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236B7280' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 30px; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; }

/* ===================== ALERTS ===================== */
.alert { padding: 10px 14px; border-radius: var(--radius-sm); font-size: 0.85rem; margin-bottom: 12px; }
.alert-danger { background: #FEF2F2; color: #B91C1C; border: 1px solid #FECACA; }
.alert-success { background: #F0FDF4; color: #166534; border: 1px solid #BBF7D0; }
.alert-warning { background: #FFFBEB; color: #92400E; border: 1px solid #FDE68A; }

/* ===================== KPI GRID ===================== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.kpi-card {
  background: white;
  border-radius: var(--radius);
  padding: 20px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.kpi-icon { font-size: 1.6rem; margin-bottom: 10px; }
.kpi-value { font-size: 1.7rem; font-weight: 700; color: var(--text); line-height: 1; }
.kpi-label { font-size: 0.8rem; color: var(--text-muted); margin-top: 5px; font-weight: 500; }
.kpi-card.blue { border-top: 3px solid var(--primary); }
.kpi-card.teal { border-top: 3px solid var(--secondary); }
.kpi-card.green { border-top: 3px solid var(--success); }
.kpi-card.orange { border-top: 3px solid var(--accent); }
.kpi-card.red { border-top: 3px solid var(--danger); }
.kpi-card.yellow { border-top: 3px solid var(--warning); }

/* ===================== CHARTS ===================== */
.charts-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 20px; margin-bottom: 20px; }
.two-col-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

/* ===================== PROJECTS GRID ===================== */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 16px;
}
.project-card {
  background: white;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 20px;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.project-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
}
.project-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--primary); }
.project-card.completed::before { background: var(--success); }
.project-card.on-hold::before { background: var(--warning); }
.proj-card-name { font-size: 1rem; font-weight: 600; margin-bottom: 6px; color: var(--text); }
.proj-card-location { font-size: 0.82rem; color: var(--text-muted); margin-bottom: 14px; }
.proj-card-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.proj-stat { text-align: center; padding: 10px; background: var(--bg); border-radius: 8px; }
.proj-stat-val { font-size: 1rem; font-weight: 700; }
.proj-stat-label { font-size: 0.72rem; color: var(--text-muted); margin-top: 2px; }
.proj-progress-bar { height: 6px; background: #E5E7EB; border-radius: 99px; overflow: hidden; margin-bottom: 10px; }
.proj-progress-fill { height: 100%; background: linear-gradient(90deg, var(--primary), var(--secondary)); border-radius: 99px; transition: width 0.4s; }
.proj-progress-fill.over { background: linear-gradient(90deg, var(--warning), var(--danger)); }
.proj-status-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 99px; font-size: 0.75rem; font-weight: 600;
}
.badge-active { background: #DBEAFE; color: #1D4ED8; }
.badge-completed { background: #DCFCE7; color: #166534; }
.badge-on-hold { background: #FEF3C7; color: #92400E; }

/* ===================== PROJECT DETAIL ===================== */
.project-detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.finance-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.finance-item { padding: 14px; background: var(--bg); border-radius: 10px; text-align: center; }
.finance-item-val { font-size: 1.25rem; font-weight: 700; }
.finance-item-label { font-size: 0.75rem; color: var(--text-muted); margin-top: 3px; }

/* ===================== STATS BAR ===================== */
.stats-bar { display: flex; gap: 14px; margin-bottom: 20px; flex-wrap: wrap; }
.stat-chip {
  background: white; border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 10px 18px; display: flex; align-items: center; gap: 8px;
  font-size: 0.85rem; box-shadow: var(--shadow);
}
.stat-chip strong { color: var(--primary); font-weight: 700; }

/* ===================== TABLE ===================== */
.data-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.data-table th { padding: 10px 12px; text-align: left; font-size: 0.75rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; border-bottom: 2px solid var(--border); background: var(--bg); }
.data-table td { padding: 12px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.data-table tr:hover td { background: var(--primary-light); }
.data-table tr:last-child td { border-bottom: none; }

/* ===================== KANBAN ===================== */
.kanban-board { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; }
.kanban-col { display: flex; flex-direction: column; gap: 12px; }
.kanban-col-header {
  padding: 12px 16px; border-radius: var(--radius-sm); font-weight: 600;
  font-size: 0.875rem; display: flex; align-items: center; gap: 8px;
}
.kanban-col-header.todo { background: #F3F4F6; color: #374151; }
.kanban-col-header.inprogress { background: #DBEAFE; color: #1D4ED8; }
.kanban-col-header.done { background: #DCFCE7; color: #166534; }
.kanban-cards { display: flex; flex-direction: column; gap: 10px; min-height: 120px; padding: 4px; }
.kanban-card {
  background: white; border-radius: var(--radius-sm); padding: 14px;
  border: 1px solid var(--border); box-shadow: var(--shadow);
  cursor: grab; transition: all 0.15s;
}
.kanban-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.kanban-card.dragging { opacity: 0.5; }
.kanban-card-title { font-weight: 600; font-size: 0.875rem; margin-bottom: 8px; }
.kanban-card-meta { font-size: 0.78rem; color: var(--text-muted); display: flex; gap: 8px; flex-wrap: wrap; }
.priority-high { color: var(--danger); }
.priority-medium { color: var(--warning); }
.priority-low { color: var(--success); }

/* ===================== TABS ===================== */
.tabs { display: flex; gap: 4px; margin-bottom: 20px; background: white; padding: 4px; border-radius: var(--radius-sm); border: 1px solid var(--border); width: fit-content; box-shadow: var(--shadow); }
.tab { padding: 8px 16px; border: none; background: none; border-radius: 6px; font-size: 0.875rem; font-weight: 500; cursor: pointer; color: var(--text-muted); font-family: inherit; transition: all 0.15s; }
.tab.active { background: var(--primary); color: white; box-shadow: 0 2px 6px rgba(0,102,204,0.3); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ===================== MESSAGES ===================== */
.messages-layout { display: grid; grid-template-columns: 260px 1fr; gap: 20px; height: calc(100vh - 160px); }
.messages-sidebar { display: flex; flex-direction: column; overflow: hidden; }
.user-list { flex: 1; overflow-y: auto; }
.user-list-item {
  display: flex; align-items: center; gap: 10px; padding: 12px 16px;
  cursor: pointer; border-bottom: 1px solid var(--border); transition: background 0.15s;
  font-size: 0.875rem;
}
.user-list-item:hover { background: var(--primary-light); }
.user-list-item.active { background: var(--primary-light); border-left: 3px solid var(--primary); }
.user-avatar { width: 34px; height: 34px; border-radius: 50%; background: linear-gradient(135deg, var(--primary), var(--secondary)); display: flex; align-items: center; justify-content: center; font-weight: 700; color: white; font-size: 0.8rem; flex-shrink: 0; }
.messages-main { display: flex; flex-direction: column; overflow: hidden; }
.chat-messages { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.chat-input { display: flex; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--border); }
.chat-msg { max-width: 70%; padding: 10px 14px; border-radius: 16px; font-size: 0.875rem; line-height: 1.4; }
.chat-msg.mine { background: var(--primary); color: white; align-self: flex-end; border-bottom-right-radius: 4px; }
.chat-msg.theirs { background: #F3F4F6; color: var(--text); align-self: flex-start; border-bottom-left-radius: 4px; }
.chat-msg-time { font-size: 0.72rem; opacity: 0.65; margin-top: 4px; }

/* ===================== MODALS ===================== */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  z-index: 1000; display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.modal {
  background: white; border-radius: var(--radius); box-shadow: var(--shadow-lg);
  width: 100%; max-width: 640px; max-height: 90vh; display: flex; flex-direction: column;
  overflow: hidden;
}
/* Forms inside modals must also flex so modal-body can scroll */
.modal > form { display: flex; flex-direction: column; flex: 1; overflow: hidden; min-height: 0; }
.modal-header { padding: 18px 24px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; }
.modal-header h3 { font-size: 1.05rem; font-weight: 600; }
.modal-close { background: none; border: none; font-size: 1.1rem; cursor: pointer; color: var(--text-muted); padding: 4px; line-height: 1; }
.modal-close:hover { color: var(--danger); }
.modal-body { padding: 20px 24px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; flex: 1; min-height: 0; }
.modal-footer { padding: 14px 24px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; flex-shrink: 0; }

/* ===================== SCHEDULE TABLE ===================== */
.schedule-table { width: 100%; border-collapse: collapse; min-width: 700px; }
.schedule-table th { padding: 10px 8px; background: var(--text); color: white; text-align: center; font-size: 0.8rem; font-weight: 600; }
.schedule-table td { padding: 8px; border: 1px solid var(--border); font-size: 0.82rem; vertical-align: top; }
.schedule-cell { padding: 4px 8px; background: var(--primary-light); border-radius: 6px; color: var(--primary-dark); margin-bottom: 4px; display: flex; align-items: center; justify-content: space-between; font-size: 0.78rem; font-weight: 500; }

/* ===================== TOAST ===================== */
.toast {
  padding: 12px 18px; border-radius: var(--radius-sm); color: white; font-size: 0.875rem;
  box-shadow: var(--shadow-md); animation: slideIn 0.3s ease; max-width: 320px;
  display: flex; align-items: center; gap: 10px; font-weight: 500;
}
.toast.success { background: #166534; }
.toast.error { background: #B91C1C; }
.toast.info { background: var(--primary); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes slideOut { to { transform: translateX(110%); opacity: 0; } }

/* ===================== INVOICE ITEMS ===================== */
.inv-item { display: grid; grid-template-columns: 3fr 1fr 1fr 1fr 36px; gap: 8px; align-items: end; margin-bottom: 8px; }
.inv-item input { width: 100%; }
.totals-row { display: flex; justify-content: space-between; padding: 6px 0; font-size: 0.9rem; }
.totals-row.total { border-top: 2px solid var(--border); margin-top: 6px; padding-top: 10px; font-size: 1.05rem; }
.totals-row.total strong { color: var(--primary); font-size: 1.15rem; }

/* ===================== WAREHOUSE / BOZP TABLE ===================== */
.wh-item { display: flex; align-items: center; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.wh-item:last-child { border-bottom: none; }
.wh-icon { font-size: 1.5rem; flex-shrink: 0; }
.wh-info { flex: 1; }
.wh-name { font-weight: 600; font-size: 0.9rem; }
.wh-meta { font-size: 0.78rem; color: var(--text-muted); margin-top: 2px; }
.wh-qty { text-align: right; }
.wh-qty-val { font-size: 1.1rem; font-weight: 700; color: var(--text); }
.wh-qty-unit { font-size: 0.75rem; color: var(--text-muted); }
.low-stock .wh-qty-val { color: var(--danger); }
.wh-actions { display: flex; gap: 6px; }

/* ===================== EMPTY STATE ===================== */
.empty-state { text-align: center; padding: 48px 20px; color: var(--text-muted); }
.empty-state-icon { font-size: 3rem; display: block; margin-bottom: 12px; }
.empty-state p { font-size: 0.9rem; }

/* ===================== RESPONSIVE ===================== */
@media (max-width: 1024px) {
  .two-col-grid { grid-template-columns: 1fr; }
  .project-detail-grid { grid-template-columns: 1fr; }
  .kanban-board { grid-template-columns: 1fr; }
  .messages-layout { grid-template-columns: 1fr; height: auto; }
}
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .mobile-header { display: flex; }
  .main-content { margin-left: 0; padding: 16px; padding-top: calc(var(--header-h) + 16px); max-width: 100vw; }
  .login-left { display: none; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .kanban-board { grid-template-columns: 1fr; }
  .projects-grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .inv-item { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .tabs { flex-wrap: wrap; width: 100%; }
}

/* ===================== MISC ===================== */
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-muted { color: var(--text-muted); }
.text-primary { color: var(--primary); }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.fw-bold { font-weight: 700; }
.role-worker { display: none !important; }

.diary-entry { padding: 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 10px; background: white; }
.diary-entry-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; flex-wrap: wrap; gap: 6px; }
.diary-entry-date { font-weight: 600; font-size: 0.9rem; }
.diary-entry-body { font-size: 0.85rem; color: var(--text-muted); }

/* Diary photo strip (inline thumbnails) */
.diary-photo-strip { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.diary-thumb { width: 64px; height: 64px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); cursor: pointer; transition: transform 0.15s; }
.diary-thumb:hover { transform: scale(1.07); }

/* Photo modal grid */
.diary-photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px,1fr)); gap: 10px; }
.diary-photo-cell { position: relative; border-radius: 8px; overflow: hidden; border: 1px solid var(--border); background: var(--bg); }
.diary-photo-thumb { width: 100%; height: 120px; object-fit: cover; display: block; cursor: pointer; transition: opacity 0.15s; }
.diary-photo-thumb:hover { opacity: 0.85; }
.diary-photo-del { position: absolute; top: 4px; right: 4px; background: rgba(0,0,0,0.55); color: #fff; border: none; border-radius: 50%; width: 22px; height: 22px; font-size: 11px; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.diary-photo-del:hover { background: var(--danger); }
.diary-photo-name { font-size: 0.68rem; color: var(--text-muted); padding: 3px 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.bozp-item { padding: 14px; border-left: 4px solid var(--primary); background: var(--primary-light); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; margin-bottom: 10px; }
.bozp-item.incident { border-color: var(--danger); background: #FEF2F2; }
.bozp-item.inspection { border-color: var(--warning); background: #FFFBEB; }

/* Loading spinner */
.spinner { display: inline-block; width: 20px; height: 20px; border: 2px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Scrollbar styling */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #CBD5E1; border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: #94A3B8; }

/* ===================== ANNOUNCEMENTS ===================== */
.ann-card {
  background: white;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 20px 24px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
  transition: box-shadow 0.2s;
}
.ann-card:hover { box-shadow: var(--shadow-md); }
.ann-card.pinned {
  border-left: 4px solid var(--primary);
  background: linear-gradient(135deg, #EFF6FF 0%, white 60%);
}
.ann-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  flex-wrap: wrap;
  gap: 8px;
}
.ann-meta { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.ann-pin { background: var(--primary-light); color: var(--primary); font-size: 0.75rem; font-weight: 600; padding: 2px 8px; border-radius: 99px; }
.ann-author { font-size: 0.8rem; color: var(--text-muted); }
.ann-date { font-size: 0.78rem; color: var(--text-muted); }
.ann-title { font-size: 1.05rem; font-weight: 700; margin-bottom: 8px; color: var(--text); }
.ann-content { font-size: 0.88rem; color: var(--text-secondary, #4B5563); line-height: 1.6; }

/* ===================== WORK HOURS REDESIGN ===================== */
.work-stats-bar {
  display: flex;
  gap: 20px;
  padding: 10px 14px;
  background: var(--primary-light);
  border-radius: var(--radius-sm);
  margin-bottom: 14px;
  font-size: 0.875rem;
}
.hours-summary {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  padding: 12px 14px;
  background: #F0FDF4;
  border-radius: var(--radius-sm);
  border: 1px solid #BBF7D0;
}
.hours-summary-item { display: flex; align-items: center; gap: 6px; }
.hours-summary-name { font-size: 0.82rem; font-weight: 600; }
.hours-summary-val { font-size: 0.82rem; background: #166534; color: white; padding: 2px 8px; border-radius: 99px; font-weight: 700; }
.work-records-list { display: flex; flex-direction: column; gap: 8px; }
.work-record-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: background 0.15s;
  flex-wrap: wrap;
}
.work-record-row:hover { background: var(--primary-light); }
.work-record-main { display: flex; align-items: center; gap: 14px; flex: 1; min-width: 0; flex-wrap: wrap; }
.work-record-date { font-weight: 700; font-size: 0.82rem; color: var(--primary); white-space: nowrap; min-width: 70px; }
.work-record-info { display: flex; gap: 8px; flex-wrap: wrap; flex: 1; }
.work-record-name { font-size: 0.82rem; font-weight: 600; }
.work-record-proj { font-size: 0.8rem; color: var(--text-muted); }
.work-record-type { font-size: 0.8rem; color: var(--text-muted); }
.work-record-hours { font-size: 1rem; font-weight: 700; color: var(--text); white-space: nowrap; }
.work-record-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.work-status { font-size: 0.72rem; font-weight: 600; padding: 2px 8px; border-radius: 99px; white-space: nowrap; }
.work-status.approved { background: #DCFCE7; color: #166534; }
.work-status.rejected { background: #FEF2F2; color: #B91C1C; }
.work-status.pending { background: #FEF3C7; color: #92400E; }

/* Extra small button */
.btn-xs { padding: 4px 8px; font-size: 0.75rem; }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #16A34A; }
.btn-warning { background: var(--warning); color: white; }
.btn-warning:hover { background: #D97706; }

/* ===================== BETTER MOBILE ===================== */
@media (max-width: 768px) {
  .page-header { flex-direction: column; align-items: flex-start; gap: 10px; }
  .page-header h1 { font-size: 1.3rem; }
  .page-actions { width: 100%; }
  .stats-bar { gap: 8px; }
  .stat-chip { font-size: 0.78rem; padding: 7px 12px; }
  .proj-card-stats { grid-template-columns: 1fr 1fr; }
  .proj-stat-val { font-size: 0.9rem; }
  .kanban-board { grid-template-columns: 1fr; gap: 12px; }
  .wh-item { flex-wrap: wrap; }
  .work-record-row { gap: 8px; }
  .work-record-main { flex-wrap: wrap; }
  .ann-card { padding: 14px 16px; }
  .tabs { overflow-x: auto; flex-wrap: nowrap; width: 100%; -webkit-overflow-scrolling: touch; }
  .tab { white-space: nowrap; font-size: 0.8rem; padding: 7px 12px; }
  .data-table { font-size: 0.78rem; }
  .data-table th, .data-table td { padding: 8px 8px; }
  .modal { max-height: 95vh; border-radius: 16px 16px 0 0; align-self: flex-end; }
  .modal-overlay { align-items: flex-end; padding: 0; }
  .messages-layout { grid-template-columns: 1fr; height: auto; }
  .messages-sidebar { max-height: 200px; }
  .chat-messages { min-height: 250px; max-height: 350px; }
  .hours-summary { flex-direction: column; gap: 6px; }
}

@media (max-width: 480px) {
  html { font-size: 14px; }
  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi-value { font-size: 1.3rem; }
  .kpi-icon { font-size: 1.3rem; }
  .kpi-card { padding: 14px; }
  .btn { padding: 8px 14px; }
  .form-row { grid-template-columns: 1fr; }
  .inv-item { grid-template-columns: 1fr; }
  .work-record-actions { width: 100%; justify-content: flex-start; }
}

/* ===================== CONTRACTS ===================== */
.contracts-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; }
.ct-card {
  background: var(--card-bg); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px 20px;
  display: flex; flex-direction: column; gap: 10px;
  box-shadow: var(--shadow-sm); transition: box-shadow 0.15s;
}
.ct-card:hover { box-shadow: var(--shadow); }
.ct-card-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.ct-client-name { font-weight: 700; font-size: 1.05rem; color: var(--text); line-height: 1.3; }
.ct-contract-num { font-size: 0.75rem; color: var(--text-muted); margin-top: 2px; }
.ct-equipment { font-size: 0.9rem; color: var(--text-secondary, #4B5563); }
.ct-location { font-size: 0.82rem; color: var(--text-muted); }
.ct-badges { display: flex; flex-wrap: wrap; gap: 6px; }
.ct-badge { font-size: 0.75rem; background: var(--bg); border: 1px solid var(--border); border-radius: 20px; padding: 3px 10px; color: var(--text-secondary, #4B5563); }
.ct-next-service { font-size: 0.84rem; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ct-days-badge { font-size: 0.72rem; border-radius: 20px; padding: 2px 8px; font-weight: 700; }
.ct-note { font-size: 0.78rem; color: var(--text-muted); border-top: 1px solid var(--border); padding-top: 8px; }
.ct-archive-tag { font-size: 0.72rem; border-radius: 20px; padding: 2px 8px; background: #F3F4F6; color: #6B7280; white-space: nowrap; }
@media (max-width: 600px) { .contracts-grid { grid-template-columns: 1fr; } }

/* ===================== SERVICE CALENDAR ===================== */
.service-day { margin-bottom: 24px; }
.service-day-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 14px; background: var(--text); color: white;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  font-weight: 600; font-size: 0.9rem;
}
.service-day-count { font-size: 0.78rem; opacity: 0.7; }
.service-card {
  background: white; border: 1px solid var(--border); border-top: none;
  padding: 16px 18px; border-left: 4px solid var(--primary);
  transition: box-shadow 0.15s;
}
.service-card:last-child { border-radius: 0 0 var(--radius-sm) var(--radius-sm); }
.service-card:hover { box-shadow: var(--shadow-md); }
.service-card.priority-border-urgent { border-left-color: var(--danger); }
.service-card.priority-border-low { border-left-color: var(--success); }
.service-card.priority-border-normal { border-left-color: var(--primary); }
.service-card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.service-card-location { font-weight: 700; font-size: 1rem; color: var(--text); }
.service-card-time { font-size: 0.82rem; color: var(--primary); font-weight: 600; margin-bottom: 6px; }
.service-card-desc { font-size: 0.875rem; color: var(--text-secondary, #4B5563); margin-bottom: 6px; line-height: 1.5; }
.service-card-workers { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 4px; }
.service-card-note { font-size: 0.78rem; color: var(--text-muted); font-style: italic; margin-bottom: 6px; }
.service-card-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border); }
.service-priority { font-size: 0.75rem; font-weight: 600; }

/* ===================== KANBAN BOARD ===================== */
/* ===== "Trello" board – pozadie krajiny + priehľadné stĺpce ===== */
#mod-kanban {
  --kanban-bg: url('kanban-bg.svg');
  background: linear-gradient(rgba(15,30,50,0.18), rgba(15,30,50,0.30)), var(--kanban-bg) center/cover no-repeat, #2b4059;
  border-radius: 14px;
  padding: 18px 20px 8px;
  min-height: calc(100vh - 120px);
  box-shadow: inset 0 0 40px rgba(0,0,0,0.15);
}
/* Prepínač pozadia */
.kbg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.kbg-thumb {
  position: relative; aspect-ratio: 16/9; border-radius: 10px; overflow: hidden;
  cursor: pointer; border: 3px solid transparent; background-size: cover; background-position: center;
  transition: transform 0.12s, border-color 0.12s; box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.kbg-thumb:hover { transform: translateY(-2px) scale(1.02); }
.kbg-thumb.active { border-color: var(--primary); }
.kbg-thumb span {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 4px 8px;
  background: linear-gradient(transparent, rgba(0,0,0,0.7)); color: #fff;
  font-size: 0.78rem; font-weight: 600;
}
.kbg-thumb.active::after {
  content: '✓'; position: absolute; top: 4px; right: 6px; color: #fff;
  background: var(--primary); border-radius: 50%; width: 22px; height: 22px;
  display: flex; align-items: center; justify-content: center; font-size: 0.8rem; font-weight: 700;
}
#mod-kanban .page-header h1 {
  color: #fff;
  text-shadow: 0 2px 12px rgba(0,0,0,0.6);
  letter-spacing: 0.3px;
}
#mod-kanban .kanban-col {
  background: rgba(241,245,250,0.86);
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.22);
}
#mod-kanban .kanban-card { background: #fff; }

.kanban-board {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding-bottom: 20px;
  align-items: flex-start;
  min-height: calc(100vh - 160px);
}
.kanban-col {
  background: #F1F5F9;
  border-radius: 12px;
  min-width: 280px;
  max-width: 280px;
  display: flex;
  flex-direction: column;
  gap: 0;
  flex-shrink: 0;
}
.kanban-col-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px 10px;
  border-radius: 12px 12px 0 0;
}
.kanban-col-title {
  font-weight: 700;
  font-size: 0.9rem;
  color: white;
  display: flex;
  align-items: center;
  gap: 8px;
}
.kanban-col-count {
  background: rgba(255,255,255,0.25);
  color: white;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 2px 8px;
}
.kanban-col-actions { display: flex; gap: 4px; }
.kanban-col-actions button {
  background: rgba(255,255,255,0.2);
  border: none;
  border-radius: 6px;
  color: white;
  cursor: pointer;
  padding: 3px 7px;
  font-size: 0.8rem;
  transition: background 0.15s;
}
.kanban-col-actions button:hover { background: rgba(255,255,255,0.35); }
.kanban-cards-list {
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 60px;
  max-height: calc(100vh - 260px);
  overflow-y: auto;
}
.kanban-cards-list.drag-over { background: rgba(99,102,241,0.08); border-radius: 8px; }
.kanban-card {
  background: white;
  border-radius: 10px;
  padding: 12px 13px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  cursor: pointer;
  transition: box-shadow 0.15s, transform 0.1s;
  border: 1.5px solid transparent;
  position: relative;
}
.kanban-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.12); transform: translateY(-1px); border-color: var(--primary-light); }
.kanban-card.dragging { opacity: 0.4; transform: rotate(2deg); }
.kanban-card-label {
  display: inline-block;
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 0.72rem;
  font-weight: 700;
  color: white;
  margin-bottom: 7px;
}
.kanban-card-title { font-weight: 600; font-size: 0.875rem; color: var(--text); line-height: 1.4; margin-bottom: 8px; }
.kanban-card-meta { display: flex; flex-wrap: wrap; gap: 8px; font-size: 0.74rem; color: var(--text-muted); align-items: center; }
.kanban-card-meta .due { display: flex; align-items: center; gap: 3px; }
.kanban-card-meta .due.overdue { color: var(--danger); font-weight: 600; }
.kanban-card-meta .assigned { display: flex; align-items: center; gap: 3px; }
.kanban-card-checklist-bar { margin-top: 8px; }
.kanban-card-checklist-bar .bar-track { background: #E5E7EB; border-radius: 4px; height: 5px; overflow: hidden; }
.kanban-card-checklist-bar .bar-fill { background: #10B981; height: 100%; border-radius: 4px; transition: width 0.3s; }
.kanban-add-card {
  margin: 4px 8px 10px;
  padding: 8px 10px;
  background: transparent;
  border: 1.5px dashed #CBD5E1;
  border-radius: 8px;
  color: #64748B;
  font-size: 0.82rem;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s, color 0.15s;
  width: calc(100% - 16px);
}
.kanban-add-card:hover { background: white; color: var(--primary); border-color: var(--primary); }
/* Card detail modal */
.modal-wide { max-width: 760px !important; width: 95vw; }
/* Checklist in modal */
.checklist-block { background: #F8FAFC; border-radius: 8px; padding: 12px 14px; margin-top: 12px; }
.checklist-block-title { font-weight: 600; font-size: 0.85rem; margin-bottom: 8px; display: flex; justify-content: space-between; align-items: center; }
.checklist-progress { font-size: 0.75rem; color: var(--text-muted); margin-bottom: 6px; }
.checklist-item { display: flex; align-items: center; gap: 8px; padding: 4px 0; }
.checklist-item input[type=checkbox] { width: 16px; height: 16px; cursor: pointer; flex-shrink: 0; }
.checklist-item label { font-size: 0.85rem; cursor: pointer; flex: 1; }
.checklist-item label.checked { text-decoration: line-through; color: var(--text-muted); }
.checklist-item .del-item { background: none; border: none; color: #CBD5E1; cursor: pointer; font-size: 0.9rem; padding: 0 4px; }
.checklist-item .del-item:hover { color: var(--danger); }
.checklist-add-row { display: flex; gap: 6px; margin-top: 8px; }
/* Color dot picker */
.color-dot {
  width: 26px; height: 26px; border-radius: 50%; cursor: pointer;
  border: 3px solid transparent; transition: transform 0.15s, border-color 0.15s;
  display: inline-block;
}
.color-dot:hover { transform: scale(1.2); }
.color-dot.selected { border-color: var(--text) !important; transform: scale(1.15); }
/* Comment */
.kanban-comment { display: flex; gap: 10px; margin-bottom: 10px; }
.kanban-comment .avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--primary); color: white; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.8rem; flex-shrink: 0; }
.kanban-comment .bubble { background: #F1F5F9; border-radius: 8px; padding: 8px 12px; flex: 1; font-size: 0.85rem; }
.kanban-comment .bubble .meta { font-size: 0.72rem; color: var(--text-muted); margin-bottom: 3px; }

@media (max-width: 768px) {
  .kanban-board { flex-direction: column; }
  .kanban-col { min-width: 100%; max-width: 100%; }
}

/* ===================== DASHBOARD EXTRAS ===================== */
.dash-alerts-bar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.dash-alert { display: flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 8px; font-size: 0.85rem; font-weight: 500; }
.dash-alert.danger { background: #FEF2F2; color: #991B1B; border: 1px solid #FCA5A5; }
.dash-alert.warning { background: #FFFBEB; color: #92400E; border: 1px solid #FCD34D; }
.dash-alert.info { background: #EFF6FF; color: #1E40AF; border: 1px solid #BFDBFE; }

.pw-reveal { display: inline-block; font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 0.82rem; background: #F1F5F9; color: #334155; border: 1px solid #E2E8F0; border-radius: 6px; padding: 3px 8px; cursor: pointer; user-select: all; transition: background 0.12s; }
.pw-reveal:hover { background: #E2E8F0; }

.badge-status { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 0.78rem; font-weight: 600; white-space: nowrap; }
.badge-status.success { background: #DCFCE7; color: #166534; }
.badge-status.warning { background: #FFFBEB; color: #92400E; }
.badge-status.danger { background: #FEF2F2; color: #991B1B; }

/* Service modal tabs */
.svc-mtab { background: none; border: none; border-bottom: 3px solid transparent; padding: 10px 16px; font-size: 0.85rem; font-weight: 600; color: var(--text-muted); cursor: pointer; transition: all 0.15s; margin-bottom: -2px; }
.svc-mtab:hover { color: var(--primary); }
.svc-mtab.active { color: var(--primary); border-bottom-color: var(--primary); }
.form-control-sm { height: 32px; padding: 4px 8px; }

/* Contract alerts grid */
.contract-alerts-grid { display: flex; flex-wrap: nowrap; gap: 10px; overflow-x: auto; padding: 12px 0 8px 0; scrollbar-width: thin; }
.contract-alerts-grid::-webkit-scrollbar { height: 4px; }
.contract-alerts-grid::-webkit-scrollbar-track { background: var(--bg); }
.contract-alerts-grid::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
.contract-alert-card { flex: 0 0 auto; min-width: 170px; max-width: 200px; background: var(--card-bg); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; cursor: pointer; transition: box-shadow 0.15s, transform 0.1s; }
.contract-alert-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.1); transform: translateY(-1px); }

.svc-mat-chip { display: inline-flex; align-items: center; gap: 3px; padding: 2px 7px; border-radius: 999px; background: var(--bg); border: 1px solid var(--border); font-size: 0.76rem; margin: 1px 2px; }
.svc-mat-chip em { font-style: normal; color: var(--text-muted); font-size: 0.72rem; }
.svc-mat-chip.ordered { background: #DCFCE7; border-color: #86efac; color: #166534; }

.dash-proj-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); cursor: pointer; transition: background 0.1s; }
.dash-proj-row:hover { background: var(--bg-secondary); margin: 0 -8px; padding: 10px 8px; border-radius: 6px; }
.dash-proj-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }

/* Creator badge on project cards */
.creator-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 20px;
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.02em;
  white-space: nowrap; flex-shrink: 0;
}

/* ===================== CSS VARIABLES EXTRA ===================== */
:root {
  --text-secondary: #4B5563;
  --bg-secondary: #F8FAFC;
}

/* ===================== EXPENSE CATEGORY BADGES ===================== */
.exp-cat-badge {
  display: inline-block; padding: 2px 8px; border-radius: 20px;
  font-size: 0.72rem; font-weight: 700; color: #fff; white-space: nowrap;
}
.exp-cat-btn {
  padding: 4px 12px; border-radius: 20px; border: 1.5px solid var(--border);
  background: #fff; cursor: pointer; font-size: 0.8rem; font-weight: 500;
  transition: all 0.15s; white-space: nowrap;
}
.exp-cat-btn:hover { border-color: var(--primary); color: var(--primary); }
.exp-cat-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.exp-calc-box {
  background: #f0f8ff; border: 1.5px solid #bdd7f5; border-radius: 10px;
  padding: 12px 16px; margin-bottom: 12px;
}

/* ===================== SHARED CALENDAR ===================== */
.shared-cal-table { width: 100%; border-collapse: collapse; min-width: 700px; }
.shared-cal-table th {
  background: var(--primary); color: #fff; padding: 6px; text-align: center;
  font-size: 0.8rem; font-weight: 600;
}
.shared-cal-day {
  border: 1px solid var(--border); padding: 4px 5px; vertical-align: top;
  min-width: 90px; min-height: 60px; font-size: 0.75rem;
}
.shared-cal-day.weekend { background: #fafafa; }
.shared-cal-day.today { background: #eff6ff; outline: 2px solid var(--primary); }
.cal-day-num { font-weight: 700; font-size: 0.82rem; color: var(--text-muted); margin-bottom: 3px; }
.cal-day-events { display: flex; flex-direction: column; gap: 2px; }
.cal-dot {
  padding: 1px 5px; border-radius: 4px; font-size: 0.7rem; color: #fff;
  font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  cursor: default; max-width: 100%;
}
.cal-dot.svc { cursor: pointer; }
.cal-dot.svc:hover { opacity: 0.85; }

/* ===================== WAREHOUSE GRID ===================== */
.wh-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; }
.wh-card {
  display: flex; flex-direction: column; gap: 8px;
  padding: 16px; border-radius: 12px; border: 1.5px solid var(--border);
  background: #fff; transition: border-color 0.15s, box-shadow 0.15s;
}
.wh-card:hover { border-color: var(--primary); box-shadow: var(--shadow-md); }
.wh-card-low { border-color: #EF4444 !important; background: #fff5f5; }
.wh-card-zero { border-color: #D1D5DB; background: #F9FAFB; }
.wh-card-top { display: flex; align-items: flex-start; gap: 10px; }
.wh-card-icon { font-size: 1.8rem; flex-shrink: 0; line-height: 1; }
.wh-card-info { flex: 1; min-width: 0; }
.wh-card-name { font-weight: 700; font-size: 0.92rem; color: var(--text); }
.wh-card-meta { font-size: 0.76rem; color: var(--text-muted); margin-top: 2px; }
.wh-card-stock { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding: 4px 0; }
.wh-stock-number { font-size: 1.6rem; font-weight: 800; line-height: 1; }
.wh-stock-ok { color: #16A34A; }
.wh-stock-low { color: #EF4444; }
.wh-stock-zero { color: #9CA3AF; }
.wh-stock-unit { font-size: 0.85rem; font-weight: 500; color: var(--text-muted); }
.wh-stock-price { font-size: 0.78rem; color: var(--text-muted); text-align: right; }
.wh-bar-wrap { height: 5px; background: #F3F4F6; border-radius: 99px; overflow: hidden; }
.wh-bar-fill { height: 100%; border-radius: 99px; transition: width 0.4s; }
.wh-card-alert { font-size: 0.76rem; font-weight: 700; color: #EF4444; }
.wh-card-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; padding-top: 8px; border-top: 1px solid var(--border); }
.wh-card-actions .btn { flex: 1; min-width: 0; font-size: 0.78rem; padding: 5px 8px; }

/* Warehouse transactions */
.wh-tx-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.wh-tx-row:last-child { border-bottom: none; }
.wh-tx-badge { font-size: 0.75rem; font-weight: 700; padding: 4px 10px; border-radius: 20px; white-space: nowrap; flex-shrink: 0; }
.wh-tx-prijem { background: #DCFCE7; color: #15803D; }
.wh-tx-vydaj { background: #FEF3C7; color: #92400E; }
.wh-tx-info { flex: 1; min-width: 0; }
.wh-tx-name { font-weight: 600; font-size: 0.88rem; }
.wh-tx-meta { font-size: 0.76rem; color: var(--text-muted); margin-top: 2px; }
.wh-tx-right { text-align: right; flex-shrink: 0; }
.wh-tx-qty { font-size: 1rem; font-weight: 800; }
.wh-tx-qty.wh-tx-prijem { color: #15803D; }
.wh-tx-qty.wh-tx-vydaj { color: #D97706; }
.wh-tx-date { font-size: 0.73rem; color: var(--text-muted); margin-top: 2px; }
.wh-tx-row-req { background: #F5F3FF; border-radius: 8px; padding: 10px 8px; margin: 2px 0; }
.wh-tx-source-badge { font-size: 0.7rem; font-weight: 700; background: #EDE9FE; color: #6D28D9; padding: 2px 7px; border-radius: 10px; vertical-align: middle; margin-left: 6px; }
.wh-tx-type-banner { padding: 8px 12px; border-radius: 8px; font-size: 0.82rem; font-weight: 600; margin-bottom: 12px; }
.btn-success { background: #22C55E; color: #fff; border: none; }
.btn-success:hover { background: #16A34A; }
.btn-warning { background: #F59E0B; color: #fff; border: none; }
.btn-warning:hover { background: #D97706; }

/* ===================== REQUISITIONS ===================== */
.req-row { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:12px 0; border-bottom:1px solid var(--border); cursor:pointer; transition:background 0.1s; border-radius:6px; }
.req-row:last-child { border-bottom:none; }
.req-row:hover { background:var(--primary-light); padding-left:8px; padding-right:8px; }
.req-row-main { flex:1; min-width:0; }
.req-project { font-weight:700; font-size:0.95rem; }
.req-meta { font-size:0.76rem; color:var(--text-muted); margin-top:3px; }
.req-row-right { display:flex; align-items:center; gap:8px; flex-shrink:0; }
.req-badge { font-size:0.72rem; font-weight:700; padding:3px 9px; border-radius:20px; white-space:nowrap; }
.req-pending   { background:#FEF3C7; color:#92400E; }
.req-preparing { background:#DBEAFE; color:#1E40AF; }
.req-ready     { background:#DCFCE7; color:#15803D; }
.req-issued    { background:#F3F4F6; color:#374151; }
.req-cancelled { background:#FEE2E2; color:#991B1B; }

/* Requisition item row in form */
.req-item-row { display:flex; align-items:center; gap:8px; margin-bottom:8px; }
.req-item-name-wrap { flex:1; position:relative; }
.req-suggest-drop { position:absolute; top:100%; left:0; right:0; z-index:200; background:#fff; border:1px solid var(--border); border-radius:8px; box-shadow:var(--shadow-md); max-height:200px; overflow-y:auto; }
.req-suggest-item { display:flex; justify-content:space-between; align-items:center; padding:8px 12px; cursor:pointer; font-size:0.82rem; gap:10px; }
.req-suggest-item:hover { background:var(--primary-light); }
.req-suggest-low { opacity:0.75; }

/* Checklist */
.req-checklist { display:flex; flex-direction:column; gap:6px; }
.req-check-row { display:flex; align-items:center; gap:10px; padding:10px 12px; border-radius:8px; background:var(--bg); transition:background 0.15s; }
.req-check-done { background:#F0FDF4; }
.req-checkbox { width:18px; height:18px; cursor:pointer; flex-shrink:0; accent-color:var(--success); }
.req-check-icon { font-size:1.1rem; flex-shrink:0; }
.req-check-info { flex:1; }
.req-check-name { font-weight:600; font-size:0.88rem; }
.req-check-qty { font-size:0.78rem; color:var(--text-muted); margin-top:2px; }

/* Low stock */
.low-stock-row { display:flex; align-items:center; gap:12px; padding:12px 0; border-bottom:1px solid var(--border); }
.low-stock-row:last-child { border-bottom:none; }
.low-stock-icon { font-size:1.6rem; flex-shrink:0; }
.low-stock-info { flex:1; min-width:0; }
.low-stock-name { font-weight:700; font-size:0.9rem; }
.low-stock-meta { font-size:0.76rem; color:var(--text-muted); margin-top:2px; }
.low-stock-nums { text-align:right; flex-shrink:0; }
.ls-needed { font-size:0.75rem; color:var(--primary); }
.ls-toolbar { display:flex; justify-content:space-between; align-items:center; flex-wrap:wrap; gap:10px; padding:10px 0 14px; border-bottom:1px solid var(--border); margin-bottom:14px; }
.ls-supplier-group { margin-bottom:18px; }
.ls-supplier-header { display:flex; align-items:center; gap:8px; font-weight:700; font-size:0.85rem; color:var(--text-muted); padding:6px 0 8px; border-bottom:1px solid var(--border); margin-bottom:4px; }
.ls-selectable { display:flex; align-items:center; gap:12px; padding:10px 8px; border-radius:8px; cursor:pointer; transition:background 0.12s; }
.ls-selectable:hover { background:var(--primary-light); }
.ls-selectable:has(.ls-item-check:checked) { background:#EFF6FF; }

/* ===================== TOOL LOANS ===================== */
.loan-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.loan-row:last-child { border-bottom: none; }
.loan-row-overdue { background: #FFF7ED; border-radius: 8px; padding: 12px; margin: 4px 0; border-bottom: none; outline: 1.5px solid #FED7AA; }
.loan-row-lost { background: #FEF2F2; border-radius: 8px; padding: 12px; margin: 4px 0; border-bottom: none; outline: 1.5px solid #FECACA; }
.loan-row-returned { opacity: 0.72; }
.loan-main { flex: 1; min-width: 0; }
.loan-item-name { font-size: 1rem; font-weight: 700; color: var(--text); }
.loan-worker { font-size: 0.85rem; margin-top: 3px; }
.loan-dates { font-size: 0.78rem; color: var(--text-muted); margin-top: 4px; }
.loan-note { font-size: 0.76rem; color: var(--text-muted); margin-top: 3px; font-style: italic; }
.loan-right { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; flex-shrink: 0; }
.loan-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.loan-badge { font-size: 0.75rem; font-weight: 700; padding: 4px 10px; border-radius: 20px; white-space: nowrap; }
.loan-active { background: #DCFCE7; color: #15803D; }
.loan-overdue { background: #FEF3C7; color: #92400E; }
.loan-returned { background: #F3F4F6; color: #374151; }
.loan-lost { background: #FEE2E2; color: #991B1B; }

/* ===================== EMOJI PICKER ===================== */
.btn-emoji {
  padding: 6px 10px; font-size: 1.1rem; line-height: 1;
  border-radius: var(--radius-sm); flex-shrink: 0;
}
.emoji-picker {
  position: absolute; bottom: 60px; left: 0; z-index: 200;
  background: #fff; border: 1.5px solid var(--border); border-radius: 12px;
  padding: 10px; width: 300px; box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  display: flex; flex-wrap: wrap; gap: 4px;
}
.emoji-picker.hidden { display: none; }
.emoji-item {
  font-size: 1.4rem; cursor: pointer; padding: 4px 6px;
  border-radius: 6px; transition: background 0.1s; line-height: 1;
}
.emoji-item:hover { background: var(--bg); }

/* Kanban context menu */
.ctx-menu {
  position: fixed; z-index: 9999;
  background: var(--card-bg); border: 1px solid var(--border);
  border-radius: var(--radius-sm); box-shadow: var(--shadow-lg);
  min-width: 180px; padding: 4px 0; font-size: 0.875rem;
}
.ctx-item { padding: 9px 16px; cursor: pointer; display:flex; align-items:center; gap:8px; color:var(--text); transition:background 0.1s; }
.ctx-item:hover { background: var(--primary-light); color: var(--primary); }
.ctx-item.ctx-danger:hover { background: #FEE2E2; color: var(--danger); }
.ctx-divider { height: 1px; background: var(--border); margin: 4px 0; }

.kanban-card-menu-btn {
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); font-size: 1rem; padding: 0 4px;
  border-radius: 4px; line-height: 1; opacity: 0; transition: opacity 0.15s; flex-shrink: 0;
}
.kanban-card:hover .kanban-card-menu-btn { opacity: 1; }
.kanban-card-menu-btn:hover { background: var(--border); color: var(--text); }

.checklist-badge { font-size: 0.72rem; background: var(--border); border-radius: 4px; padding: 1px 5px; color: var(--text-muted); }
.checklist-badge.done { background: #D1FAE5; color: #065F46; }

/* Pagination */
.pager { display:flex; align-items:center; justify-content:space-between; padding:12px 0 4px; flex-wrap:wrap; gap:8px; }
.pager-info { font-size:0.8rem; color:var(--text-muted); }
.pager-btns { display:flex; gap:4px; }

/* Project files */
.files-grid { display:flex; flex-wrap:wrap; gap:12px; }
.file-item { display:flex; flex-direction:column; align-items:center; gap:4px; width:90px; }
.file-thumb { width:80px; height:80px; object-fit:cover; border-radius:8px; cursor:zoom-in; border:2px solid var(--border); transition:border-color 0.15s; }
.file-thumb:hover { border-color:var(--primary); }
.file-icon { width:80px; height:80px; display:flex; flex-direction:column; align-items:center; justify-content:center; border:2px solid var(--border); border-radius:8px; cursor:pointer; font-size:2rem; }
.file-icon-name { font-size:0.6rem; color:var(--text-muted); margin-top:2px; text-align:center; }
.file-icon:hover { border-color:var(--primary); background:#f0f8ff; }
.file-item-name { font-size:0.7rem; color:var(--text-muted); text-align:center; max-width:90px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }

/* Project contacts */
.contacts-grid { display:flex; flex-direction:column; gap:10px; }
.contact-card { display:flex; align-items:flex-start; gap:14px; padding:14px 16px; background:var(--bg-secondary,#f8fafc); border-radius:12px; border:1px solid var(--border); position:relative; }
.contact-avatar { width:44px; height:44px; border-radius:50%; background:var(--primary); color:#fff; display:flex; align-items:center; justify-content:center; font-size:1.2rem; font-weight:700; flex-shrink:0; }
.contact-info { flex:1; display:flex; flex-direction:column; gap:3px; }
.contact-name { font-weight:700; font-size:0.95rem; color:var(--text); }
.contact-role { font-size:0.8rem; color:var(--primary); font-weight:600; }
.contact-link { font-size:0.82rem; color:var(--text-muted); text-decoration:none; }
.contact-link:hover { color:var(--primary); text-decoration:underline; }
.contact-note { font-size:0.8rem; color:var(--text-muted); font-style:italic; margin-top:2px; }
.contact-del { position:absolute; top:10px; right:10px; }

/* Photo diary */
.photo-diary-list { display:flex; flex-direction:column; gap:16px; }
.photo-diary-entry { background:var(--bg-secondary,#f8fafc); border-radius:12px; border:1px solid var(--border); overflow:hidden; }
.photo-diary-header { display:flex; align-items:center; justify-content:space-between; padding:12px 16px; background:var(--bg); border-bottom:1px solid var(--border); }
.photo-diary-date { font-weight:700; font-size:0.95rem; }
.photo-diary-note { font-size:0.85rem; color:var(--text-muted); }
.photo-diary-photos { display:flex; flex-wrap:wrap; gap:10px; padding:14px 16px; }
.pd-photo-cell { position:relative; }
.pd-photo-thumb { width:100px; height:100px; object-fit:cover; border-radius:8px; cursor:zoom-in; border:2px solid var(--border); display:block; transition:border-color 0.15s; }
.pd-photo-thumb:hover { border-color:var(--primary); }
.pd-photo-cell .diary-photo-del { position:absolute; top:4px; right:4px; }

/* Dashboard enhanced */
.dash-health-bar { display:flex; gap:12px; flex-wrap:wrap; background:var(--bg-secondary,#f8fafc); border-radius:14px; padding:16px; margin-bottom:16px; border:1px solid var(--border); }
.health-card { flex:1; min-width:140px; display:flex; flex-direction:column; gap:4px; }
.health-label { font-size:0.72rem; color:var(--text-muted); text-transform:uppercase; letter-spacing:0.05em; }
.health-value { font-size:1.35rem; font-weight:800; color:var(--text); line-height:1.1; }
.health-sub { font-size:0.75rem; color:var(--text-muted); }
.health-bar-wrap { height:8px; background:var(--border); border-radius:4px; overflow:hidden; margin:4px 0; }
.health-bar-fill { height:100%; border-radius:4px; transition:width 0.4s; }

.dash-charts-row { display:grid; grid-template-columns: 1fr 1fr 1fr; gap:16px; margin-bottom:16px; }
@media(max-width:900px) { .dash-charts-row { grid-template-columns:1fr 1fr; } }
@media(max-width:600px) { .dash-charts-row { grid-template-columns:1fr; } }

.dash-main-grid { display:grid; grid-template-columns:1fr 1fr 1fr; gap:16px; }
@media(max-width:1100px) { .dash-main-grid { grid-template-columns:1fr 1fr; } }
@media(max-width:700px) { .dash-main-grid { grid-template-columns:1fr; } }

/* Contract file */
.ct-file { margin-top:8px; }
.ct-file-thumb { width:80px; height:60px; object-fit:cover; border-radius:6px; cursor:zoom-in; border:2px solid var(--border); }

/* Invoice item autocomplete */
.item-suggest-dropdown { position:absolute; top:100%; left:0; right:0; background:var(--bg); border:1px solid var(--border); border-radius:8px; box-shadow:0 4px 16px rgba(0,0,0,0.12); z-index:999; max-height:220px; overflow-y:auto; }
.item-suggest-item { display:flex; justify-content:space-between; align-items:center; padding:8px 12px; cursor:pointer; gap:8px; border-bottom:1px solid var(--border); }
.item-suggest-item:last-child { border-bottom:none; }
.item-suggest-item:hover { background:var(--primary-light,#EFF6FF); }
.item-suggest-name { font-size:0.875rem; color:var(--text); flex:1; }
.item-suggest-price { font-size:0.82rem; font-weight:700; color:var(--primary); white-space:nowrap; }

/* ===== MY CALENDAR ===== */
.mycal-header-row { display:grid; grid-template-columns:repeat(7,1fr); gap:2px; margin-bottom:4px; }
.mycal-dow { text-align:center; font-size:0.78rem; font-weight:600; color:var(--text-muted); padding:4px 0; }
.mycal-days { display:grid; grid-template-columns:repeat(7,1fr); gap:3px; }
.mycal-cell { min-height:80px; border:1px solid var(--border); border-radius:6px; padding:3px 3px 4px; transition:background 0.15s; position:relative; overflow:hidden; }
.mycal-cell:hover { background:var(--primary-light,#EFF6FF); }
.mycal-cell.mycal-empty { border:none; cursor:default; background:none; }
.mycal-cell.mycal-today { border-color:var(--primary); background:rgba(0,102,204,0.05); }
.mycal-cell-top { display:flex; justify-content:space-between; align-items:center; margin-bottom:2px; }
.mycal-day-num { font-size:0.8rem; font-weight:600; color:var(--text); padding:1px 3px; }
.mycal-today .mycal-day-num { background:var(--primary); color:#fff; border-radius:50%; width:20px; height:20px; display:flex; align-items:center; justify-content:center; font-size:0.75rem; }
.mycal-add-btn { font-size:0.9rem; color:var(--text-muted); cursor:pointer; padding:0 4px; line-height:1; border-radius:3px; display:none; }
.mycal-cell:hover .mycal-add-btn { display:block; }
.mycal-add-btn:hover { background:var(--primary); color:#fff; }
.mycal-event-bar { font-size:0.7rem; font-weight:500; color:#fff; border-radius:3px; padding:1px 5px; margin-bottom:2px; cursor:pointer; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; transition:filter 0.15s; }
.mycal-event-bar:hover { filter:brightness(0.88); }
.mycal-more-bar { font-size:0.68rem; color:var(--text-muted); padding:1px 4px; }
.mycal-upcoming-item { display:flex; align-items:flex-start; gap:10px; padding:12px 16px; border-bottom:1px solid var(--border); cursor:pointer; transition:background 0.15s; }
.mycal-upcoming-item:last-child { border-bottom:none; }
.mycal-upcoming-item:hover { background:var(--primary-light,#EFF6FF); }
.mycal-upcoming-color { width:4px; min-height:36px; border-radius:3px; flex-shrink:0; margin-top:2px; }

/* ===================== MOBILE OPTIMIZATION (PWA) ===================== */
@media (max-width: 768px) {

  /* --- Safe areas (iPhone notch) --- */
  .mobile-header { padding-top: env(safe-area-inset-top); height: calc(var(--header-h) + env(safe-area-inset-top)); }
  .main-content { padding-top: calc(var(--header-h) + env(safe-area-inset-top) + 12px); padding-left: 12px; padding-right: 12px; padding-bottom: calc(24px + env(safe-area-inset-bottom)); }
  .sidebar { padding-top: env(safe-area-inset-top); z-index: 200; }

  /* --- Mobile header bell --- */
  .mobile-bell { font-size: 1.3rem; padding: 8px; }
  .hamburger { min-width: 44px; min-height: 44px; }

  /* --- Touch targets --- */
  .btn { min-height: 42px; padding: 10px 16px; }
  .btn-sm { min-height: 36px; }
  .btn-xs { min-height: 32px; }
  .nav-item { padding: 13px 16px; font-size: 0.95rem; }
  .modal-close { min-width: 42px; min-height: 42px; font-size: 1.3rem; }
  .tab { min-height: 40px; }

  /* --- Inputs: 16px prevents iOS auto-zoom on focus --- */
  .form-control, input, select, textarea { font-size: 16px !important; }
  .form-control { padding: 11px 12px; }

  /* --- Modals become bottom sheets --- */
  .modal-overlay { padding: 0; align-items: flex-end; }
  .modal, .modal-wide { max-width: 100% !important; width: 100% !important; max-height: 94dvh; border-radius: 16px 16px 0 0; }
  .modal-body { padding: 16px; -webkit-overflow-scrolling: touch; }
  .modal-header { padding: 14px 16px; }
  .modal-footer { padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); flex-wrap: wrap; }
  .modal-footer .btn { flex: 1; justify-content: center; }

  /* --- Notification panel full width --- */
  .notif-panel { width: 100vw; border-left: none; }

  /* --- Tabs: horizontal scroll instead of cramped wrap --- */
  .tabs { width: 100%; overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tabs .tab { white-space: nowrap; flex-shrink: 0; }

  /* --- Page headers stack --- */
  .page-header h1 { font-size: 1.25rem; }
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1; justify-content: center; min-width: 0; }

  /* --- Tables scroll horizontally inside cards --- */
  .card-body { padding: 14px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .data-table { min-width: 560px; }
  .card-header { padding: 12px 14px; flex-wrap: wrap; }

  /* --- Dashboards --- */
  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi-card { padding: 12px; }
  .dash-charts-row { grid-template-columns: 1fr; }
  .dash-main-grid { grid-template-columns: 1fr; }

  /* --- Personal calendar: compact cells --- */
  .mycal-cell { min-height: 56px; padding: 2px; }
  .mycal-event-bar { font-size: 0.58rem; padding: 1px 3px; }
  .mycal-add-btn { display: none !important; } /* on touch use day tap */
  .mycal-daynum { font-size: 0.72rem; }

  /* --- Service & contracts --- */
  .contracts-grid { grid-template-columns: 1fr; }
  .contract-alert-card { min-width: 150px; }
  .service-card-top { flex-wrap: wrap; gap: 6px; }
  .svc-filters-row { flex-direction: column; align-items: flex-start !important; }
  .svc-filters-row > div { margin-left: 0 !important; }

  /* --- Messages / chat --- */
  .messages-layout { height: auto; }

  /* --- Photo grids --- */
  .diary-photo-grid { grid-template-columns: repeat(auto-fill, minmax(100px,1fr)); }
  .diary-thumb { width: 76px; height: 76px; }

  /* --- Login --- */
  .login-card { border-radius: 0; min-height: 100dvh; }
  .login-right { padding: 24px 20px; }

  /* --- Toast above thumb zone --- */
  .toast-container { bottom: calc(16px + env(safe-area-inset-bottom)); left: 12px; right: 12px; }
  .toast { max-width: 100%; }
}

@media (max-width: 480px) {
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .inv-item { grid-template-columns: 1fr; }
  .page-header h1 { font-size: 1.15rem; }
  .mycal-cell { min-height: 48px; }
  /* Events as thin colored strips (no text) on tiny screens */
  .mycal-event-bar { font-size: 0; height: 5px; padding: 0; border-radius: 3px; margin-bottom: 2px; }
  .mycal-cell .mycal-more-bar { font-size: 0.55rem; }
}

/* Standalone PWA mode (installed on home screen) */
@media (display-mode: standalone) {
  body { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
  input, textarea, [contenteditable] { -webkit-user-select: text; user-select: text; }
}

/* ===================== MODULE HINTS (nápoveda) ===================== */
details.module-hint {
  background: #EFF6FF; border: 1px solid #BFDBFE; border-radius: 10px;
  padding: 0; margin-bottom: 14px; font-size: 0.83rem; color: #1E40AF;
}
details.module-hint summary {
  cursor: pointer; font-weight: 600; padding: 9px 14px; list-style: none;
  display: flex; align-items: center; gap: 6px; user-select: none;
}
details.module-hint summary::-webkit-details-marker { display: none; }
details.module-hint summary::after { content: '▸'; margin-left: auto; transition: transform 0.15s; }
details.module-hint[open] summary::after { transform: rotate(90deg); }
details.module-hint .hint-body { padding: 0 14px 10px; line-height: 1.55; }
details.module-hint .hint-body ul { margin: 4px 0 0 18px; padding: 0; }
details.module-hint .hint-body li { margin-bottom: 3px; }
details.module-hint .hint-badge-demo { display: inline-block; padding: 0 6px; border-radius: 99px; font-size: 0.72rem; font-weight: 700; }
