/* =====================================================
   THEME (pod styl jak na screenie)
   ===================================================== */
:root{
  --bg: #f3f6fb;
  --panel: #eef3fb;
  --card: #ffffff;
  --text: #0b1220;
  --muted: #5c6b82;

  --border: rgba(11, 18, 32, 0.12);
  --shadow: 0 10px 26px rgba(11, 18, 32, 0.08);

  --blue: #0b5cff;
  --blue-dark: #0847c8;
  --blue-soft: rgba(11, 92, 255, 0.12);

  --danger: #d11a2a;

  --focus: rgba(11, 92, 255, 0.28);
  --radius: 8px;
  --radius-sm: 6px;
}

/* =====================================================
   RESET
   ===================================================== */
*{ box-sizing: border-box; }
html, body{ height: 100%; }
body{
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, "Noto Sans", sans-serif;
  color: var(--text);
  background: var(--bg);
}

/* =====================================================
   APP LAYOUT (sidebar + content)
   ===================================================== */
.app{
  min-height: 100vh;
  display: grid;
  grid-template-columns: 320px 1fr;
  background: var(--bg);
}

.app__content{
  padding: 28px 28px;
}

.content-wrap{
  max-width: 760px;
  margin: 0 auto;
}

/* =====================================================
   KARTY / SEKCJE
   ===================================================== */
.card{
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
}

h1{
  margin: 0 0 8px 0;
  font-size: 22px;
  font-weight: 900;
  letter-spacing: -0.2px;
}

h2{
  margin: 0 0 8px 0;
  font-size: 18px;
  font-weight: 900;
}

p{
  margin: 0 0 12px 0;
  color: var(--muted);
  line-height: 1.5;
}

/* =====================================================
   FORMULARZE
   ===================================================== */
.form{
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 12px;
}

.field{
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field span{
  font-size: 12px;
  font-weight: 800;
  color: rgba(11, 18, 32, 0.65);
}

.field input,
.field select,
.field textarea{
  width: 100%;
  padding: 12px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(11, 18, 32, 0.18);
  background: #ffffff;
  outline: none;
  font-size: 14px;
  transition: border-color .15s ease, box-shadow .15s ease;
}

.field input:focus,
.field select:focus,
.field textarea:focus{
  border-color: rgba(11, 92, 255, 0.85);
  box-shadow: 0 0 0 4px var(--focus);
}

.alert{
  border: 1px solid rgba(209, 26, 42, 0.35);
  background: rgba(209, 26, 42, 0.08);
  color: #8b0f1b;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  margin: 12px 0 14px;
  font-size: 14px;
}

/* =====================================================
   PRZYCISKI
   ===================================================== */
.btn{
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-weight: 900;
  font-size: 14px;
  cursor: pointer;
  transition: background .15s ease, transform .06s ease, box-shadow .15s ease, border-color .15s ease;
}

.btn-primary{
  color: #fff;
  background: var(--blue);
  box-shadow: 0 8px 18px rgba(11, 92, 255, 0.22);
}

.btn-primary:hover{
  background: var(--blue-dark);
  box-shadow: 0 10px 22px rgba(11, 92, 255, 0.26);
}

.btn-primary:active{ transform: translateY(1px); }

.btn-ghost{
  color: var(--blue);
  background: transparent;
  border-color: rgba(11, 92, 255, 0.25);
}

.btn-ghost:hover{
  background: rgba(11, 92, 255, 0.06);
}

/* =====================================================
   DROBNE ELEMENTY
   ===================================================== */
.badge{
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(11, 92, 255, 0.25);
  background: var(--blue-soft);
  color: rgba(11, 92, 255, 0.95);
  font-size: 12px;
  font-weight: 900;
}

.footer{
  margin-top: 18px;
  font-size: 12px;
  color: rgba(92, 107, 130, 0.85);
}

/* =====================================================
   USER MENU (dropdown) + MODAL
   ===================================================== */
.userbar{
  position: relative;
  display: inline-flex;
  width: 100%;
}

.userbar__btn{
  width: 100%;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(11, 18, 32, 0.12);
  background: rgba(255,255,255,0.80);
  cursor: pointer;
  font-weight: 900;
}

.userbar__btn:hover{
  border-color: rgba(11, 92, 255, 0.25);
  background: rgba(255,255,255,0.95);
}

.userbar__avatar{
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--blue);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  letter-spacing: 0.6px;
}

