/* ── CSS Variables — Dark (default) ────────────────────────────────────────── */
:root {
  /* Nomadime dark navy theme — deeper dark */
  --bg:        #070C18;
  --surface:   #0E1625;
  --surface2:  #131E30;
  --surface3:  #111A2C;
  --border:    #1B2840;
  --border2:   #243252;
  --text:      #E8EDF5;
  --text2:     #8BA3CC;
  --text3:     #4D6A99;

  /* Blue — primary brand accent (replaces teal) */
  --teal:      #4A7EFF;
  --teal-l:    #7EB5FF;
  --teal-t:    #6BAAFF;
  --teal-bg:   #0A1840;

  /* Blue secondary / gradient end */
  --blue:      #2855D0;
  --blue-bg:   #081230;

  /* Orange — warnings & highlights */
  --orange:    #F5A623;
  --orange-bg: #2E1A00;

  /* Danger */
  --red:       #FF6B6B;
  --red-bg:    #2E1515;
  --red-brd:   #5A2020;
}

.light-mode {
  /* Nomadime light — clean blue-white */
  --bg:        #EEF2FA;
  --surface:   #FFFFFF;
  --surface2:  #F0F5FF;
  --surface3:  #E5EDF8;
  --border:    #C5D3E8;
  --border2:   #A8BCE0;
  --text:      #0D1528;
  --text2:     #2E4472;
  --text3:     #6B82A8;

  --teal:      #2855D0;
  --teal-l:    #4A7EFF;
  --teal-t:    #1A3AB0;
  --teal-bg:   #D8E8FF;

  --blue:      #1A3AB0;
  --blue-bg:   #D0DCFF;

  --orange:    #D4880A;
  --orange-bg: #FFF0D0;

  --red:       #C03030;
  --red-bg:    #FFE8E8;
  --red-brd:   #E8BBBB;
}

/* ── Login page always dark ─────────────────────────────────────────────────── */
.light-mode #login-screen {
  --bg:        #070C18;
  --surface:   #0E1625;
  --surface2:  #131E30;
  --surface3:  #111A2C;
  --border:    #1B2840;
  --border2:   #243252;
  --text:      #E8EDF5;
  --text2:     #8BA3CC;
  --text3:     #4D6A99;
  --teal:      #4A7EFF;
  --teal-l:    #7EB5FF;
  --teal-t:    #6BAAFF;
  --teal-bg:   #0A1840;
  --blue:      #2855D0;
  --blue-bg:   #081230;
  --orange:    #F5A623;
  --orange-bg: #2E1A00;
  --red:       #FF6B6B;
  --red-bg:    #2E1515;
  --red-brd:   #5A2020;
}

/* ── Base ───────────────────────────────────────────────────────────────────── */
html, body, #app { height:100%; }
body { margin:0; overflow:hidden; background:var(--bg); color:var(--text);
       font-family:system-ui,-apple-system,sans-serif; }
* { box-sizing:border-box; }
.hidden { display:none !important; }

/* ── Nav items ─────────────────────────────────────────────────────────────── */
.nav-item {
  display:flex; align-items:center; gap:8px; padding:7px 10px; border-radius:8px;
  font-size:13px; color:var(--text2); text-decoration:none; transition:all 0.15s;
  white-space:nowrap; cursor:pointer; background:transparent; border:none;
  width:100%; text-align:left;
}
.nav-item:hover  { background:var(--surface2); color:var(--text); }
.nav-item.active { background:var(--teal-bg);  color:var(--teal-t); font-weight:500; }
.nav-item.active i { color:var(--teal-t); }

/* ── Cards ─────────────────────────────────────────────────────────────────── */
.crm-card {
  background:var(--surface); border:1.5px solid transparent;
  outline:0.5px solid var(--border); border-radius:4px; padding:14px;
  cursor:pointer; transition:all 0.15s;
  width:280px; min-width:280px; max-width:280px; box-sizing:border-box;
}
.crm-card:hover    { outline-color:var(--border2); box-shadow:0 2px 12px rgba(74,127,255,0.08); }
.crm-card.selected { border-color:var(--teal); outline-color:transparent;
                     box-shadow:0 2px 20px rgba(74,127,255,0.15); }
.card-grid { display:flex; flex-wrap:wrap; gap:14px; padding:20px 24px; align-content:flex-start; }

/* ── View layout ───────────────────────────────────────────────────────────── */
.view-body   { flex:1; display:flex; overflow:hidden; }
.view-scroll { flex:1; overflow-y:auto; overflow-x:hidden; }

