/* ==========================================
   PAYROLL MODULE - STYLES
   Wzorzec: frontend/obrot/css/style.css
   ========================================== */

@import url('../../admin/css/premium-components.css');

/* =================================================
   GLOBAL
   ================================================= */

* {
  box-sizing: border-box;
}

:root {
  --primary: #3b82f6;
  --text-primary: #e5e7eb;
  --text-secondary: #9ca3af;
  --bg-main: #181818;
  --bg-sidebar: #262626;
  --bg-card: #1f2937;
}

body {
  margin: 0;
  font-family: 'Inter', Manrope, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-main);
  color: var(--text-primary);
}

/* =================================================
   TOPBAR
   ================================================= */

.topbar {
  height: 56px;
  background: #202020;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.topbar-left,
.topbar-right {
  display: flex;
  align-items: center;
}

.topbar-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  font-weight: 600;
  color: #e5e7eb;
}

.topbar-text {
  color: #e5e7eb;
  font-size: 20px;
}

.topbar-icon {
  width: 18px;
  height: 18px;
  stroke: #9ca3af;
  stroke-width: 1.8;
  fill: none;
  flex-shrink: 0;
}

.topbar-action {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  color: #9ca3af;
  cursor: pointer;
  text-decoration: none;
  padding: 6px 10px;
  border-radius: 6px;
  transition: background 120ms ease, color 120ms ease;
}

.topbar-action:hover {
  background: rgba(255,255,255,0.04);
  color: #e5e7eb;
}

/* =================================================
   LAYOUT
   ================================================= */

.obrot-layout {
  display: flex;
  height: calc(100vh - 56px);
}

.obrot-content {
  flex: 1;
  height: 100%;
  overflow-y: auto;
  padding: 36px 48px;
  background: var(--bg-main);
  overscroll-behavior-y: contain;
}

/* =================================================
   PAYROLL VIEWS
   ================================================= */

.payroll-view {
  display: none;
}

.payroll-view.active {
  display: block;
}

/* View header — tytuł + nawigacja okresu */
.view-header {
  max-width: 1400px;
  margin: 0 auto 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

/* Dashboard-style header (jak w obrot) */
.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  background: linear-gradient(135deg, rgba(31, 41, 55, 0.95) 0%, rgba(17, 24, 39, 0.98) 100%);
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: 12px;
  gap: 16px;
  flex-wrap: wrap;
}

.payroll-view-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 28px;
}

.dashboard-title {
  margin: 0 0 4px 0;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-primary);
}

.dashboard-period {
  font-size: 0.85rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.view-title {
  font-size: 1.3rem;
  font-weight: 700;
  color: #e5e7eb;
  margin: 0;
}

/* =================================================
   PERIOD NAVIGATION
   ================================================= */

.navigation-bar {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-nav {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 0;
  color: #e5e7eb;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 150ms ease, border-color 150ms ease;
  white-space: nowrap;
}

.btn-nav:hover {
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.2);
}

.btn-nav-current {
  background: rgba(59,130,246,0.15);
  border-color: rgba(59,130,246,0.4);
  color: #60a5fa;
}

.btn-nav-current:hover {
  background: rgba(59,130,246,0.25);
}

.btn-nav .ui-icon {
  width: 14px;
  height: 14px;
}

.payroll-nav-buttons {
  display: inline-flex;
  align-items: center;
}

/* =================================================
   WEEKS GRID — fix lewitowania
   ================================================= */

.weeks-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  max-width: 1400px;
  margin: 0 auto 20px;
}

@media (max-width: 680px) {
  .weeks-grid {
    grid-template-columns: 1fr;
  }
}

/* =================================================
   WEEK CARDS
   ================================================= */

.week-card-payroll {
  background: #1f2937;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.08);
  padding: 20px;
  min-height: 160px;
}

/* =================================================
   PERIOD STATUS
   ================================================= */

#periodStatusMessage {
  max-width: 1400px;
  margin: 0 auto 16px;
}

