/* ============================================================
   WECKO BackOffice — Glassmorphism + Neumorphism Design
   ============================================================ */

/* ── CSS Variables ── */
:root {
  --green: #6db33f;
  --green-light: #8cc63f;
  --green-dark: #5a9e2f;
  --sidebar-grad: linear-gradient(180deg, #5a9a32, #3d7a1c);
  --white: #ffffff;
  --bg: #f5f7fa;
  --text: #2d3748;
  --text-light: #4a5568;
  --text-muted: #a0aec0;
  --border: #e2e8f0;
  --red: #e53e3e;
  --yellow: #ecc94b;
  --orange: #ed8936;
  --blue: #4299e1;
  --purple: #9f7aea;

  /* Glassmorphism */
  --glass-bg: rgba(255,255,255,0.7);
  --glass-bg-strong: rgba(255,255,255,0.85);
  --glass-border: 1px solid rgba(255,255,255,0.3);
  --glass-blur: blur(20px);
  --glass-shadow: 0 8px 32px rgba(0,0,0,0.08);

  /* Neumorphism */
  --neu-shadow: 4px 4px 10px rgba(0,0,0,0.1), -4px -4px 10px rgba(255,255,255,0.9);
  --neu-shadow-sm: 2px 2px 6px rgba(0,0,0,0.08), -2px -2px 6px rgba(255,255,255,0.9);
  --neu-inset: inset 2px 2px 5px rgba(0,0,0,0.05), inset -2px -2px 5px rgba(255,255,255,0.8);

  --radius: 16px;
  --radius-sm: 12px;
  --radius-xs: 8px;
  --radius-pill: 50px;
  --sidebar-width: 270px;
}

/* ── Reset ── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  overflow: hidden;
  height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Animations ── */
@keyframes spin { to { transform: rotate(360deg); } }

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes slideInRight {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

@keyframes slideInLeft {
  from { transform: translateX(-100%); }
  to { transform: translateX(0); }
}

@keyframes bounceIn {
  0% { opacity: 0; transform: scale(0.3); }
  50% { transform: scale(1.1); }
  70% { transform: scale(0.9); }
  100% { opacity: 1; transform: scale(1); }
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 0 5px rgba(109,179,63,0.3); }
  50% { box-shadow: 0 0 20px rgba(109,179,63,0.5), 0 0 40px rgba(109,179,63,0.2); }
}

@keyframes checkBounce {
  0% { transform: scale(1); }
  30% { transform: scale(0.8); }
  60% { transform: scale(1.15); }
  100% { transform: scale(1); }
}

@keyframes staggerIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes tagFadeIn {
  from { opacity: 0; transform: scale(0.8); }
  to { opacity: 1; transform: scale(1); }
}

/* ── Loading Screen ── */
.loading-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100vh;
  background: linear-gradient(135deg, #5a9a32 0%, #3d7a1c 50%, #2d6b12 100%);
  gap: 32px;
}
.loading-screen .loading-logo {
  animation: scaleIn 0.6s ease-out;
}
.loading-screen .logo-box {
  background: var(--white);
  border-radius: 16px;
  padding: 20px 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}
.loading-screen .logo-wecko {
  font-size: 32px;
  font-weight: 800;
  color: var(--green);
  letter-spacing: 2px;
}
.loading-screen .logo-sub {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 3px;
  text-transform: uppercase;
}
.loading-screen .spinner {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(255,255,255,0.3);
  border-top-color: var(--white);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  background: linear-gradient(135deg, #5a9a32 0%, #3d7a1c 50%, #2d6b12 100%);
  position: relative;
  overflow: hidden;
}
.login-page::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at 30% 40%, rgba(255,255,255,0.08) 0%, transparent 50%),
              radial-gradient(circle at 70% 80%, rgba(255,255,255,0.05) 0%, transparent 40%);
  pointer-events: none;
}