/* ── Detail panel ──────────────────────────────────────────────────────────── */
.detail-panel {
  width:360px; min-width:360px; background:var(--surface);
  border-left:0.5px solid var(--border); overflow-y:auto;
  padding:20px 18px; flex-shrink:0;
}
@media (max-width:900px) {
  .detail-panel { position:fixed; right:0; top:0; bottom:0; z-index:50;
                  box-shadow:-4px 0 32px rgba(0,0,0,0.4); }
}

/* ── Kanban ─────────────────────────────────────────────────────────────────── */
.kanban-board { display:flex; gap:12px; padding:16px 20px; height:100%;
                overflow-x:auto; overflow-y:hidden; align-items:flex-start; }
.kanban-col   { width:260px; min-width:260px; flex-shrink:0; display:flex;
                flex-direction:column; max-height:100%; }
.kanban-header{ padding:10px 12px; border-radius:4px 4px 0 0; margin-bottom:8px; flex-shrink:0; }
.kanban-cards { flex:1; overflow-y:auto; display:flex; flex-direction:column;
                gap:8px; padding-bottom:8px; }
.kanban-card  {
  background:var(--surface); border:1.5px solid transparent;
  outline:0.5px solid var(--border); border-radius:4px; padding:12px;
  cursor:pointer; transition:all 0.15s;
}
.kanban-card:hover    { outline-color:var(--border2); }
.kanban-card.selected { border-color:var(--teal); outline-color:transparent; }

/* ── Modal ──────────────────────────────────────────────────────────────────── */
.modal-overlay {
  position:fixed; inset:0; background:rgba(7,14,32,0.7);
  display:flex; align-items:center; justify-content:center; z-index:100; padding:16px;
  backdrop-filter:blur(2px);
}
.modal-box {
  background:var(--surface); border-radius:6px; padding:28px;
  width:100%; max-width:560px; max-height:90vh; overflow-y:auto;
  border:0.5px solid var(--border2);
  box-shadow:0 8px 48px rgba(0,0,0,0.4);
}
@media (max-width:600px) { .modal-box { padding:20px; border-radius:6px; } }

/* ── Forms ──────────────────────────────────────────────────────────────────── */
.f-inp, .f-sel, .f-area {
  width:100%; padding:9px 11px; border-radius:8px;
  border:0.5px solid var(--border2); background:var(--surface2);
  color:var(--text); font-size:14px; outline:none;
  margin-bottom:10px; box-sizing:border-box; font-family:inherit;
  transition:border-color 0.15s, box-shadow 0.15s;
}
.f-inp:focus, .f-sel:focus, .f-area:focus {
  border-color:var(--teal); box-shadow:0 0 0 3px rgba(74,127,255,0.12);
}
.f-area { resize:vertical; min-height:72px; }
.f-row  { display:flex; gap:10px; }
.f-row .f-inp, .f-row .f-sel { flex:1; min-width:0; }
.f-sec {
  font-size:11px; font-weight:600; color:var(--text3);
  text-transform:uppercase; letter-spacing:0.8px;
  margin:14px 0 8px; border-top:0.5px solid var(--border); padding-top:12px;
}
.f-sec:first-child { border-top:none; padding-top:0; margin-top:0; }
.f-label { font-size:11px; color:var(--text3); margin-bottom:3px; }
.f-contact-group { background:var(--surface2); border-radius:4px; padding:12px; margin-bottom:10px; }
.f-contact-title { font-size:11px; font-weight:600; color:var(--text3);
                   text-transform:uppercase; letter-spacing:0.8px; margin-bottom:8px; }

/* ── Buttons ────────────────────────────────────────────────────────────────── */
.btn      { padding:8px 18px; border-radius:8px; font-size:13px; font-weight:600;
            cursor:pointer; border:none; transition:all 0.15s; white-space:nowrap; }