.userbar__meta{
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.1;
  min-width: 0;
}

.userbar__name{
  font-size: 13px;
  color: rgba(11, 18, 32, 0.92);
  max-width: 180px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.userbar__role{
  font-size: 12px;
  color: rgba(92, 107, 130, 0.90);
  font-weight: 800;
}

.userbar__chev{
  margin-left: auto;
  opacity: 0.7;
  font-size: 12px;
}

.userbar__menu{
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: 230px;
  background: #fff;
  border: 1px solid rgba(11, 18, 32, 0.12);
  border-radius: var(--radius-sm);
  box-shadow: 0 10px 26px rgba(11, 18, 32, 0.12);
  padding: 6px;
  display: none;
  z-index: 80;
}

.userbar__menu.is-open{ display: block; }

.userbar__item{
  width: 100%;
  display: flex;
  align-items: center;
  padding: 10px 10px;
  border-radius: var(--radius-sm);
  border: 0;
  background: transparent;
  cursor: pointer;
  text-decoration: none;
  color: rgba(11, 18, 32, 0.92);
  font-weight: 900;
  font-size: 13px;
}

.userbar__item:hover{
  background: rgba(11, 92, 255, 0.08);
  color: rgba(11, 92, 255, 1);
}

.userbar__item--danger{
  color: rgba(209, 26, 42, 0.95);
}

.userbar__item--danger:hover{
  background: rgba(209, 26, 42, 0.08);
  color: rgba(209, 26, 42, 1);
}

/* MODAL */
.modal{
  position: fixed;
  inset: 0;
  display: none;
  z-index: 200;
}

.modal.is-open{ display: block; }

.modal__overlay{
  position: absolute;
  inset: 0;
  background: rgba(11, 18, 32, 0.45);
}

.modal__panel{
  position: relative;
  width: min(760px, 92vw);
  background: #fff;
  border: 1px solid rgba(11, 18, 32, 0.14);
  border-radius: var(--radius);
  box-shadow: 0 18px 50px rgba(11, 18, 32, 0.25);
  margin: 10vh auto 0;
  overflow: hidden;
}

.modal__header{
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(11, 18, 32, 0.10);
}

.modal__title{
  font-weight: 1000;
  font-size: 14px;
}

.modal__close{
  border: 1px solid rgba(11, 18, 32, 0.12);
  background: #fff;
  border-radius: var(--radius-sm);
  width: 34px;
  height: 34px;
  cursor: pointer;
  font-weight: 900;
}

.modal__body{ padding: 16px; }

.modal__footer{
  padding: 14px 16px;
  border-top: 1px solid rgba(11, 18, 32, 0.10);
  display: flex;
  justify-content: flex-end;
}

/* profile */
.profile{
  display: grid;
  grid-template-columns: 70px 1fr;
  gap: 14px;
  align-items: start;
}

.profile__avatar{
  width: 64px;
  height: 64px;
  border-radius: var(--radius-sm);
  background: var(--blue);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 1000;
  letter-spacing: 1px;
}

.profile__grid{ display: grid; gap: 10px; }

.profile__row{
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 12px;
  padding: 10px 10px;
  border: 1px solid rgba(11, 18, 32, 0.10);
  border-radius: var(--radius-sm);
  background: #fff;
}

.profile__label{
  color: rgba(92, 107, 130, 0.95);
  font-size: 12px;
  font-weight: 900;
}

.profile__value{
  color: rgba(11, 18, 32, 0.92);
  font-size: 13px;
  font-weight: 900;
  word-break: break-word;
}

/* =====================================================
   TABS w modalu Ustawienia
   ===================================================== */
.tabs{
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(11, 18, 32, 0.10);
}

.tab{
  appearance: none;
  border: 1px solid rgba(11, 18, 32, 0.12);
  background: rgba(11, 92, 255, 0.06);
  color: rgba(11, 18, 32, 0.86);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-weight: 1000;
  font-size: 13px;
  cursor: pointer;
}

.tab:hover{
  border-color: rgba(11, 92, 255, 0.25);
  color: rgba(11, 92, 255, 1);
}

.tab.is-active{
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}

.tab-panel{ display: none; }
.tab-panel.is-active{ display: block; }

.panel-card{
  border: 1px solid rgba(11, 18, 32, 0.10);
  border-radius: var(--radius);
  background: #fff;
  padding: 14px;
}

.panel-title{
  font-weight: 1000;
  font-size: 14px;
  margin-bottom: 10px;
}

.panel-hint{
  margin-top: 10px;
  color: rgba(92, 107, 130, 0.90);
  font-size: 12px;
  font-weight: 700;
}

/* key-value list */
.kv{ display: grid; gap: 10px; }

.kv__row{
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 12px;
  padding: 10px 10px;
  border: 1px solid rgba(11, 18, 32, 0.10);
  border-radius: var(--radius-sm);
}

.kv__label{
  color: rgba(92, 107, 130, 0.95);
  font-size: 12px;
  font-weight: 900;
}

.kv__value{
  color: rgba(11, 18, 32, 0.92);
  font-size: 13px;
  font-weight: 900;
  word-break: break-word;
}

/* permissions list */
.perm-list{
  margin: 10px 0 0;
  padding-left: 18px;
  color: rgba(11, 18, 32, 0.86);
  font-weight: 800;
  line-height: 1.55;
}

.perm-list li{ margin: 6px 0; }

/* =====================================================
   LISTA KONT (zakładka Konta)
   ===================================================== */
.accounts{
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

/* wiersz konta (klikany) */
.account-item{
  width: 100%;
  display: grid;
  grid-template-columns: 42px 1fr auto;
  align-items: center;
  gap: 12px;

  border: 1px solid rgba(11, 18, 32, 0.10);
  border-radius: var(--radius-sm);
  background: rgba(11, 92, 255, 0.04);
  padding: 10px 10px;

  cursor: pointer;
  text-align: left;
}

.account-item:hover{
  border-color: rgba(11, 92, 255, 0.22);
  background: rgba(11, 92, 255, 0.07);
}

.account-item__avatar{
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background: var(--blue);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 1000;
  letter-spacing: 0.8px;
}

.account-item__meta{
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.account-item__name{
  font-weight: 1000;
  color: rgba(11, 18, 32, 0.92);
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.account-item__sub{
  color: rgba(92, 107, 130, 0.92);
  font-weight: 800;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.account-item__badge{
  border: 1px solid rgba(11, 92, 255, 0.22);
  background: rgba(11, 92, 255, 0.10);
  color: rgba(11, 92, 255, 1);
  border-radius: 999px;
  padding: 6px 10px;
  font-weight: 1000;
  font-size: 12px;
}

/* =====================================================
   LOGIN PAGE – wyśrodkowana karta
   ===================================================== */
.login-page{
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

.login-card{
  width: 100%;
  max-width: 440px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
}

.brand{
  display:flex;
  gap: 12px;
  align-items:center;
  margin-bottom: 14px;
}

.logo{
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  background: var(--blue);
}

.brand-text h1{
  margin: 0 0 2px 0;
  font-size: 18px;
  font-weight: 900;
}

.brand-text p{
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

/* =====================================================
   RESPONSYWNOŚĆ
   ===================================================== */
@media (max-width: 980px){
  .app{ grid-template-columns: 1fr; }
  .app__content{ padding: 18px 14px; }
  .content-wrap{ max-width: 820px; }
}

@media (max-width: 520px){
  .profile{ grid-template-columns: 1fr; }
  .profile__row{ grid-template-columns: 1fr; }
  .kv__row{ grid-template-columns: 1fr; }

  .account-item{
    grid-template-columns: 42px 1fr;
  }
  .account-item__badge{
    grid-column: 1 / -1;
    width: fit-content;
  }
}