/* =================================================
   ACTION BAR — przyciski główne
   ================================================= */

.action-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  max-width: 1400px;
  margin: 0 auto 28px;
}

/* Payroll action buttons */
.btn-payroll {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: opacity 200ms ease, transform 150ms ease;
}

.btn-payroll:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none !important;
}

.btn-payroll:not(:disabled):hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.btn-payroll-green {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #fff;
  box-shadow: 0 4px 6px rgba(16,185,129,0.3);
}

.btn-payroll-blue {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: #fff;
  box-shadow: 0 4px 6px rgba(59,130,246,0.3);
}

.btn-payroll-purple {
  background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
  color: #fff;
  box-shadow: 0 4px 6px rgba(139,92,246,0.3);
}

.btn-payroll-red {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: #fff;
  box-shadow: 0 4px 6px rgba(239,68,68,0.3);
}

/* =================================================
   RESULTS
   ================================================= */

#payrollResults {
  max-width: 1400px;
  margin: 0 auto;
}

/* =================================================
   HISTORIA (history list)
   ================================================= */

#payrollHistoryList {
  max-width: 1400px;
  margin: 0 auto;
}

/* =================================================
   ZARZĄDZANIE (config)
   ================================================= */

#payrollStartConfig {
  max-width: 1400px;
  margin: 0 auto;
}

.config-card {
  max-width: 560px;
  background: #1f2937;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.08);
  padding: 28px;
}

/* =================================================
   HERO CONTAINER
   ================================================= */

#payrollHeroContainer {
  max-width: 1400px;
  margin: 0 auto 20px;
}

/* =================================================
   UTILITY
   ================================================= */

.ui-icon {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 1.8;
  fill: none;
  flex-shrink: 0;
  vertical-align: middle;
}

/* =================================================
   CSS VARIABLES (admin compat)
   ================================================= */

:root {
  --success: #16a34a;
  --warning: #f59e0b;
  --danger: #dc2626;
  --dark-card: #1f2937;
  --text-tertiary: #6b7280;
  --primary-light: #60a5fa;
  --transition-fast: 0.2s ease;
}

/* =================================================
   EMPLOYEE CARDS
   ================================================= */

.employees-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(375px, 1fr));
  gap: 12px;
  margin-top: 24px;
}

.employee-card {
  background: linear-gradient(135deg, rgba(31,41,55,0.95) 0%, rgba(17,24,39,0.98) 100%);
  border: 2px solid rgba(59, 130, 246, 0.3);
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4), 0 0 20px rgba(59,130,246,0.15);
  transition: all 0.3s cubic-bezier(0.4,0,0.2,1);
  position: relative;
  overflow: hidden;
}

.employee-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(59,130,246,0.5), transparent);
}

.employee-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 48px rgba(0,0,0,0.5), 0 0 30px rgba(59,130,246,0.25);
  border-color: rgba(59,130,246,0.5);
}

.employee-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-bottom: 20px;
  border-bottom: 1px solid rgba(59,130,246,0.2);
  margin-bottom: 20px;
}

.employee-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  font-weight: 700;
  box-shadow: 0 4px 16px rgba(59,130,246,0.3);
  flex-shrink: 0;
}

.employee-info { flex: 1; }

.employee-info h4 {
  margin: 0 0 8px 0;
  font-size: 1.3rem;
  color: #f3f4f6;
  font-weight: 600;
}

.employee-username {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-tertiary);
}

.employee-details {
  border-top: 1px solid rgba(59,130,246,0.1);
  padding-top: 16px;
  margin-bottom: 16px;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  font-size: 0.9rem;
}

.detail-row .label { color: var(--text-tertiary); }
.detail-row .value { color: var(--text-primary); font-weight: 600; }

/* =================================================
   WEEK CARD INNER STYLES
   ================================================= */

.week-card-payroll.week-open {
  border-color: #f59e0b;
  background: linear-gradient(135deg, rgba(245,158,11,0.05), rgba(245,158,11,0.1));
}