.btn-teal { background:linear-gradient(135deg, var(--teal) 0%, var(--blue) 100%);
            color:#fff; box-shadow:0 2px 12px rgba(74,127,255,0.30); }
.btn-teal:hover { filter:brightness(1.1); box-shadow:0 4px 20px rgba(74,127,255,0.42); }
.btn-out  { background:transparent; border:0.5px solid var(--border2); color:var(--text2); }
.btn-out:hover { background:var(--surface2); color:var(--text); border-color:var(--teal); }
.btn-red  { background:var(--red-bg); color:var(--red); border:0.5px solid var(--red-brd); }
.btn-red:hover { filter:brightness(1.12); }
.btn-sm   { padding:5px 12px; font-size:12px; }
.btn:disabled { opacity:0.5; cursor:not-allowed; }

/* ── Badges ─────────────────────────────────────────────────────────────────── */
.badge { display:inline-block; padding:2px 8px; border-radius:20px; font-size:11px; font-weight:500; }
.tag   { background:var(--teal-bg); color:var(--teal-t); }

/* ── Timer ──────────────────────────────────────────────────────────────────── */
#timer-display {
  font-size:clamp(36px,8vw,64px); font-weight:700;
  font-variant-numeric:tabular-nums; letter-spacing:-2px; line-height:1;
  background:linear-gradient(135deg, var(--teal-t) 0%, var(--blue) 100%);
  -webkit-background-clip:text; -webkit-text-fill-color:transparent;
  background-clip:text;
}

/* ── Detail field ───────────────────────────────────────────────────────────── */
.df-label { font-size:11px; font-weight:500; color:var(--text3);
            text-transform:uppercase; letter-spacing:0.8px; margin-bottom:2px; margin-top:12px; }
.df-value { font-size:14px; color:var(--text); }
.df-group { background:var(--surface2); border-radius:4px;
            padding:12px 14px; margin-top:10px; border:0.5px solid var(--border); }

/* ── Status pill ────────────────────────────────────────────────────────────── */
.status-pill { display:inline-block; padding:3px 10px; border-radius:20px;
               font-size:12px; font-weight:600; }

/* ── Profile section title ──────────────────────────────────────────────────── */
.pv-section-title {
  font-weight:600; font-size:13px; color:var(--text3);
  text-transform:uppercase; letter-spacing:.7px; margin-bottom:14px;
}

/* ── Stat card ──────────────────────────────────────────────────────────────── */
.stat-card {
  background:var(--surface); border:0.5px solid var(--border);
  border-radius:4px; padding:16px; transition:all 0.15s;
}
.stat-card:hover { border-color:var(--border2); }