.login-box {
  background: rgba(255,255,255,0.15);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  border: 1px solid rgba(255,255,255,0.25);
  padding: 48px 44px;
  border-radius: 24px;
  box-shadow: 0 25px 80px rgba(0,0,0,0.15);
  width: 420px;
  max-width: 92vw;
  text-align: center;
  animation: scaleIn 0.5s ease-out;
  position: relative;
  z-index: 1;
}
.login-box .login-logo {
  margin-bottom: 32px;
  animation: fadeInUp 0.6s ease-out 0.1s both;
}
.login-box .logo-box-login {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  background: var(--white);
  border-radius: 16px;
  padding: 20px 36px 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.1);
}
.login-box .logo-wecko {
  font-size: 36px;
  font-weight: 800;
  color: var(--green);
  letter-spacing: 2px;
  line-height: 1;
}
.login-box .logo-img-login {
  height: 48px;
  width: auto;
  margin-bottom: 4px;
}
.login-box .logo-sub {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 4px;
  text-transform: uppercase;
  margin-top: 4px;
}
.login-box h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--white);
  margin-bottom: 4px;
}
.login-box .subtitle {
  color: rgba(255,255,255,0.65);
  margin-bottom: 32px;
  font-size: 13px;
  font-weight: 400;
}
.login-form-area {
  animation: fadeInUp 0.6s ease-out 0.25s both;
}
.login-error {
  color: #ffd7d7;
  background: rgba(229,62,62,0.25);
  border: 1px solid rgba(229,62,62,0.3);
  font-size: 13px;
  margin-bottom: 16px;
  padding: 10px 16px;
  border-radius: var(--radius-xs);
  display: none;
}

/* Login form fields */
.login-box .form-group {
  margin-bottom: 20px;
  text-align: left;
}
.login-box .form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: rgba(255,255,255,0.75);
  margin-bottom: 6px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.login-box .form-group input {
  width: 100%;
  padding: 14px 18px;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-family: 'Inter', sans-serif;
  transition: all 0.25s ease;
  outline: none;
  background: rgba(255,255,255,0.12);
  color: var(--white);
  box-shadow: var(--neu-inset);
}
.login-box .form-group input::placeholder {
  color: rgba(255,255,255,0.4);
}
.login-box .form-group input:focus {
  border-color: rgba(255,255,255,0.5);
  background: rgba(255,255,255,0.18);
  box-shadow: 0 0 0 3px rgba(255,255,255,0.1);
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-xs);
  font-size: 14px;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  position: relative;
  overflow: hidden;
}
.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--white);
  color: var(--green);
  width: 100%;
  padding: 14px;
  font-size: 16px;
  font-weight: 700;
  border-radius: var(--radius-sm);
  box-shadow: 0 4px 15px rgba(0,0,0,0.1);
  letter-spacing: 0.5px;
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.btn-sm { padding: 6px 14px; font-size: 12px; border-radius: var(--radius-xs); }

.btn-green {
  background: linear-gradient(135deg, #6db33f, #5a9e2f);
  color: white;
  box-shadow: 0 2px 8px rgba(109,179,63,0.3);
  animation: pulseGlow 3s ease-in-out infinite;
}
.btn-green:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 16px rgba(109,179,63,0.4);
}

.btn-white {
  background: var(--white);
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: var(--neu-shadow-sm);
}
.btn-white:hover {
  transform: scale(1.05);
  box-shadow: var(--neu-shadow);
}

.btn-yellow {
  background: linear-gradient(135deg, #ecc94b, #ed8936);
  color: #744210;
  box-shadow: 0 2px 8px rgba(236,201,75,0.3);
}
.btn-yellow:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 16px rgba(236,201,75,0.4);
}

.btn-red { background: var(--red); color: white; }
.btn-red:hover { background: #c53030; }

.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-light);
  box-shadow: var(--neu-shadow-sm);
}
.btn-outline:hover {
  background: var(--white);
  transform: scale(1.05);
}

/* ============================================================
   APP LAYOUT
   ============================================================ */
.app-layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
  animation: fadeIn 0.4s ease;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: var(--sidebar-grad);
  color: rgba(255,255,255,0.85);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  z-index: 100;
  position: relative;
}
.sidebar::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 1px;
  height: 100%;
  background: linear-gradient(180deg, rgba(255,255,255,0.15), rgba(255,255,255,0.05));
}