.week-card-payroll.week-open .week-status {
  color: #f59e0b;
  background: rgba(245,158,11,0.2);
}

.week-card-payroll.week-closed {
  border-color: var(--success);
}

.week-card-payroll.week-closed .week-status {
  color: var(--success);
  background: rgba(34,197,94,0.2);
}

.week-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(59,130,246,0.1);
}

.week-card-header h4 {
  margin: 0;
  color: var(--text-primary);
  font-size: 1.2rem;
}

.week-status {
  padding: 4px 12px;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
}

.week-card-body { display: grid; gap: 12px; }

.week-card-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  color: var(--text-secondary);
}

.week-card-row strong {
  color: var(--text-primary);
  font-size: 1.1rem;
}

.week-card-total {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 2px solid rgba(59,130,246,0.2);
  display: flex;
  justify-content: space-between;
  font-weight: 700;
}

.week-card-total span:first-child { color: var(--text-secondary); font-size: 1rem; }
.week-card-total span:last-child { color: var(--success); font-size: 1.3rem; }

/* =================================================
   PAYROLL HISTORY
   ================================================= */

.payroll-history-item {
  background: var(--dark-card);
  border: 1px solid rgba(59,130,246,0.15);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.payroll-history-item:hover {
  border-color: #3b82f6;
  box-shadow: 0 4px 12px rgba(59,130,246,0.2);
  transform: translateY(-2px);
}

.history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.history-header h4 { margin: 0 0 4px 0; color: var(--text-primary); font-size: 1.2rem; }
.history-header p { margin: 0; color: var(--text-secondary); font-size: 0.9rem; }
.history-amount { font-size: 1.5rem; font-weight: 700; color: var(--success); }
.history-meta { color: var(--text-tertiary); font-size: 0.85rem; padding-top: 12px; border-top: 1px solid rgba(59,130,246,0.1); }

.history-period-wrapper {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: stretch;
}

@media (max-width: 900px) {
  .history-period-wrapper {
    grid-template-columns: 1fr;
  }
}

/* =================================================
   CONFIG CARD VARIANTS
   ================================================= */

.config-card.locked {
  background: linear-gradient(135deg, rgba(34,197,94,0.05), rgba(34,197,94,0.1));
  border-color: rgba(34,197,94,0.3);
}

.config-card.locked h3 { color: var(--success); }

.config-form {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.config-form label { font-weight: 600; color: var(--text-secondary); }

.config-form select {
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid rgba(59,130,246,0.3);
  background: var(--dark-card);
  color: var(--text-primary);
  font-size: 1rem;
  min-width: 200px;
}

.config-locked-info { display: flex; justify-content: space-between; align-items: center; }
.config-locked-info .info { color: var(--text-secondary); font-size: 0.95rem; }
.config-locked-info .info strong { color: var(--text-primary); font-size: 1.1rem; }

/* =================================================
   BADGES
   ================================================= */

.badge { padding: 4px 10px; border-radius: 12px; font-size: 0.85rem; font-weight: 600; }
.badge-info { background: rgba(59,130,246,0.2); color: #60a5fa; }
.badge-success { background: rgba(16,185,129,0.2); color: #34d399; }

.saturday-list-compact {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
  padding: 8px;
  background: var(--dark-card);
  border-radius: 6px;
}

/* =================================================
   PAYROLL REFACTOR OVERRIDES
   Unified dark-theme enterprise layer
   ================================================= */

html {
  color-scheme: dark;
}

:root {
  --bg-main: #181818;
  --bg-sidebar: #1c1c1c;
  --bg-card: #1e1e1e;
  --bg-card-muted: rgba(255, 255, 255, 0.03);
  --bg-card-accent: rgba(59, 130, 246, 0.06);
  --border: rgba(255, 255, 255, 0.06);
  --border-hover: rgba(255, 255, 255, 0.1);
  --shadow-soft: 0 12px 30px rgba(0, 0, 0, 0.22);
  --shadow-strong: 0 18px 40px rgba(0, 0, 0, 0.28);
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 10px;
  --success-soft: rgba(16, 185, 129, 0.12);
  --info-soft: rgba(59, 130, 246, 0.12);
  --warning-soft: rgba(245, 158, 11, 0.12);
  --danger-soft: rgba(239, 68, 68, 0.12);
}

body {
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(59, 130, 246, 0.05), transparent 28%),
    var(--bg-main);
  color: var(--text-primary);
  line-height: 1.6;
}

.topbar {
  position: sticky;
  top: 0;
  height: 56px;
  background: #202020;
  border-bottom: 1px solid rgba(59, 130, 246, 0.15);
  padding: 0 20px;
  z-index: 100;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
}

.topbar-left {
  gap: 10px;
}

.topbar-right {
  gap: 12px;
}

.topbar-title {
  gap: 8px;
  font-weight: 600;
  font-size: calc(0.95rem + 2px);
  color: var(--text-primary);
}

.topbar-title .ui-icon {
  width: 22px;
  height: 22px;
}

.topbar-text {
  font-size: inherit;
  color: var(--text-primary);
}

.topbar-icon {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 2;
}

.topbar-action {
  gap: 6px;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid transparent;
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 500;
  transition: color 150ms, border-color 150ms, background 150ms;
}

.topbar-action:hover {
  color: var(--text-primary);
  border-color: var(--border-hover);
  background: rgba(255, 255, 255, 0.04);
}

.payroll-sidebar.dash-sidebar {
  position: relative;
  width: 64px;
  min-height: calc(100vh - 56px);
  align-self: stretch;
  background: #1e1e1e;
  display: flex;
  flex-direction: column;
  padding: 16px 0;
  transition: width 180ms ease;
  overflow: hidden;
  flex-shrink: 0;
  font-family: 'Inter', system-ui, sans-serif;
  box-shadow: 2px 0 12px rgba(0, 0, 0, 0.35);
  z-index: 10;
}

.payroll-sidebar.dash-sidebar::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 1px;
  height: 100%;
  background: linear-gradient(
    to bottom,
    rgba(59, 130, 246, 0.1),
    rgba(59, 130, 246, 0.3),
    rgba(59, 130, 246, 0.1)
  );
  pointer-events: none;
  opacity: 0.5;
  transition: opacity 180ms ease;
}

.payroll-sidebar.dash-sidebar:hover::after {
  opacity: 1;
}

.payroll-sidebar.dash-sidebar:hover {
  width: 220px;
}

.payroll-sidebar.dash-sidebar nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.payroll-sidebar.dash-sidebar .sidebar-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 23px;
  color: #e5e7eb;
  text-decoration: none;
  white-space: nowrap;
  opacity: 0.6;
  transition: opacity 140ms ease, background-color 140ms ease;
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.1px;
  width: 100%;
  box-sizing: border-box;
}

.payroll-sidebar.dash-sidebar .sidebar-item:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.05);
}