/* ── Topbar ─────────────────────────────────────────────────────────────────── */
.topbar {
  background:var(--surface); border-bottom:0.5px solid var(--border);
  padding:0 16px; height:60px; display:flex; align-items:center; gap:8px;
  flex-shrink:0; z-index:10;
}
/* Global topbar needs its own stacking context above all view topbars */
#global-topbar { position:relative; z-index:20; }
/* Global search bar */
.topbar-search {
  flex:1; max-width:520px; display:flex; align-items:center; gap:8px;
  background:var(--surface2); border:0.5px solid var(--border2);
  border-radius:10px; padding:0 12px; height:38px; cursor:text;
  transition:border-color 0.15s, box-shadow 0.15s;
}
.topbar-search:focus-within {
  border-color:var(--teal); box-shadow:0 0 0 3px rgba(74,127,255,0.12);
}
.topbar-search i { color:var(--text3); font-size:13px; flex-shrink:0; }
.topbar-search input {
  flex:1; border:none; background:transparent; color:var(--text);
  font-size:13px; outline:none; min-width:0;
}
.topbar-search input::placeholder { color:var(--text3); }
.topbar-search kbd {
  font-size:10px; color:var(--text3); background:var(--surface3);
  border:0.5px solid var(--border2); border-radius:4px;
  padding:1px 5px; font-family:inherit; flex-shrink:0;
}
/* Icon buttons in topbar */
.tb-icon {
  width:34px; height:34px; border-radius:9px; border:0.5px solid var(--border2);
  background:transparent; cursor:pointer; display:flex; align-items:center;
  justify-content:center; color:var(--text2); font-size:14px; flex-shrink:0;
  position:relative; transition:all 0.15s;
}
.tb-icon i, .tb-icon .fa { font-size:14px !important; }
.tb-icon:hover { background:var(--surface2); color:var(--text); border-color:var(--teal); }
.tb-badge {
  position:absolute; top:-4px; right:-4px; min-width:16px; height:16px;
  background:#E53E3E; color:#fff; font-size:9px; font-weight:700;
  border-radius:8px; display:flex; align-items:center; justify-content:center;
  padding:0 3px; border:1.5px solid var(--surface); pointer-events:none;
}
/* CTA "+ Nový projekt" button group */
.cta-split { display:flex; align-items:center; gap:0; flex-shrink:0; }
.cta-main {
  padding:7px 14px; background:linear-gradient(135deg,var(--teal),var(--blue));
  color:#fff; font-size:13px; font-weight:600; border:none; cursor:pointer;
  border-radius:9px 0 0 9px; white-space:nowrap; transition:filter 0.15s;
  box-shadow:0 2px 12px rgba(74,127,255,0.30);
}
.cta-main:hover { filter:brightness(1.1); }
.cta-chevron {
  padding:7px 9px; background:linear-gradient(135deg,var(--teal),var(--blue));
  color:#fff; font-size:12px; border:none; cursor:pointer;
  border-radius:0 9px 9px 0; border-left:0.5px solid rgba(255,255,255,0.20);
  transition:filter 0.15s; box-shadow:0 2px 12px rgba(74,127,255,0.30);
}
.cta-chevron:hover { filter:brightness(1.1); }
/* CTA dropdown */
.cta-dropdown {
  position:absolute; top:calc(100% + 6px); right:0;
  background:var(--surface); border:0.5px solid var(--border2);
  border-radius:10px; box-shadow:0 8px 32px rgba(0,0,0,0.25);
  min-width:200px; z-index:200; overflow:hidden;
}
.cta-dropdown button {
  display:flex; align-items:center; gap:10px; width:100%;
  padding:10px 14px; border:none; background:transparent;
  color:var(--text); font-size:13px; cursor:pointer; text-align:left;
  transition:background 0.1s;
}
.cta-dropdown button:hover { background:var(--surface2); }
.cta-dropdown button i { width:16px; text-align:center; color:var(--teal); }
/* Notification panel */
.notif-panel {
  position:absolute; top:calc(100% + 6px); right:0;
  width:340px; background:var(--surface); border:0.5px solid var(--border2);
  border-radius:4px; box-shadow:0 8px 40px rgba(0,0,0,0.28);
  z-index:200; overflow:hidden; display:flex; flex-direction:column;
}
.notif-panel-header {
  padding:12px 16px 10px; border-bottom:0.5px solid var(--border);
  display:flex; align-items:center; justify-content:space-between;
}
.notif-panel-header span { font-size:13px; font-weight:600; color:var(--text); }
.notif-panel-header button {
  font-size:11px; color:var(--teal); background:none; border:none;
  cursor:pointer; padding:0;
}
.notif-list { max-height:380px; overflow-y:auto; }
.notif-item {
  display:flex; gap:10px; padding:10px 14px;
  border-bottom:0.5px solid var(--border); transition:background 0.1s; cursor:pointer;
}
.notif-item:last-child { border-bottom:none; }
.notif-item:hover { background:var(--surface2); }
.notif-icon {
  width:32px; height:32px; border-radius:8px; display:flex;
  align-items:center; justify-content:center; font-size:13px; flex-shrink:0;
}
.notif-body { flex:1; min-width:0; }
.notif-title { font-size:12px; color:var(--text); font-weight:500; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.notif-sub { font-size:11px; color:var(--text3); margin-top:2px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.notif-time { font-size:10px; color:var(--text3); white-space:nowrap; flex-shrink:0; padding-top:1px; }
/* Timer compact (inside topbar when running) */
#tb-timer-pill {
  display:flex; align-items:center; gap:6px; padding:0 10px; height:36px;
  background:linear-gradient(90deg,var(--teal-bg),var(--blue-bg));
  border-radius:9px; border:0.5px solid var(--teal); flex-shrink:0;
}
.light-mode #tb-timer-pill { background:var(--teal-bg); }
/* Sidebar user profile */
#sidebar-user {
  padding:10px 8px; border-top:0.5px solid rgba(255,255,255,0.08);
  display:flex; align-items:center; gap:10px; cursor:pointer;
  border-radius:10px; margin:0 4px 4px; transition:background 0.15s;
}
#sidebar-user:hover { background:rgba(255,255,255,0.06); }
#sidebar-user img {
  width:36px; height:36px; border-radius:6px; object-fit:cover;
  background:var(--teal-bg); flex-shrink:0;
  border:1.5px solid rgba(74,127,255,0.3);
}
#sidebar-user-initials {
  width:36px; height:36px; border-radius:6px; background:linear-gradient(135deg,var(--teal),var(--blue));
  display:flex; align-items:center; justify-content:center;
  font-size:13px; font-weight:700; color:#fff; flex-shrink:0;
}
.sidebar-user-info { flex:1; min-width:0; }
.sidebar-user-name  { font-size:13px; font-weight:600; color:#E8EDF5; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.sidebar-user-email { font-size:11px; color:rgba(139,163,204,0.7); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; margin-top:1px; }
.sidebar-user-chev  { color:rgba(139,163,204,0.5); font-size:11px; flex-shrink:0; }
#sidebar.collapsed #sidebar-user .sidebar-user-info,
#sidebar.collapsed #sidebar-user .sidebar-user-chev { display:none; }
#sidebar.collapsed #sidebar-user { justify-content:center; gap:0; padding:10px 0; margin:0 0 4px; border-radius:0; }
/* Search highlight in views */
.search-inp {
  flex:1; min-width:140px; padding:8px 14px; border-radius:8px;
  border:0.5px solid var(--border2); background:var(--surface2);
  color:var(--text); font-size:14px; outline:none; transition:all 0.15s;
}
.search-inp:focus { border-color:var(--teal); box-shadow:0 0 0 3px rgba(74,127,255,0.12); }

/* ── Table ──────────────────────────────────────────────────────────────────── */
.data-table { width:100%; border-collapse:collapse; font-size:13px; }
.data-table th {
  padding:10px 14px; text-align:left; font-size:11px; font-weight:600;
  color:var(--text3); text-transform:uppercase; letter-spacing:0.8px;
  border-bottom:0.5px solid var(--border); white-space:nowrap;
}
.data-table td { padding:10px 14px; border-bottom:0.5px solid var(--border); vertical-align:middle; }
.data-table tr:hover td { background:var(--surface2); }
.data-table tr:last-child td { border-bottom:none; }

/* ── Sidebar — always dark regardless of theme ───────────────────────────────── */
#sidebar {
  background:linear-gradient(180deg, #0E1625 0%, #070C18 100%);
  border-right:0.5px solid rgba(27,40,64,0.8);
}
/* Nav items inside sidebar: override text for dark bg in light mode */
.light-mode #sidebar .nav-item { color:#8BA3CC; }
.light-mode #sidebar .nav-item:hover { background:rgba(255,255,255,0.07); color:#E8EDF5; }
.light-mode #sidebar .nav-item.active { background:#0A1840; color:#6BAAFF; }
.light-mode #sidebar .nav-section { color:rgba(139,163,204,0.55); }
/* Logo border and user menu: always dark */
.light-mode #sidebar-logo-cell { border-bottom-color: rgba(27,40,64,0.8) !important; }
.light-mode #sidebar-user-menu { background:#111D30 !important; border-color:rgba(27,40,64,0.9) !important; }
.light-mode #sidebar-user-menu button { color:#8BA3CC !important; }
.light-mode #sidebar-user-menu button:last-child { color:#FF6B6B !important; }
.light-mode #sidebar-user-menu hr, .light-mode #sidebar-user-menu [data-divider] { background:rgba(139,163,204,0.15) !important; }

/* Collapsed sidebar */
#sidebar.collapsed { width:58px !important; }
#sidebar.collapsed .nav-label       { display:none; }
#sidebar.collapsed .logo-text-label { display:none; }
#sidebar.collapsed .nav-section     { display:none; }
#sidebar.collapsed #sidebar-logo-cell { justify-content:center; gap:0; padding:0 0 0 0; }
#sidebar.collapsed #sidebar-logo-icon { display:block !important; }
#sidebar.collapsed .nav-item        { justify-content:center; padding:10px 0; }
#sidebar.collapsed .nav-item i      { width:20px; font-size:15px; }

/* ── Scrollbar ──────────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width:4px; height:4px; }
::-webkit-scrollbar-track { background:transparent; }
::-webkit-scrollbar-thumb { background:var(--border2); border-radius:4px; }
::-webkit-scrollbar-thumb:hover { background:var(--teal); }

/* ── Responsive ─────────────────────────────────────────────────────────────── */
@media (max-width:768px) {
  #sidebar { width:52px!important; }
  .nav-label,.nav-section,.user-name-area,.logo-text-label,
  .sidebar-user-info,.sidebar-user-chev { display:none; }
  .nav-item { justify-content:center; padding:10px; }
  #sidebar-user { justify-content:center; gap:0; padding:8px 0; margin:0; border-radius:0; }
  .topbar-search { max-width:none; }
  .cta-main span { display:none; }
  .crm-card { width:100%; min-width:unset; max-width:unset; }
  .card-grid { padding:12px; }
  .topbar    { padding:10px 12px; }
  .f-row     { flex-direction:column; gap:0; }
}

.bill-diff { color: var(--orange); font-weight: 600; }
