/* ============================================================
   VKART prace.vkart.pl — Main CSS
   Paleta: granat #1a2540, stal #3d5a80, biały, akcenty
   ============================================================ */

:root {
  --navy:      #1a2540;
  --navy-dark: #111827;
  --steel:     #3d5a80;
  --steel-lt:  #6b8cae;
  --bg:        #f4f6f9;
  --surface:   #ffffff;
  --border:    #e2e8f0;
  --border-md: #cbd5e1;
  --text:      #1e293b;
  --text-muted:#64748b;
  --text-sm:   #94a3b8;

  --green:  #16a34a;  --green-bg:  #dcfce7;  --green-t: #15803d;
  --amber:  #d97706;  --amber-bg:  #fef3c7;  --amber-t: #92400e;
  --red:    #dc2626;  --red-bg:    #fee2e2;   --red-t:   #991b1b;
  --blue:   #2563eb;  --blue-bg:   #dbeafe;   --blue-t:  #1d4ed8;
  --purple: #7c3aed;  --purple-bg: #ede9fe;  --purple-t:#5b21b6;
  --teal:   #0d9488;  --teal-bg:   #ccfbf1;  --teal-t:  #0f766e;
  --gray:   #6b7280;  --gray-bg:   #f3f4f6;  --gray-t:  #374151;

  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
}

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

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---- NAVBAR ---- */
.navbar {
  background: var(--navy);
  height: 56px;
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  gap: 2rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,.3);
}