.sidebar-header {
  padding: 24px 20px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.2);
}
.sidebar-logo {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  background: var(--white);
  border-radius: 14px;
  padding: 14px 28px 10px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.1);
  width: 100%;
}
.sidebar-logo .logo-text {
  font-size: 24px;
  font-weight: 800;
  color: var(--green);
  letter-spacing: 2px;
  line-height: 1;
}
.sidebar-logo .logo-img-sidebar {
  height: 36px;
  width: auto;
  margin-bottom: 2px;
}
.sidebar-logo .logo-sub {
  font-size: 9px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 4px;
  text-transform: uppercase;
  margin-top: 2px;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 0;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  padding: 10px 20px;
  margin: 2px 10px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.2s ease;
  position: relative;
  user-select: none;
  border-radius: var(--radius-xs);
  color: rgba(255,255,255,0.8);
}
.nav-item:hover {
  background: rgba(255,255,255,0.15);
  backdrop-filter: blur(10px);
  transform: scale(1.02);
  color: var(--white);
}
.nav-item.active {
  background: rgba(255,255,255,0.25);
  backdrop-filter: blur(10px);
  color: var(--white);
  font-weight: 600;
  border-left: 3px solid var(--white);
  margin-left: 7px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}
.nav-item .icon {
  margin-right: 12px;
  font-size: 16px;
  width: 22px;
  text-align: center;
  flex-shrink: 0;
}
.nav-item .badge {
  margin-left: auto;
  background: rgba(255,255,255,0.25);
  backdrop-filter: blur(5px);
  color: white;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: var(--radius-pill);
  min-width: 24px;
  text-align: center;
  animation: bounceIn 0.5s ease-out;
  border: 1px solid rgba(255,255,255,0.2);
}

.nav-separator {
  height: 1px;
  background: rgba(255,255,255,0.2);
  margin: 10px 20px;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.2);
  font-size: 12px;
}
.sidebar-footer .user-info {
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar-footer .user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: white;
  border: 2px solid rgba(255,255,255,0.3);
  flex-shrink: 0;
}
.sidebar-footer .user-details {
  flex: 1;
  min-width: 0;
}
.sidebar-footer .user-name {
  color: var(--white);
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-footer .user-role {
  color: rgba(255,255,255,0.5);
  font-size: 11px;
}
.sidebar-footer .logout-link {
  color: rgba(255,255,255,0.45);
  text-decoration: none;
  font-size: 11px;
  padding: 4px 10px;
  border-radius: var(--radius-xs);
  transition: all 0.2s;
  display: inline-block;
  margin-top: 8px;
}
.sidebar-footer .logout-link:hover {
  color: var(--white);
  background: rgba(255,255,255,0.1);
}

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
  background: var(--bg);
}

/* ============================================================
   TOPBAR
   ============================================================ */
.topbar {
  display: flex;
  align-items: center;
  padding: 16px 28px;
  background: rgba(255,255,255,0.8);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255,255,255,0.3);
  gap: 16px;
  flex-shrink: 0;
  box-shadow: 0 2px 20px rgba(0,0,0,0.04);
}
.topbar .section-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  flex-shrink: 0;
}

/* Search Bar */
.search-box {
  flex: 1;
  position: relative;
  max-width: 600px;
}
.search-box input {
  width: 100%;
  padding: 12px 18px 12px 44px;
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: var(--radius-pill);
  font-size: 14px;
  font-family: 'Inter', sans-serif;
  outline: none;
  transition: all 0.25s ease;
  background: rgba(255,255,255,0.6);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: var(--neu-inset);
  color: var(--text);
}
.search-box input::placeholder { color: var(--text-muted); }
.search-box input:focus {
  border-color: var(--green);
  background: var(--white);
  box-shadow: 0 0 0 3px rgba(109,179,63,0.15), var(--neu-inset);
}
.search-box .search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 15px;
  pointer-events: none;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.topbar-user {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-light);
}
.topbar-user .user-avatar-sm {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6db33f, #5a9e2f);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: white;
  font-weight: 700;
}

.sync-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  background: linear-gradient(135deg, #6db33f, #5a9e2f);
  color: white;
  border: none;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 10px rgba(109,179,63,0.3);
}
.sync-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(109,179,63,0.4);
}
.sync-btn.syncing {
  opacity: 0.6;
  pointer-events: none;
}

/* ============================================================
   TOOLBAR
   ============================================================ */
.toolbar {
  display: flex;
  align-items: center;
  padding: 10px 28px;
  background: rgba(255,255,255,0.6);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255,255,255,0.3);
  gap: 10px;
  flex-shrink: 0;
}
.toolbar .select-all {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--green);
}
.toolbar-info {
  font-size: 13px;
  color: var(--text-muted);
  margin-left: 4px;
  font-weight: 500;
}
.toolbar-actions {
  margin-left: auto;
  display: flex;
  gap: 8px;
}