.payroll-sidebar.dash-sidebar .sidebar-item.active {
  opacity: 1;
  background: rgba(59, 130, 246, 0.14);
  border-left: 3px solid #3b82f6;
  padding-left: 20px;
  box-shadow:
    inset 0 0 0 1px rgba(59, 130, 246, 0.2),
    0 0 12px rgba(59, 130, 246, 0.1);
}

.payroll-sidebar.dash-sidebar .s-icon {
  width: 18px;
  height: 18px;
  stroke: #9ca3af;
  stroke-width: 1.8;
  fill: none;
  flex-shrink: 0;
}

.payroll-sidebar.dash-sidebar .sidebar-item.active .s-icon {
  stroke: #3b82f6;
}

.payroll-sidebar.dash-sidebar .sidebar-item:hover .s-icon {
  stroke: #d1d5db;
}

.payroll-sidebar.dash-sidebar .s-label {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.1px;
  display: none;
  white-space: nowrap;
}

.payroll-sidebar.dash-sidebar:hover .s-label {
  display: inline;
}

.payroll-sidebar.dash-sidebar .sidebar-item.active .s-label {
  font-weight: 600;
  color: #93c5fd;
}

.obrot-layout {
  min-height: calc(100vh - 56px);
  align-items: stretch;
}

.obrot-content {
  padding: 36px 48px 56px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.015), rgba(255, 255, 255, 0)),
    var(--bg-main);
  min-width: 0;
  position: relative;
  z-index: 0;
}