.navbar-brand { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.nav-logo     { height: 28px; }
.nav-title    { color: #fff; font-size: 16px; font-weight: 600; letter-spacing: -.01em; }
.nav-dot      { color: var(--steel-lt); }

.nav-links {
  display: flex;
  gap: .25rem;
  list-style: none;
  flex: 1;
}
.nav-links a {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: .4rem .75rem;
  color: rgba(255,255,255,.65);
  text-decoration: none;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  transition: color .15s, background .15s;
}
.nav-links a:hover, .nav-links a.active {
  color: #fff;
  background: rgba(255,255,255,.1);
}
.nav-links a.active { background: rgba(255,255,255,.15); }

.nav-user {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
  flex-shrink: 0;
}
.nav-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--steel);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 13px;
}
.nav-user-info { display: flex; flex-direction: column; }
.nav-user-name { color: #fff; font-size: 13px; font-weight: 500; line-height: 1.2; }
.nav-user-role { color: rgba(255,255,255,.45); font-size: 11px; }
.btn-logout {
  color: rgba(255,255,255,.5);
  padding: .3rem;
  border-radius: var(--radius);
  display: flex;
  transition: color .15s, background .15s;
}
.btn-logout:hover { color: #fff; background: rgba(255,255,255,.1); }

/* ---- MAIN ---- */
.main-content { flex: 1; padding: 1.5rem; max-width: 1400px; width: 100%; margin: 0 auto; }

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  gap: 1rem;
}
.page-title { font-size: 20px; font-weight: 600; color: var(--navy); }
.page-sub   { color: var(--text-muted); font-size: 13px; margin-top: 2px; }

/* ---- FOOTER ---- */
.site-footer {
  background: var(--navy-dark);
  color: rgba(255,255,255,.35);
  font-size: 12px;
  padding: .75rem 1.5rem;
  display: flex;
  gap: .5rem;
  align-items: center;
}
.footer-sep { opacity: .4; }

/* ---- ALERTS ---- */
.alert {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .75rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-size: 13px;
}
.alert-success { background: var(--green-bg); color: var(--green-t); border: 1px solid #bbf7d0; }
.alert-error   { background: var(--red-bg);   color: var(--red-t);   border: 1px solid #fecaca; }
.alert-info    { background: var(--blue-bg);  color: var(--blue-t);  border: 1px solid #bfdbfe; }
.alert-warning { background: var(--amber-bg); color: var(--amber-t); border: 1px solid #fde68a; }
.alert-close   { background: none; border: none; cursor: pointer; font-size: 18px; line-height: 1; color: inherit; opacity: .6; padding: 0 .25rem; }
.alert-close:hover { opacity: 1; }

/* ---- BADGES ---- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
}
.badge-green  { background: var(--green-bg);  color: var(--green-t); }
.badge-amber  { background: var(--amber-bg);  color: var(--amber-t); }
.badge-red    { background: var(--red-bg);    color: var(--red-t); }
.badge-blue   { background: var(--blue-bg);   color: var(--blue-t); }
.badge-purple { background: var(--purple-bg); color: var(--purple-t); }
.badge-teal   { background: var(--teal-bg);   color: var(--teal-t); }
.badge-gray   { background: var(--gray-bg);   color: var(--gray-t); }

/* ---- KARTY (metric cards) ---- */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.25rem 1rem;
  box-shadow: var(--shadow);
}
.card-label { font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em; margin-bottom: .4rem; }
.card-value { font-size: 26px; font-weight: 600; color: var(--navy); line-height: 1.1; }
.card-sub   { font-size: 12px; color: var(--text-muted); margin-top: .3rem; }
.card.card-warn  { border-left: 3px solid var(--amber); }
.card.card-alert { border-left: 3px solid var(--red); }
.card.card-good  { border-left: 3px solid var(--green); }

/* ---- TABELA ---- */
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.table-toolbar {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .875rem 1rem;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.table-wrap table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.table-wrap th {
  background: var(--bg);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: .6rem .875rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table-wrap td {
  padding: .65rem .875rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.table-wrap tr:last-child td { border-bottom: none; }
.table-wrap tr:hover td { background: #f8fafc; }

.col-vk     { font-family: 'JetBrains Mono', monospace; font-size: 12px; font-weight: 500; color: var(--steel); }
.col-name   { font-weight: 500; max-width: 220px; }
.col-name small { display: block; color: var(--text-muted); font-weight: 400; font-size: 11px; }
.col-money  { font-family: 'JetBrains Mono', monospace; font-size: 12px; text-align: right; }
.col-money.text-red { color: var(--red); }
.col-date   { color: var(--text-muted); white-space: nowrap; font-size: 12px; }

.overdue-red  td { background: #fff5f5 !important; }
.overdue-amb  td { background: #fffbeb !important; }

/* ---- PRZYCISKI ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: .45rem .9rem;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  text-decoration: none;
  transition: background .15s, box-shadow .15s, opacity .15s;
  line-height: 1;
}
.btn-primary   { background: var(--steel);  color: #fff; border-color: var(--steel); }
.btn-primary:hover { background: var(--navy); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border-md); }
.btn-secondary:hover { background: var(--bg); }
.btn-danger    { background: var(--red); color: #fff; }
.btn-danger:hover { opacity: .85; }
.btn-sm { padding: .3rem .65rem; font-size: 12px; }
.btn-icon { padding: .3rem .4rem; }

/* ---- FILTRY ---- */
.filters {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
  align-items: center;
  flex: 1;
}
.filter-input, .filter-select {
  height: 32px;
  padding: 0 .625rem;
  border: 1px solid var(--border-md);
  border-radius: var(--radius);
  font-size: 13px;
  background: var(--surface);
  color: var(--text);
  outline: none;
}
.filter-input:focus, .filter-select:focus { border-color: var(--steel); box-shadow: 0 0 0 3px rgba(61,90,128,.12); }
.filter-input { min-width: 200px; }

/* ---- FORMULARZ ---- */
.form-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  max-width: 900px;
}
.form-section { margin-bottom: 1.5rem; }
.form-section-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  padding-bottom: .5rem;
  margin-bottom: 1rem;
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: .875rem 1.25rem;
}
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group.full { grid-column: 1 / -1; }
.form-label { font-size: 12px; font-weight: 500; color: var(--text-muted); }
.form-control {
  height: 36px;
  padding: 0 .75rem;
  border: 1px solid var(--border-md);
  border-radius: var(--radius);
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.form-control:focus { border-color: var(--steel); box-shadow: 0 0 0 3px rgba(61,90,128,.12); }
textarea.form-control { height: 90px; padding: .5rem .75rem; resize: vertical; }
.form-control-url {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
}

/* ---- ONEDRIVE LINK ---- */
.onedrive-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--steel);
  text-decoration: none;
  font-size: 12px;
  padding: 3px 8px;
  border: 1px solid var(--border-md);
  border-radius: 6px;
  transition: background .15s, color .15s;
}
.onedrive-link:hover { background: var(--blue-bg); color: var(--blue-t); border-color: #93c5fd; }
.onedrive-link svg { flex-shrink: 0; }

/* ---- DETAIL PAGE ---- */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 1.25rem;
  align-items: start;
}
.detail-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.detail-card-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
}
.detail-rows { padding: .5rem 0; }
.detail-row {
  display: flex;
  padding: .5rem 1.25rem;
  border-bottom: 1px solid var(--border);
  align-items: flex-start;
  gap: .5rem;
}
.detail-row:last-child { border-bottom: none; }
.detail-key   { min-width: 140px; font-size: 12px; color: var(--text-muted); flex-shrink: 0; }
.detail-value { font-size: 13px; font-weight: 500; word-break: break-word; }

/* ---- PAGINATION ---- */
.pagination {
  display: flex;
  align-items: center;
  gap: .25rem;
  padding: .75rem 1rem;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-muted);
}
.pagination a {
  padding: .3rem .6rem;
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text);
  border: 1px solid var(--border-md);
}
.pagination a:hover  { background: var(--bg); }
.pagination a.active { background: var(--steel); color: #fff; border-color: var(--steel); }
.pagination-info { margin-left: auto; font-size: 12px; }

/* ---- LOGIN ---- */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--navy);
}
.login-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.login-logo {
  text-align: center;
  margin-bottom: 2rem;
}
.login-logo-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--navy);
  letter-spacing: -.02em;
}
.login-logo-sub { color: var(--text-muted); font-size: 13px; margin-top: 4px; }
.login-label { display: block; font-size: 12px; font-weight: 500; color: var(--text-muted); margin-bottom: 5px; }
.login-input {
  width: 100%;
  height: 42px;
  padding: 0 .875rem;
  border: 1.5px solid var(--border-md);
  border-radius: var(--radius);
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  outline: none;
  margin-bottom: 1rem;
  transition: border-color .15s, box-shadow .15s;
}
.login-input:focus { border-color: var(--steel); box-shadow: 0 0 0 3px rgba(61,90,128,.15); }
.login-btn {
  width: 100%;
  height: 42px;
  background: var(--navy);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
  font-family: inherit;
}
.login-btn:hover { background: var(--steel); }
.login-error { background: var(--red-bg); color: var(--red-t); border: 1px solid #fecaca; padding: .6rem .875rem; border-radius: var(--radius); font-size: 13px; margin-bottom: 1rem; }

/* ---- OVERDUE TABLE ---- */
.overdue-days-red  { color: var(--red);   font-weight: 600; }
.overdue-days-amb  { color: var(--amber); font-weight: 600; }
.overdue-days-ok   { color: var(--green); }

/* ---- RESPONSIVE ---- */
@media (max-width: 768px) {
  .navbar { padding: 0 1rem; gap: 1rem; }
  .nav-user-info { display: none; }
  .nav-links a span { display: none; }
  .main-content { padding: 1rem; }
  .detail-grid { grid-template-columns: 1fr; }
  .cards-grid { grid-template-columns: repeat(2, 1fr); }
}