/* ============================================================
   CONTENT AREA
   ============================================================ */
#contentArea {
  flex: 1;
  overflow-y: auto;
  padding: 0;
}

/* ============================================================
   INBOX LIST
   ============================================================ */
.inbox-list {
  padding: 12px 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.inbox-row {
  display: flex;
  align-items: center;
  padding: 14px 20px;
  background: var(--glass-bg-strong);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: var(--glass-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.25s ease;
  position: relative;
  box-shadow: 0 2px 12px rgba(0,0,0,0.04);
  animation: staggerIn 0.3s ease-out both;
}
.inbox-row:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(0,0,0,0.1);
  background: var(--white);
}
.inbox-row.unread {
  font-weight: 600;
  border-left: 3px solid var(--blue);
}
.inbox-row.done {
  border-left: 4px solid var(--green);
  opacity: 0.75;
}
.inbox-row.done:hover { opacity: 1; }
.inbox-row.waiting {
  border-left: 4px solid var(--yellow);
}

.inbox-row .row-check {
  width: 18px;
  height: 18px;
  margin-right: 14px;
  flex-shrink: 0;
  accent-color: var(--green);
  cursor: pointer;
  transition: transform 0.2s ease;
}
.inbox-row .row-check:checked {
  animation: checkBounce 0.3s ease;
}

.inbox-row .row-sender {
  width: 180px;
  min-width: 130px;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-right: 12px;
  flex-shrink: 0;
  color: var(--text);
}
.inbox-row .row-content {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}
.inbox-row .row-subject {
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text);
}
.inbox-row .row-preview {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 400;
}

.row-tags {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
  margin-right: 6px;
}