.payroll-view-header,
.weeks-grid,
#periodStatusMessage,
.action-bar,
#payrollResults,
#payrollHistoryList,
#payrollStartConfig {
  max-width: 1480px;
}

.dashboard-header {
  padding: 22px 24px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.015), rgba(255, 255, 255, 0)),
    var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
}

.dashboard-title {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0;
  color: var(--text-primary);
}

.dashboard-period {
  font-size: 0.92rem;
  color: var(--text-secondary);
  margin: 4px 0 0;
}

.payroll-nav-buttons {
  align-self: center;
}

.btn-nav:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
}

.weeks-grid {
  gap: 20px;
}

.week-card-payroll {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.015), rgba(255, 255, 255, 0)),
    var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  min-height: 220px;
  box-shadow: var(--shadow-soft);
  transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.week-card-payroll:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-strong);
  transform: translateY(-2px);
}

.week-card-payroll.is-closed {
  border-color: rgba(245, 158, 11, 0.32);
  background:
    linear-gradient(180deg, rgba(245, 158, 11, 0.08), rgba(255, 255, 255, 0)),
    var(--bg-card);
}

.week-card-payroll.is-current {
  border-color: rgba(16, 185, 129, 0.28);
  background:
    linear-gradient(180deg, rgba(16, 185, 129, 0.08), rgba(255, 255, 255, 0)),
    var(--bg-card);
}

.week-card-payroll.is-future {
  opacity: 0.9;
}

.week-card-header {
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.week-card-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.week-card-header h4 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
}

.week-card-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.week-card-badge--closed {
  background: rgba(245, 158, 11, 0.14);
  border: 1px solid rgba(245, 158, 11, 0.28);
  color: #fbbf24;
}

.week-card-badge--current {
  background: rgba(16, 185, 129, 0.14);
  border: 1px solid rgba(16, 185, 129, 0.28);
  color: #34d399;
}

.week-card-period {
  font-size: 0.86rem;
  color: var(--text-secondary);
}

.week-card-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.week-card-block {
  padding: 16px;
  background: var(--bg-card-muted);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-md);
}

.week-card-block--error {
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.18);
  color: #fca5a5;
}

.week-card-row {
  padding: 8px 0;
  color: var(--text-secondary);
}

.week-card-row strong {
  color: var(--text-primary);
  font-size: 1rem;
}

.week-card-total {
  margin-top: 10px;
  padding-top: 12px;
  border-top: 1px solid rgba(59, 130, 246, 0.18);
}

.week-card-total span:first-child {
  color: var(--text-primary);
  font-size: 0.95rem;
  font-weight: 600;
}

.week-card-total span:last-child {
  color: #34d399;
  font-size: 1.2rem;
}

.period-empty-state {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 220px;
  padding: 28px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.015), rgba(255, 255, 255, 0)),
    var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  color: var(--text-secondary);
  text-align: center;
}

.period-empty-state__inner {
  max-width: 360px;
}

.period-empty-state__icon {
  margin-bottom: 14px;
  color: var(--text-muted);
}

.period-empty-state__title {
  margin: 0 0 10px;
  color: var(--text-primary);
  font-size: 1.08rem;
}

.period-empty-state__copy {
  margin: 0;
  line-height: 1.6;
}

.period-status-card {
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.015), rgba(255, 255, 255, 0)),
    var(--bg-card);
  box-shadow: var(--shadow-soft);
  text-align: center;
}

.period-status-card--closed {
  border-color: rgba(245, 158, 11, 0.24);
  background:
    linear-gradient(180deg, rgba(245, 158, 11, 0.08), rgba(255, 255, 255, 0)),
    var(--bg-card);
}

