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

:root {
  --bg:        #f1f5f9;
  --sidebar:   #ffffff;
  --card:      #ffffff;
  --border:    #e2e8f0;
  --border-lt: #f1f5f9;
  --text:      #0f172a;
  --text2:     #334155;
  --muted:     #94a3b8;
  --blue:      #3b82f6;
  --blue-d:    #2563eb;
  --blue-bg:   #eff6ff;
  --indigo:    #6366f1;
  --green:     #10b981;
  --amber:     #f59e0b;
  --red:       #ef4444;
  --sh:        0 1px 3px rgba(15,23,42,.07), 0 1px 2px rgba(15,23,42,.04);
  --sh-md:     0 4px 8px rgba(15,23,42,.08), 0 2px 4px rgba(15,23,42,.04);
  --r:         10px;
  --r-sm:      7px;
  --sw:        220px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', Helvetica, sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  height: 100vh;
  overflow: hidden;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* SIDEBAR */
.sidebar {
  width: var(--sw);
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}
.sidebar-logo {
  padding: 16px 16px 14px;
  display: flex; align-items: center; gap: 10px;
  border-bottom: 1px solid var(--border-lt);
}
.logo-mark {
  width: 36px; height: 36px;
  background: #060d1f;
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; overflow: hidden;
  box-shadow: 0 2px 6px rgba(0,0,0,.18);
}
.logo-mark img { width: 32px; height: 32px; object-fit: contain; }
.logo-text { font-size: 15px; font-weight: 700; color: var(--text); letter-spacing: -.3px; }
.logo-sub  { font-size: 10.5px; color: var(--muted); margin-top: 1px; }

.sidebar-nav { flex: 1; padding: 10px 8px; overflow-y: auto; }
.nav-section { margin-top: 6px; }
.nav-label {
  font-size: 10.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .8px;
  color: var(--muted); padding: 8px 10px 3px;
}
a.nav-item, .nav-item {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 10px;
  border-radius: var(--r-sm);
  cursor: pointer;
  color: var(--text2);
  font-size: 13px; font-weight: 500;
  transition: all .15s;
  margin-bottom: 1px;
  user-select: none;
  text-decoration: none;
}
.nav-item:hover { background: var(--bg); color: var(--text); }
.nav-item.active { background: var(--blue-bg); color: var(--blue-d); font-weight: 600; }
.nav-icon { width: 16px; text-align: center; opacity: .75; display: flex; align-items: center; justify-content: center; }
.nav-item.active .nav-icon { opacity: 1; }

.sidebar-footer {
  border-top: 1px solid var(--border-lt);
  padding: 12px 14px;
  display: flex; align-items: center; gap: 10px;
  cursor: pointer; transition: background .15s;
  text-decoration: none;
}
.sidebar-footer:hover { background: var(--bg); }

.avatar {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, #f59e0b, #ef4444);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: #fff; flex-shrink: 0;
}
.av-name { font-size: 12.5px; font-weight: 600; color: var(--text); }
.av-role { font-size: 11px; color: var(--muted); }

/* MAIN */
.main { flex: 1; overflow-y: auto; }

.view-inner { max-width: 800px; margin: 0 auto; }

.page-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 24px; gap: 12px; }
.page-title { font-size: 22px; font-weight: 700; letter-spacing: -.4px; color: var(--text); }
.page-sub   { font-size: 13px; color: var(--muted); margin-top: 2px; }