/* Tags */
.tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
  animation: tagFadeIn 0.3s ease-out both;
  letter-spacing: 0.3px;
}
.tag-faktura { background: #ebf8ff; color: #2b6cb0; }
.tag-platba { background: #f0fff4; color: #276749; }
.tag-excel { background: #fefcbf; color: #744210; }
.tag-info { background: #e9d8fd; color: #553c9a; }
.tag-klient { background: #fed7e2; color: #97266d; }
.tag-dovoz, .tag-objednavka { background: #feebc8; color: #7b341e; }
.tag-vratka { background: #bee3f8; color: #2a4365; }
.tag-servis { background: #c6f6d5; color: #22543d; }
.tag-upomienka, .tag-uvo { background: #fed7d7; color: #9b2c2c; }
.tag-reklamacia { background: #fed7d7; color: #9b2c2c; }
.tag-mesacne { background: #d6bcfa; color: #44337a; }
.tag-rocne { background: #b2f5ea; color: #234e52; }
.tag-ucet { background: #e2e8f0; color: #4a5568; }
.tag-vlakno { background: #e2e8f0; color: #718096; }
.tag-nejasne { background: #fefcbf; color: #975a16; }
.tag-system { background: #e2e8f0; color: #4a5568; }
.tag-faktura-dosla { background: #c3dafe; color: #3c366b; }
.tag-bankovy-vypis { background: #c6f6d5; color: #22543d; }

.row-action-btn {
  flex-shrink: 0;
  margin-right: 10px;
}
.row-date {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
  width: 72px;
  text-align: right;
  font-weight: 500;
}
.row-due {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
  width: 80px;
  text-align: right;
  font-weight: 500;
}
.row-due.overdue {
  color: var(--red);
  font-weight: 700;
}

/* ============================================================
   SKELETON LOADING
   ============================================================ */
.skeleton-list {
  padding: 12px 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.skeleton-row {
  display: flex;
  align-items: center;
  padding: 18px 20px;
  background: var(--glass-bg-strong);
  border: var(--glass-border);
  border-radius: var(--radius-sm);
  gap: 16px;
}
.skeleton-item {
  height: 14px;
  border-radius: 8px;
  background: linear-gradient(90deg, #e2e8f0 25%, #edf2f7 50%, #e2e8f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
}
.skeleton-check { width: 18px; height: 18px; border-radius: 4px; flex-shrink: 0; }
.skeleton-sender { width: 140px; flex-shrink: 0; }
.skeleton-subject { flex: 1; }
.skeleton-date { width: 60px; flex-shrink: 0; }

/* ============================================================
   PAGINATION
   ============================================================ */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 20px;
  flex-shrink: 0;
}
.pagination button {
  padding: 8px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  background: var(--white);
  cursor: pointer;
  font-size: 13px;
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  transition: all 0.2s ease;
  box-shadow: var(--neu-shadow-sm);
}
.pagination button:hover:not(:disabled) {
  background: var(--bg);
  transform: translateY(-1px);
  box-shadow: var(--neu-shadow);
}
.pagination button:disabled { opacity: 0.4; cursor: default; box-shadow: none; }
.pagination .page-info { font-size: 13px; color: var(--text-muted); font-weight: 500; }

/* ============================================================
   DETAIL PANEL
   ============================================================ */
.detail-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 620px;
  max-width: 92vw;
  height: 100vh;
  background: var(--white);
  box-shadow: -8px 0 40px rgba(0,0,0,0.12);
  z-index: 200;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}
.detail-panel.open {
  transform: translateX(0);
}
.detail-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.25);
  backdrop-filter: blur(3px);
  z-index: 199;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.detail-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.detail-header {
  display: flex;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
  background: rgba(255,255,255,0.9);
  backdrop-filter: blur(10px);
}
.detail-close {
  background: none;
  border: 1px solid var(--border);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}
.detail-close:hover {
  color: var(--text);
  background: var(--bg);
  border-color: var(--text-muted);
}
.detail-title {
  flex: 1;
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.detail-status {
  padding: 4px 14px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.3px;
  flex-shrink: 0;
}
.status-new { background: #ebf8ff; color: #2b6cb0; }
.status-in_progress { background: #fefcbf; color: #744210; }
.status-waiting { background: #fed7e2; color: #97266d; }
.status-done { background: #c6f6d5; color: #22543d; }
.status-trash { background: #e2e8f0; color: #4a5568; }
.status-spam { background: #fed7d7; color: #9b2c2c; }
.status-active { background: #ebf8ff; color: #2b6cb0; }

.detail-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}
.detail-meta {
  margin-bottom: 20px;
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  border: var(--glass-border);
  border-radius: var(--radius-sm);
  padding: 16px 20px;
}
.detail-meta-row {
  display: flex;
  margin-bottom: 8px;
  font-size: 13px;
}
.detail-meta-row:last-child { margin-bottom: 0; }
.detail-meta-label {
  width: 90px;
  color: var(--text-muted);
  flex-shrink: 0;
  font-weight: 500;
}
.detail-meta-value {
  color: var(--text);
  word-break: break-word;
}

.detail-email-body {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  border: var(--glass-border);
  border-radius: var(--radius-sm);
  padding: 24px;
  font-size: 14px;
  line-height: 1.7;
  overflow-x: auto;
  max-height: 400px;
  overflow-y: auto;
  box-shadow: var(--glass-shadow);
}
.detail-email-body img { max-width: 100%; }

.detail-thread {
  margin-top: 24px;
}
.detail-thread h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-light);
  margin-bottom: 12px;
}
.thread-item {
  padding: 14px 16px;
  background: var(--glass-bg);
  border: var(--glass-border);
  border-radius: var(--radius-xs);
  margin-bottom: 8px;
  font-size: 13px;
}
.thread-item .thread-from { font-weight: 600; color: var(--text); }
.thread-item .thread-date { color: var(--text-muted); font-size: 11px; margin-left: 10px; }
.thread-item .thread-preview { color: var(--text-light); margin-top: 6px; line-height: 1.5; }

.detail-actions-log {
  margin-top: 24px;
}
.detail-actions-log h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-light);
  margin-bottom: 12px;
}
.action-log-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(0,0,0,0.05);
  font-size: 13px;
}
.action-log-item:last-child { border-bottom: none; }
.action-log-item .action-type {
  font-weight: 600;
  color: var(--green);
}
.action-log-item .action-date {
  color: var(--text-muted);
  margin-left: auto;
  font-size: 11px;
}

/* DETAIL FOOTER / AI ACTIONS */
.detail-footer {
  padding: 18px 24px;
  border-top: 1px solid var(--border);
  background: var(--bg);
}
.detail-footer h4 {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 12px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.ai-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 40px;
  text-align: center;
  animation: fadeInUp 0.5s ease-out;
}
.empty-state .empty-icon {
  font-size: 64px;
  margin-bottom: 16px;
  opacity: 0.5;
}
.empty-state h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-light);
  margin-bottom: 8px;
}
.empty-state p {
  font-size: 14px;
  color: var(--text-muted);
  max-width: 400px;
}

/* ============================================================
   LOADING SPINNER
   ============================================================ */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px;
}
.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* ============================================================
   TOAST
   ============================================================ */
.toast {
  position: fixed;
  bottom: 28px;
  right: 28px;
  padding: 14px 24px;
  background: var(--glass-bg-strong);
  backdrop-filter: var(--glass-blur);
  border: var(--glass-border);
  color: var(--text);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  z-index: 1000;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  max-width: 400px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.12);
}
.toast.show { transform: translateY(0); opacity: 1; }
.toast.success {
  background: linear-gradient(135deg, #6db33f, #5a9e2f);
  color: white;
  border: none;
}
.toast.error {
  background: linear-gradient(135deg, #e53e3e, #c53030);
  color: white;
  border: none;
}

/* ============================================================
   CUSTOM CHECKBOX
   ============================================================ */
input[type="checkbox"] {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  background: var(--white);
}
input[type="checkbox"]:checked {
  background: var(--green);
  border-color: var(--green);
  animation: checkBounce 0.3s ease;
}
input[type="checkbox"]:checked::after {
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 12px;
  font-weight: 700;
  color: white;
}
input[type="checkbox"]:hover {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(109,179,63,0.1);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
  :root {
    --sidebar-width: 280px;
  }
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    z-index: 150;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 8px 0 40px rgba(0,0,0,0.2);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .mobile-toggle {
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    cursor: pointer;
    font-size: 20px;
    box-shadow: var(--neu-shadow-sm);
    transition: all 0.2s;
    flex-shrink: 0;
  }
  .mobile-toggle:hover {
    box-shadow: var(--neu-shadow);
  }
  .topbar .section-title { display: none; }
  .search-box { max-width: none; }
  .inbox-row .row-sender { width: 100px; min-width: 80px; font-size: 12px; }
  .inbox-row { padding: 12px 14px; }
  .inbox-list { padding: 8px 12px; }
  .row-due { display: none; }
  .row-action-btn { display: none; }
  .detail-panel { width: 100vw; max-width: 100vw; }
  .toolbar { padding: 8px 14px; }
  .topbar { padding: 12px 14px; }
}

@media (min-width: 769px) {
  .mobile-toggle { display: none !important; }
}

/* ============================================================
   SCROLLBAR
   ============================================================ */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.12); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,0.2); }

/* Sidebar scrollbar */
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); }
.sidebar::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.3); }

/* Mobile overlay when sidebar is open */
.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.3);
  backdrop-filter: blur(3px);
  z-index: 140;
  display: none;
}
.sidebar-overlay.open { display: block; }

/* ============================================================
   DASHBOARD
   ============================================================ */
.dashboard-container {
  padding: 24px 28px;
  overflow-y: auto;
  height: 100%;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}

.kpi-card {
  background: var(--glass-bg-strong);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: var(--glass-border);
  border-radius: var(--radius);
  padding: 28px 24px;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  box-shadow: var(--glass-shadow);
  animation: fadeInUp 0.5s ease-out both;
}
.kpi-card:nth-child(1) { animation-delay: 0ms; }
.kpi-card:nth-child(2) { animation-delay: 100ms; }
.kpi-card:nth-child(3) { animation-delay: 200ms; }
.kpi-card:nth-child(4) { animation-delay: 300ms; }

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  border-radius: var(--radius) var(--radius) 0 0;
}
.kpi-orders::before { background: linear-gradient(90deg, #4299e1, #667eea); }
.kpi-invoices::before { background: linear-gradient(90deg, #6db33f, #38a169); }
.kpi-payments::before { background: linear-gradient(90deg, #ecc94b, #ed8936); }
.kpi-service::before { background: linear-gradient(90deg, #9f7aea, #ed64a6); }

.kpi-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(0,0,0,0.12);
}

.kpi-icon {
  font-size: 36px;
  margin-bottom: 8px;
}
.kpi-value {
  font-size: 36px;
  font-weight: 800;
  color: var(--text);
  line-height: 1.1;
  margin-bottom: 4px;
}
.kpi-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-light);
  margin-bottom: 4px;
}
.kpi-detail {
  font-size: 16px;
  font-weight: 700;
  color: var(--green);
  margin-bottom: 8px;
}
.kpi-sub {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.kpi-chip {
  display: inline-block;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: 10px;
  font-weight: 600;
  background: rgba(0,0,0,0.05);
  color: var(--text-light);
  white-space: nowrap;
}

.dashboard-inbox-section {
  background: var(--glass-bg-strong);
  backdrop-filter: var(--glass-blur);
  border: var(--glass-border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--glass-shadow);
  animation: fadeInUp 0.5s ease-out 0.4s both;
}
.dashboard-inbox-section h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 16px;
}

.inbox-kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 16px;
}
.inbox-kpi {
  text-align: center;
  padding: 20px 16px;
  background: rgba(0,0,0,0.02);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
}
.inbox-kpi:hover {
  background: rgba(109,179,63,0.08);
  transform: translateY(-2px);
}
.inbox-kpi-num {
  display: block;
  font-size: 28px;
  font-weight: 800;
  color: var(--text);
  line-height: 1.2;
}
.inbox-kpi-label {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ============================================================
   DATA TABLES
   ============================================================ */
.data-table-container {
  padding: 0 20px;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}
.data-table thead th {
  position: sticky;
  top: 0;
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(10px);
  padding: 12px 16px;
  text-align: left;
  font-weight: 700;
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
.data-table tbody tr {
  transition: all 0.15s ease;
}
.data-table tbody tr:hover {
  background: rgba(109,179,63,0.04);
}
.data-table tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(0,0,0,0.04);
  color: var(--text);
  vertical-align: middle;
}

.table-row-anim {
  animation: staggerIn 0.25s ease-out both;
}

.cell-mono {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 12px;
  color: var(--text-light);
}
.cell-right { text-align: right; font-weight: 600; }
.cell-small { font-size: 11px; }
.empty-cell {
  text-align: center;
  padding: 40px !important;
  color: var(--text-muted);
  font-style: italic;
}

/* Status pills */
.status-pill {
  display: inline-block;
  padding: 3px 12px;
  border-radius: var(--radius-pill);
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
  letter-spacing: 0.3px;
}
.status-pill.status-draft { background: #e2e8f0; color: #4a5568; }
.status-pill.status-sent { background: #ebf8ff; color: #2b6cb0; }
.status-pill.status-paid { background: #c6f6d5; color: #22543d; }
.status-pill.status-overdue { background: #fed7d7; color: #9b2c2c; }
.status-pill.status-cancelled { background: #e2e8f0; color: #718096; }
.status-pill.status-confirmed { background: #bee3f8; color: #2a4365; }
.status-pill.status-in_progress { background: #fefcbf; color: #744210; }
.status-pill.status-completed { background: #c6f6d5; color: #22543d; }
.status-pill.status-invoiced { background: #d6bcfa; color: #44337a; }
.status-pill.status-pending_approval { background: #fed7e2; color: #97266d; }
.status-pill.status-scheduled { background: #bee3f8; color: #2a4365; }

/* Type pills */
.type-pill {
  display: inline-block;
  padding: 3px 12px;
  border-radius: var(--radius-pill);
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}
.type-pill.type-short_rental { background: #feebc8; color: #7b341e; }
.type-pill.type-long_rental_wc { background: #bee3f8; color: #2a4365; }
.type-pill.type-long_rental_fence { background: #b2f5ea; color: #234e52; }
.type-pill.type-long_rental_container { background: #e9d8fd; color: #553c9a; }
.type-pill.type-sale { background: #c6f6d5; color: #22543d; }
.type-pill.type-service { background: #fefcbf; color: #744210; }
.type-pill.type-damage_repair { background: #fed7d7; color: #9b2c2c; }

/* Upomienka tag */
.tag-upomienka { background: #fed7d7; color: #9b2c2c; }

@media (max-width: 768px) {
  .dashboard-container { padding: 16px 14px; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .kpi-value { font-size: 24px; }
  .kpi-card { padding: 20px 16px; }
  .data-table-container { padding: 0 8px; }
  .data-table { font-size: 12px; }
  .data-table thead th { padding: 8px 10px; }
  .data-table tbody td { padding: 8px 10px; }
}