.period-status-card--future {
  border-color: rgba(59, 130, 246, 0.22);
  background:
    linear-gradient(180deg, rgba(59, 130, 246, 0.08), rgba(255, 255, 255, 0)),
    var(--bg-card);
}

.period-status-icon {
  margin-bottom: 12px;
  color: var(--text-muted);
}

.period-status-title {
  margin: 0 0 8px;
  color: var(--text-primary);
  font-size: 1.08rem;
}

.period-status-copy {
  margin: 0;
  color: var(--text-secondary);
  line-height: 1.6;
}

.period-status-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 18px;
}

.action-bar {
  justify-content: flex-start;
  gap: 12px;
}

.btn-payroll {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 18px;
  border: 1.5px solid;
  border-radius: 10px;
  background: transparent;
  font-weight: 600;
  font-size: 0.875rem;
  transition: background 180ms, border-color 180ms, box-shadow 180ms, transform 150ms, color 180ms;
}

.btn-payroll:disabled {
  opacity: 0.42;
}

.btn-payroll:not(:disabled):hover {
  transform: translateY(-1px);
}

.btn-payroll-green {
  background: rgba(16, 185, 129, 0.1);
  border-color: rgba(16, 185, 129, 0.35);
  color: #34d399;
  box-shadow: none;
}

.btn-payroll-green:not(:disabled):hover {
  background: rgba(16, 185, 129, 0.16);
  box-shadow: 0 6px 18px rgba(16, 185, 129, 0.16);
}

.btn-payroll-blue {
  background: rgba(59, 130, 246, 0.1);
  border-color: rgba(59, 130, 246, 0.35);
  color: #60a5fa;
  box-shadow: none;
}

.btn-payroll-blue:not(:disabled):hover {
  background: rgba(59, 130, 246, 0.16);
  box-shadow: 0 6px 18px rgba(59, 130, 246, 0.16);
}

.btn-payroll-purple {
  background: rgba(139, 92, 246, 0.1);
  border-color: rgba(139, 92, 246, 0.35);
  color: #c4b5fd;
  box-shadow: none;
}

.btn-payroll-purple:not(:disabled):hover {
  background: rgba(139, 92, 246, 0.16);
  box-shadow: 0 6px 18px rgba(139, 92, 246, 0.16);
}

.btn-payroll-red,
.history-delete-button {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.35);
  color: #f87171;
  box-shadow: none;
}

.btn-payroll-red:not(:disabled):hover,
.history-delete-button:hover {
  background: rgba(239, 68, 68, 0.16);
  box-shadow: 0 6px 18px rgba(239, 68, 68, 0.16);
}

#periodStatusMessage {
  margin-bottom: 20px;
}

.payroll-results-section {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.payroll-results-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.payroll-results-title {
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-primary);
}

.payroll-total-summary {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  padding: 14px 16px;
  background: var(--bg-card-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  min-width: 180px;
}

.payroll-total-amount {
  font-size: 1.35rem;
  font-weight: 700;
  color: #34d399;
}

.payroll-total-label {
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.employees-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 20px;
  margin-top: 0;
}

.employee-card {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.015), rgba(255, 255, 255, 0)),
    var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-soft);
}

.employee-card::before {
  display: none;
}

.employee-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-hover);
  box-shadow: var(--shadow-strong);
}

.employee-header {
  padding-bottom: 16px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--border);
}

.employee-avatar {
  width: 54px;
  height: 54px;
  border-radius: 14px;
  background: rgba(59, 130, 246, 0.14);
  color: #60a5fa;
  font-size: 1.5rem;
  box-shadow: none;
}

.employee-info h4 {
  margin-bottom: 4px;
  font-size: 1.05rem;
  color: var(--text-primary);
}

.employee-username {
  font-size: 0.86rem;
  color: var(--text-secondary);
}

.employee-details {
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-top: none;
  padding-top: 0;
  margin-bottom: 0;
}