/* BUTTONS */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 15px;
  border-radius: var(--r-sm); border: none; cursor: pointer;
  font-size: 13px; font-weight: 500; transition: all .15s;
  white-space: nowrap; font-family: inherit; line-height: 1.4;
  text-decoration: none;
}
.btn-primary { background: var(--blue-d); color: #fff; box-shadow: 0 1px 2px rgba(37,99,235,.25); }
.btn-primary:hover { background: #1d4ed8; }
.btn-outline { background: var(--card); color: var(--text2); border: 1px solid var(--border); box-shadow: var(--sh); }
.btn-outline:hover { background: var(--bg); }
.btn-ghost { background: transparent; color: var(--blue-d); border: 1.5px dashed #bfdbfe; font-size: 12.5px; }
.btn-ghost:hover { background: var(--blue-bg); border-color: var(--blue); }
.btn-danger { background: transparent; color: var(--red); border: 1px solid transparent; font-size: 12px; padding: 5px 10px; }
.btn-danger:hover { background: #fef2f2; border-color: #fecaca; }

.icon-btn {
  background: none; border: none;
  color: var(--muted); cursor: pointer;
  padding: 6px 8px; border-radius: var(--r-sm);
  font-size: 15px; transition: all .15s; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
}
.icon-btn:hover { background: var(--bg); color: var(--text2); }

.del-btn {
  width: 30px; height: 30px;
  background: none; border: none; color: var(--muted); cursor: pointer;
  border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  transition: all .15s; flex-shrink: 0;
}
.del-btn:hover { color: var(--red); background: #fef2f2; }

/* CARD */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--r); box-shadow: var(--sh); }
.card-pad { padding: 22px 24px; margin-bottom: 16px; }

/* DASHBOARD */
.dash-hero {
  background: linear-gradient(135deg, #1e3a8a 0%, #3730a3 60%, #4f46e5 100%);
  border-radius: 14px; padding: 26px 30px; margin-bottom: 22px;
  color: #fff; position: relative; overflow: hidden;
}
.dash-hero::before {
  content: ''; position: absolute; top: -40px; right: -20px;
  width: 200px; height: 200px; background: rgba(255,255,255,.06); border-radius: 50%;
}
.dash-hero::after {
  content: ''; position: absolute; bottom: -60px; right: 100px;
  width: 130px; height: 130px; background: rgba(255,255,255,.04); border-radius: 50%;
}
.hero-badge {
  display: inline-flex; align-items: center; gap: 5px;
  background: rgba(255,255,255,.15); border: 1px solid rgba(255,255,255,.2);
  padding: 3px 10px; border-radius: 20px; font-size: 11.5px; font-weight: 500; margin-bottom: 10px;
}
.dash-hero h2 { font-size: 20px; font-weight: 700; margin-bottom: 8px; letter-spacing: -.4px; }
.dash-hero p  { font-size: 13px; opacity: .75; line-height: 1.7; max-width: 500px; }

.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 22px; }
.stat-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--r);
  padding: 18px 20px; box-shadow: var(--sh);
  display: flex; align-items: flex-start; gap: 14px; transition: box-shadow .15s;
}
.stat-card:hover { box-shadow: var(--sh-md); }
.stat-icon { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.ic-blue   { background: #dbeafe; }
.ic-indigo { background: #e0e7ff; }
.ic-green  { background: #d1fae5; }
.ic-amber  { background: #fef3c7; }
.stat-body { flex: 1; min-width: 0; }
.stat-label { font-size: 11.5px; font-weight: 500; color: var(--muted); margin-bottom: 3px; }
.stat-value { font-size: 26px; font-weight: 700; color: var(--text); letter-spacing: -1px; line-height: 1; }
.stat-sub   { font-size: 11px; color: var(--muted); margin-top: 4px; }

.section-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); margin-bottom: 14px; }

.recent-table { width: 100%; border-collapse: collapse; }
.recent-table th { padding: 8px 12px; text-align: left; font-size: 11px; font-weight: 600; color: var(--muted); border-bottom: 1px solid var(--border-lt); }
.recent-table td { padding: 10px 12px; font-size: 13px; border-bottom: 1px solid var(--border-lt); }
.recent-table tr:last-child td { border-bottom: none; }
.recent-table tr:hover td { background: var(--bg); cursor: pointer; }

/* LIST TABS */
.tabs { display: flex; gap: 2px; background: var(--border-lt); border: 1px solid var(--border); border-radius: 8px; padding: 3px; margin-bottom: 16px; width: fit-content; }
a.tab, .tab {
  padding: 5px 18px; border-radius: 6px; cursor: pointer;
  font-size: 13px; font-weight: 500; color: var(--muted);
  transition: all .15s; user-select: none; text-decoration: none;
}
.tab.active { background: var(--card); color: var(--text); box-shadow: var(--sh); }
.tab:hover:not(.active) { color: var(--text2); }

/* TABLE */
.tbl-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-bottom: 1px solid var(--border); gap: 12px;
  background: var(--card); border-radius: var(--r) var(--r) 0 0;
}
.search-box {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg); border: 1.5px solid var(--border);
  border-radius: var(--r-sm); padding: 7px 12px;
  flex: 1; max-width: 360px; transition: all .15s;
}
.search-box:focus-within { background: var(--card); border-color: var(--blue); box-shadow: 0 0 0 3px rgba(59,130,246,.1); }
.search-box input { background: none; border: none; color: var(--text); font-size: 13px; outline: none; width: 100%; font-family: inherit; }
.search-box input::placeholder { color: var(--muted); }
.search-icon { color: var(--muted); flex-shrink: 0; display: flex; align-items: center; }
.tbl-actions { display: flex; align-items: center; gap: 6px; }

table { width: 100%; border-collapse: collapse; }
thead th {
  padding: 10px 14px; text-align: left;
  font-size: 11.5px; font-weight: 600; color: var(--muted);
  background: #f8fafc; border-bottom: 1px solid var(--border); white-space: nowrap;
}
thead th:first-child { padding-left: 16px; }
tbody tr { border-bottom: 1px solid var(--border-lt); cursor: pointer; transition: background .1s; }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: #f8faff; }
tbody td { padding: 12px 14px; font-size: 13px; color: var(--text2); }
tbody td:first-child { padding-left: 16px; }
tbody td strong { color: var(--text); font-weight: 600; }

.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 9px; border-radius: 20px;
  font-size: 11.5px; font-weight: 500; white-space: nowrap;
}
.badge-blue   { background: #dbeafe; color: #1d4ed8; }
.badge-purple { background: #ede9fe; color: #6d28d9; }
.badge-green  { background: #d1fae5; color: #065f46; }

.email-cell { color: var(--blue-d); font-size: 12.5px; }

.row-action-btn {
  background: none; border: none; color: var(--muted); cursor: pointer;
  padding: 4px 8px; border-radius: 4px;
  font-size: 16px; letter-spacing: 1px; line-height: 1; transition: all .15s;
}
.row-action-btn:hover { background: var(--bg); color: var(--text); }

.row-menu {
  position: absolute; right: 0; top: 100%; z-index: 50;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--r-sm); box-shadow: var(--sh-md);
  min-width: 140px; overflow: hidden;
}
a.row-menu-item, button.row-menu-item {
  display: block; width: 100%;
  padding: 8px 14px; font-size: 13px; text-align: left;
  color: var(--text2); background: none; border: none;
  cursor: pointer; font-family: inherit; text-decoration: none;
  transition: background .1s;
}
.row-menu-item:hover { background: var(--bg); }
.row-menu-item.danger { color: var(--red); }

input[type="checkbox"] { accent-color: var(--blue-d); cursor: pointer; width: 14px; height: 14px; }
mark { background: #fef9c3; color: #854d0e; border-radius: 2px; padding: 0 1px; }

.pagination {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; border-top: 1px solid var(--border-lt);
  background: #fafbfc; border-radius: 0 0 var(--r) var(--r);
}
.pg-btn {
  width: 28px; height: 28px; border-radius: 6px;
  border: 1px solid transparent; background: none; color: var(--muted); cursor: pointer;
  font-size: 13px; display: inline-flex; align-items: center; justify-content: center;
  transition: all .15s; font-family: inherit; text-decoration: none;
}
.pg-btn:hover:not([disabled]) { background: var(--card); color: var(--text); border-color: var(--border); }
.pg-btn.active { background: var(--blue-d); color: #fff; border-color: var(--blue-d); }
.pg-btn[disabled] { opacity: .4; cursor: default; }
.pg-controls { display: flex; align-items: center; gap: 3px; }
.pg-info { font-size: 12px; color: var(--muted); }

/* DETAIL / FORM */
.detail-header { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
a.back-btn, .back-btn {
  width: 33px; height: 33px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--r-sm); color: var(--text2);
  cursor: pointer; font-size: 18px;
  display: flex; align-items: center; justify-content: center;
  transition: all .15s; box-shadow: var(--sh); flex-shrink: 0;
  text-decoration: none;
}
.back-btn:hover { background: var(--bg); color: var(--text); }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group.full { grid-column: 1 / -1; }
.form-label { font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.form-label.req::after { content: ' *'; color: var(--blue-d); }

.form-input {
  background: var(--bg); border: 1.5px solid var(--border);
  border-radius: var(--r-sm); color: var(--text); font-size: 13.5px;
  padding: 8px 11px; outline: none; transition: all .15s;
  width: 100%; font-family: inherit;
}
.form-input:focus { border-color: var(--blue); background: var(--card); box-shadow: 0 0 0 3px rgba(59,130,246,.1); }
.form-input::placeholder { color: var(--muted); }
.form-input[readonly] { color: var(--muted); background: var(--border-lt); cursor: default; }

.sel-wrap { position: relative; }
.sel-wrap::after {
  content: '▾'; position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  color: var(--muted); pointer-events: none; font-size: 11px;
}
.form-select {
  background: var(--bg); border: 1.5px solid var(--border);
  border-radius: var(--r-sm); color: var(--text); font-size: 13.5px;
  padding: 8px 32px 8px 11px; outline: none; cursor: pointer;
  width: 100%; -webkit-appearance: none; appearance: none;
  font-family: inherit; transition: all .15s;
}
.form-select:focus { border-color: var(--blue); background: var(--card); box-shadow: 0 0 0 3px rgba(59,130,246,.1); }

.input-pfx {
  display: flex; align-items: center;
  background: var(--bg); border: 1.5px solid var(--border);
  border-radius: var(--r-sm); overflow: hidden; transition: all .15s;
}
.input-pfx:focus-within { border-color: var(--blue); background: var(--card); box-shadow: 0 0 0 3px rgba(59,130,246,.1); }
.pfx-tag { padding: 8px 10px; background: var(--border-lt); border-right: 1.5px solid var(--border); font-size: 12px; color: var(--muted); font-weight: 600; white-space: nowrap; }
.input-pfx input { background: none; border: none; color: var(--text); font-size: 13.5px; padding: 8px 10px; outline: none; flex: 1; font-family: inherit; }

.textarea {
  background: var(--bg); border: 1.5px solid var(--border);
  border-radius: var(--r-sm); color: var(--text);
  font-size: 13.5px; padding: 9px 11px; outline: none;
  resize: vertical; min-height: 90px; width: 100%;
  font-family: inherit; transition: all .15s; line-height: 1.5;
}
.textarea:focus { border-color: var(--blue); background: var(--card); box-shadow: 0 0 0 3px rgba(59,130,246,.1); }
.textarea::placeholder { color: var(--muted); }

.radio-grp { display: flex; gap: 20px; }
.radio-opt { display: flex; align-items: center; gap: 7px; cursor: pointer; font-size: 13.5px; color: var(--text2); }
input[type="radio"] { accent-color: var(--blue-d); width: 15px; height: 15px; cursor: pointer; }
.chk-opt { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; color: var(--text2); padding: 4px 0; }

.field-section {
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .8px;
  color: var(--muted); grid-column: 1 / -1;
  padding-top: 8px; border-top: 1px solid var(--border-lt); margin-top: 4px;
}

/* DETAIL TABS */
.dtabs {
  display: flex; overflow-x: auto; scrollbar-width: none;
  padding: 0 20px; border-bottom: 1px solid var(--border);
  background: var(--bg); border-radius: var(--r) var(--r) 0 0;
}
.dtabs::-webkit-scrollbar { display: none; }
.dtab {
  padding: 12px 16px; cursor: pointer; font-size: 13px; font-weight: 500;
  color: var(--muted); border-bottom: 2px solid transparent;
  white-space: nowrap; transition: all .15s; flex-shrink: 0; margin-bottom: -1px;
}
.dtab.active { color: var(--blue-d); border-bottom-color: var(--blue-d); }
.dtab:hover:not(.active) { color: var(--text2); }

.tab-pane { display: none; padding: 22px; }
.tab-pane.active { display: block; }

/* CONTACT ROWS */
.kontakt-row {
  display: grid; grid-template-columns: 180px 1fr 34px;
  gap: 10px; align-items: end;
  padding: 10px 0; border-bottom: 1px solid var(--border-lt);
}
.kontakt-row:last-of-type { border-bottom: none; }

/* SUB-CARDS */
.sub-card { background: var(--bg); border: 1px solid var(--border); border-radius: var(--r); padding: 16px; margin-bottom: 12px; }
.person-name-grid { display: grid; grid-template-columns: 140px 1fr 1fr; gap: 12px; margin-bottom: 14px; }
.bank-type-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }

/* COMPANY SEARCH (Zefix) */
.company-search {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg); border: 1.5px solid var(--border);
  border-radius: var(--r-sm); padding: 9px 12px; transition: all .15s;
}
.company-search:focus-within { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(59,130,246,.1); background: var(--card); }
.company-search input { flex: 1; background: none; border: none; color: var(--text); font-size: 13px; outline: none; font-family: inherit; }
.company-search input::placeholder { color: var(--muted); }

.zefix-dropdown {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--r); box-shadow: var(--sh-md);
  margin-top: 4px; max-height: 320px; overflow-y: auto;
  z-index: 100; position: relative;
}
.zefix-item {
  padding: 10px 14px; cursor: pointer; transition: background .1s;
  border-bottom: 1px solid var(--border-lt);
}
.zefix-item:last-child { border-bottom: none; }
.zefix-item:hover { background: var(--blue-bg); }
.zefix-name { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 3px; }
.zefix-meta { display: flex; align-items: center; gap: 8px; font-size: 11.5px; color: var(--muted); }
.zefix-badge {
  background: var(--border-lt); color: var(--text2);
  padding: 1px 7px; border-radius: 10px; font-size: 11px; font-weight: 500;
}
.zefix-empty { padding: 18px; text-align: center; font-size: 13px; color: var(--muted); }

/* EMPTY STATE */
.empty { text-align: center; padding: 32px; color: var(--muted); font-size: 13px; }
.empty-icon { margin-bottom: 8px; opacity: .7; }

/* TOAST */
.toast {
  position: fixed; bottom: 22px; right: 22px;
  background: #1e293b; color: #fff;
  padding: 11px 18px; border-radius: 10px;
  font-size: 13px; font-weight: 500;
  z-index: 999; opacity: 0; transform: translateY(8px);
  transition: all .25s; pointer-events: none;
  box-shadow: 0 4px 14px rgba(0,0,0,.2);
  display: flex; align-items: center; gap: 8px;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast-dot { width: 7px; height: 7px; border-radius: 50%; background: #4ade80; flex-shrink: 0; }