.detail-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 56px;
  padding: 12px 14px;
  background: var(--bg-card-muted);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-md);
}

.detail-row .label {
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 500;
}

.detail-row .value {
  color: var(--text-primary);
}

.payroll-static-value {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  min-width: 80px;
  font-weight: 600;
  color: var(--text-primary);
}

.payroll-field-input,
.config-input {
  width: 96px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  color: var(--text-primary);
  text-align: right;
}

.payroll-field-input:focus,
.config-input:focus {
  outline: none;
  border-color: rgba(59, 130, 246, 0.45);
  background: rgba(59, 130, 246, 0.05);
}

.payroll-field-input[type="date"],
.config-input[type="date"] {
  text-align: left;
  width: 220px;
}

.detail-row--total {
  margin-top: 4px;
  padding-top: 16px;
  border-color: rgba(59, 130, 246, 0.18);
  background: rgba(59, 130, 246, 0.06);
}

.detail-row--total .label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
}

.detail-row--total .value {
  font-size: 1.2rem;
  font-weight: 700;
  color: #34d399;
}

.payroll-history-item,
.history-card {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.015), rgba(255, 255, 255, 0)),
    var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
}

.payroll-history-item:hover,
.history-card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-strong);
}

.history-period-wrapper {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.history-list-shell {
  max-width: 1400px;
  margin: 0 auto;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.history-empty-state {
  min-height: 240px;
}

.history-card {
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  height: 100%;
}

.history-card--period {
  border-color: rgba(245, 158, 11, 0.24);
}

.history-card--payroll {
  border-color: rgba(16, 185, 129, 0.22);
}

.history-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.history-card-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-primary);
}

.history-card-subtitle {
  margin-top: 4px;
  font-size: 0.86rem;
  color: var(--text-secondary);
}

.history-card-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.history-card-badge--period {
  background: rgba(245, 158, 11, 0.14);
  border: 1px solid rgba(245, 158, 11, 0.28);
  color: #fbbf24;
}

.history-card-badge--payroll {
  background: rgba(16, 185, 129, 0.14);
  border: 1px solid rgba(16, 185, 129, 0.28);
  color: #34d399;
}

.history-card-grid,
.history-card-meta-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.history-card-grid--two,
.history-card-meta-grid--two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.history-card-stat,
.history-card-meta-item {
  padding: 14px 16px;
  background: var(--bg-card-muted);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-md);
}

.history-card-stat-label,
.history-card-meta-label {
  display: block;
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.history-card-stat-value,
.history-card-meta-value {
  display: block;
  margin-top: 8px;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.history-card-stat-value--info {
  color: #60a5fa;
}

.history-card-stat-value--success {
  color: #34d399;
}

.history-card-stat-value--danger {
  color: #f87171;
}

.history-card-actions {
  display: flex;
  justify-content: flex-end;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.history-delete-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1.5px solid rgba(239, 68, 68, 0.35);
  cursor: pointer;
  font-weight: 600;
}

.history-card-details {
  margin-top: -2px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-md);
}

.history-card-details summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--text-primary);
}

.history-card-employees {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.history-card-employee-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.history-card-employee-row:last-child {
  border-bottom: none;
}

.history-card-employee-row span:last-child {
  color: #34d399;
  font-weight: 600;
}

.config-card {
  max-width: 760px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.015), rgba(255, 255, 255, 0)),
    var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
}

.config-card.locked {
  background:
    linear-gradient(180deg, rgba(16, 185, 129, 0.06), rgba(255, 255, 255, 0)),
    var(--bg-card);
  border-color: rgba(16, 185, 129, 0.22);
}

.config-copy {
  margin: 0 0 18px;
  color: var(--text-secondary);
}

.config-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.config-form--stack {
  flex-direction: column;
  align-items: stretch;
}

.config-form-row {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.config-form label {
  min-width: 180px;
  color: var(--text-secondary);
}

.config-input {
  width: 220px;
  min-height: 42px;
  padding: 9px 12px;
  text-align: left;
}

.config-form-actions {
  display: flex;
  gap: 12px;
  margin-top: 18px;
}

.config-status-card {
  margin-top: 18px;
  padding: 14px 16px;
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.18);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.config-status-card strong {
  color: var(--text-primary);
}

.config-locked-info {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.config-locked-info .info {
  line-height: 1.55;
}

.config-timestamp {
  display: block;
  margin-top: 4px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.config-input--compact {
  width: 120px;
}

.payroll-success-card {
  margin-top: 32px;
  padding: 32px 28px;
  border: 1px solid rgba(16, 185, 129, 0.22);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(180deg, rgba(16, 185, 129, 0.08), rgba(255, 255, 255, 0)),
    var(--bg-card);
  box-shadow: var(--shadow-soft);
  text-align: center;
}

.payroll-success-icon {
  margin-bottom: 16px;
  color: #34d399;
}

.payroll-success-title {
  margin: 0 0 12px;
  color: #34d399;
  font-size: 1.18rem;
}

.payroll-success-copy {
  margin: 0;
  color: var(--text-secondary);
  line-height: 1.7;
}

.payroll-success-copy strong {
  color: #34d399;
}

.payroll-success-step {
  margin: 24px auto;
  padding: 16px 18px;
  max-width: 560px;
  border: 1px solid rgba(59, 130, 246, 0.22);
  border-radius: var(--radius-md);
  background: rgba(59, 130, 246, 0.08);
}

.payroll-success-step-title {
  margin-bottom: 8px;
  color: #60a5fa;
  font-size: 1rem;
  font-weight: 600;
}

.payroll-success-step-copy {
  margin: 0;
  color: var(--text-secondary);
  line-height: 1.6;
}

.subcategory-empty-state-text--relaxed {
  line-height: 1.2;
}

.subcategory-empty-state-text--compact {
  line-height: 1;
}

.payroll-modal-note {
  margin-top: 12px;
  color: var(--text-muted);
  line-height: 1.45;
}

.payroll-modal-note--compact {
  line-height: 1.35;
}

.btn-primary,
.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 16px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.875rem;
  transition: background 180ms, border-color 180ms, color 180ms, box-shadow 180ms, transform 150ms;
}

.btn-primary {
  background: rgba(59, 130, 246, 0.1);
  border: 1.5px solid rgba(59, 130, 246, 0.35);
  color: #60a5fa;
}

.btn-primary:hover {
  background: rgba(59, 130, 246, 0.16);
  box-shadow: 0 6px 18px rgba(59, 130, 246, 0.16);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.04);
  border: 1.5px solid var(--border);
  color: var(--text-secondary);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.07);
  border-color: var(--border-hover);
  color: var(--text-primary);
}

@media (max-width: 980px) {
  .dashboard-header,
  .payroll-results-header,
  .config-locked-info {
    flex-direction: column;
    align-items: flex-start;
  }

  .history-card-grid,
  .history-card-meta-grid,
  .history-card-grid--two,
  .history-card-meta-grid--two {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 860px) {
  .obrot-content {
    padding: 24px 24px 32px;
  }

  .action-bar {
    justify-content: stretch;
  }

  .btn-payroll {
    width: 100%;
  }

  .employees-grid {
    grid-template-columns: 1fr;
  }

  .config-form-row {
    flex-direction: column;
    align-items: stretch;
  }

  .config-form label,
  .config-input,
  .payroll-field-input[type="date"] {
    width: 100%;
    min-width: 0;
  }
}

@media (max-width: 720px) {
  .topbar {
    padding: 0 14px;
  }

  .topbar-center {
    display: none;
  }

  .weeks-grid,
  .history-period-wrapper {
    grid-template-columns: 1fr;
  }

  .week-card-title-row,
  .history-card-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .payroll-total-summary {
    width: 100%;
    align-items: flex-start;
  }

  .detail-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .payroll-static-value,
  .payroll-field-input {
    width: 100%;
    text-align: left;
  }
}
