:root{
  --bg1:#120a2a;
  --bg2:#0b1637;

  --sidebar:#1b0f3b;
  --sidebar2:#23124a;

  --card: rgba(255,255,255,.06);
  --stroke: rgba(255,255,255,.10);

  --text:#f3f4f6;
  --muted: rgba(243,244,246,.65);

  --accent:#7c3aed;
  --accent2:#3b82f6;
  --danger:#ef4444;

  --radius:18px;

  /* единая высота всех контролов */
  --ctrl-h: 44px;

  /* ✅ ширина сайдбара */
  --sidebar-w: 320px;
}

*{box-sizing:border-box}
html,body{height:100%}

body{
  margin:0;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Arial, sans-serif;
  color:var(--text);
  background:
    radial-gradient(900px 500px at 20% 10%, rgba(124,58,237,.25), transparent 60%),
    radial-gradient(900px 500px at 80% 20%, rgba(59,130,246,.18), transparent 60%),
    linear-gradient(180deg, var(--bg1), var(--bg2));
}

a{color:inherit;text-decoration:none}

/* =========================
   LAYOUT
   ========================= */
.app{
  display:grid;
  grid-template-columns: var(--sidebar-w) 1fr; /* ✅ было 260px */
  height:100vh;
  overflow:hidden;
  min-height:0;
}

/* ===== Sidebar ===== */
.sidebar{
  display:flex;
  flex-direction:column;
  height:100vh;
  min-height:0;
  overflow:hidden;
  background: linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,.02));
  border-right:1px solid var(--stroke);
  padding:18px 14px;
}

.brand{
  display:flex;
  align-items:center;
  gap:10px;
  padding:10px 12px;
}

.logo{
  width:34px;
  height:34px;
  border-radius:12px;
  background: linear-gradient(135deg, rgba(124,58,237,.9), rgba(59,130,246,.9));
}

.title{font-weight:800; letter-spacing:.2px}
.sub{font-size:12px;color:var(--muted)}

/* ===== NAV ===== */
.nav{
  margin-top:16px;
  display:flex;
  flex-direction:column;
  gap:8px;
  overflow:auto;
  min-height:0;
  padding-right:4px;
}

.nav a{
  display:flex;
  align-items:center;
  gap:10px;
  padding:12px;
  border-radius:14px;
  border:1px solid transparent;
}

.nav a:hover{
  background: rgba(255,255,255,.05);
  border-color: rgba(255,255,255,.06);
}

.nav a.active{
  background: rgba(124,58,237,.18);
  border-color: rgba(124,58,237,.25);
}

.nav .ico{
  width:18px;
  height:18px;
  opacity:.9;
  display:inline-flex;
  align-items:center;
  justify-content:center;
}

/* =========================
   USERBAR (sidebar footer)
   (без рамки вокруг блока; кнопки ниже)
   ========================= */
.userbar{
  margin-top:auto;
  padding-top:14px;
  border-top:1px solid rgba(255,255,255,.10);
}

.userrow{
  display:flex;
  align-items:center;
  gap:12px;
  padding:10px 6px 6px;
  min-width:0;
}

.avatar-lg{
  width:56px;
  height:56px;
  border-radius:999px;
  overflow:hidden;
  flex:0 0 auto;
  background:rgba(255,255,255,.06);
  border:1px solid rgba(255,255,255,.10); /* очень тонкая */
  display:flex;
  align-items:center;
  justify-content:center;
  font-weight:800;
}

.avatar-lg img{
  width:100%;
  height:100%;
  object-fit:cover;
  display:block;
}

.usertext{
  min-width:0;
  flex:1;
}

.uname{
  font-weight:800;
  line-height:1.1;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
  max-width:100%;
}

.urole{
  margin-top:4px;
  font-size:12px;
  color:var(--muted);
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
  max-width:100%;
}

.useractions{
  display:flex;
  gap:10px;
  padding:8px 6px 2px;
}

.useractions .icon-btn{
  width:38px;
  height:38px;
  border-radius:12px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  background:rgba(255,255,255,.06);
  border:1px solid rgba(255,255,255,.10);
  color:inherit;
}

.useractions .icon-btn:hover{
  background:rgba(255,255,255,.10);
}

.useractions .icon-btn.logout-btn:hover{
  color: rgba(239,68,68,.95);
  border-color: rgba(239,68,68,.35);
}

/* ===== Main ===== */
.main{
  padding:22px;
  height:100vh;
  overflow:auto;
  min-height:0;
  min-width:0; /* ✅ чтобы контент не ломал grid */
}

/* =========================
   CARD / HEADER
   ========================= */
.card{
  background:var(--card);
  border:1px solid var(--stroke);
  border-radius:var(--radius);
  padding:18px;
  box-shadow: 0 12px 30px rgba(0,0,0,.25);
  overflow: visible;
}

.header{
  display:flex;
  justify-content:space-between;
  align-items:center;
  margin-bottom:20px;
}

.page-title{ font-size:28px; font-weight:900; }
.subtitle{ color:var(--muted); margin-top:4px; }

/* =========================
   BUTTONS (единые)
   ========================= */
.btn{
  height: var(--ctrl-h);
  padding: 0 16px;
  border-radius:14px;
  border:1px solid var(--stroke);
  background: rgba(0,0,0,.15);
  color:var(--text);
  cursor:pointer;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  font-size:14px;
  font-weight:700;
  line-height:1;
  text-decoration:none;
  white-space:nowrap;
}

.btn:hover{ background: rgba(255,255,255,.06); }

.btn.primary{
  background: linear-gradient(135deg,var(--accent),var(--accent2));
  border-color: rgba(255,255,255,.10);
}

.btn.small{
  height: 38px;
  padding: 0 12px;
  font-size: 13px;
  border-radius: 12px;
}

.btn.danger{
  background:rgba(239,68,68,.18);
}

/* =========================
   INPUTS (общие)
   ========================= */
input, button { font-family: inherit; }
input::placeholder{ color:rgba(243,244,246,.45); }

/* =========================
   FILTERS
   ========================= */
.filters{
  display:flex;
  gap:10px;
  margin-bottom:18px;
  flex-wrap:wrap;
  align-items:center;
  overflow: visible;
}

.filters input{
  height: var(--ctrl-h);
  padding: 0 12px;
  border-radius:12px;
  border:1px solid var(--stroke);
  background:rgba(0,0,0,.20);
  color:var(--text);
  outline:none;

  width: 380px;
  max-width: 60vw;
}

.filters .icon-action{
  width: var(--ctrl-h);
  height: var(--ctrl-h);
  border-radius: 14px;
  border: 1px solid var(--stroke);
  background: rgba(0,0,0,.15);
  display: inline-flex;
  align-items:center;
  justify-content:center;
  cursor:pointer;
  color: var(--text);
}

.filters .icon-action:hover{ background: rgba(255,255,255,.06); }
.filters .icon-action.danger:hover{
  color: rgba(239,68,68,.95);
  border-color: rgba(239,68,68,.35);
}

.filter-e .cselect{ width:180px; }

/* =========================
   TABLE
   ========================= */
.table{
  width:100%;
  table-layout: fixed;
  border-collapse:collapse;
}

.table th{
  text-align:center;
  text-transform: uppercase;
  letter-spacing: .06em;
  padding:12px;
  color:var(--muted);
  font-size:13px;
  font-weight:700;
}

.th-center{ text-align:center; }
.th-right{ text-align:right; }
.td-center{ text-align:center; }

.table td{
  padding:14px 12px;
  border-top:1px solid rgba(255,255,255,.06);
  vertical-align:middle;
}

.emp{
  min-width:0;
  display:flex;
  align-items:center;
  gap:10px;
}

.emp .emp-name{
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
  max-width:100%;
}

.status{
  font-size:12px;
  padding:3px 10px;
  border-radius:999px;
  border:1px solid var(--stroke);
  background: rgba(255,255,255,.03);
}

.status.active{
  background:rgba(34,197,94,.18);
  border-color: rgba(34,197,94,.25);
}

.status.inactive{
  background:rgba(239,68,68,.18);
  border-color: rgba(239,68,68,.25);
}

.money{ font-weight:800; }

.actions{
  display:flex;
  gap:6px;
  justify-content:flex-end;
  align-items:center;
}

.icon-btn{
  width:34px;
  height:34px;
  border-radius:10px;
  border:1px solid var(--stroke);
  display:inline-flex;
  align-items:center;
  justify-content:center;
  background:rgba(0,0,0,.20);
  cursor:pointer;
  color:var(--text);
}

.icon-btn:hover{ background:rgba(255,255,255,.06); }

.icon-btn.danger{
  background:rgba(239,68,68,.22);
  border-color: rgba(239,68,68,.35);
}

/* =========================
   FORMS
   ========================= */
.form{ margin-top: 10px; }

.grid-2{
  display:grid;
  grid-template-columns: repeat(2, minmax(260px, 1fr));
  gap: 16px 22px;
  overflow: visible;
}

.field{
  display:flex;
  flex-direction:column;
  gap: 6px;
  min-width: 0;
  position: relative;
  margin-top: 6px;
}

.field label{
  font-size: 13px;
  color: var(--muted);
}

.field input{
  height: var(--ctrl-h);
  padding: 0 12px;
  border-radius: 12px;
  border: 1px solid var(--stroke);
  background: rgba(0,0,0,.20);
  color: var(--text);
  outline: none;
  width:100%;
}

.field input:focus{
  border-color: rgba(124,58,237,.45);
  box-shadow: 0 0 0 3px rgba(124,58,237,.18);
}

.field input[type="date"]{ color-scheme: dark; }

.form-actions{
  margin-top: 18px;
  display:flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items:center;
}

/* ✅ FILE INPUT (чтобы не съезжал) */
.field input[type="file"]{
  height:auto;
  padding:10px 12px;
}

/* =========================
   ALERT
   ========================= */
.alert{
  margin: 12px 0 6px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(239,68,68,.35);
  background: rgba(239,68,68,.18);
  color: var(--text);
}

.alert.success{
  border:1px solid rgba(34,197,94,.35);
  background: rgba(34,197,94,.14);
  color: rgba(240,253,244,.95);
}

/* =========================
   ACCESSIBILITY
   ========================= */
.sr-only{
  position:absolute !important;
  width:1px; height:1px;
  padding:0; margin:-1px;
  overflow:hidden;
  clip: rect(0,0,0,0);
  white-space:nowrap;
  border:0;
}

/* =========================
   CUSTOM SELECT
   ========================= */
.cselect{
  position: relative;
  display: block;
  width: 100%;
  z-index: 20;
}

.cselect.open{ z-index: 9998; }

.cselect-btn{
  width: 100%;
  height: var(--ctrl-h);
  padding: 0 12px;
  border-radius: 12px;
  border: 1px solid var(--stroke);
  background: rgba(0,0,0,.20);
  color: var(--text);
  cursor: pointer;

  display:flex;
  align-items:center;
  gap: 10px;

  font-size: 14px;
  font-weight: 600;
  line-height: 1;
}

.cselect-btn:hover{ background: rgba(255,255,255,.06); }

.cselect-label{
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.cselect-caret{
  margin-left: auto;
  opacity: .75;
  font-size: 12px;
}

.cselect.open .cselect-btn{
  border-color: rgba(124,58,237,.45);
  box-shadow: 0 0 0 3px rgba(124,58,237,.18);
}

.cselect-menu{
  position:absolute;
  top: calc(100% + 8px);
  left: 0;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;

  z-index: 9999;
  background: rgba(12, 16, 26, .92);
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 14px;
  padding: 6px;
  box-shadow: 0 18px 40px rgba(0,0,0,.35);
  display:none;
}

.cselect.open .cselect-menu{ display:block; }

.cselect-opt{
  padding: 10px 10px;
  border-radius: 12px;
  cursor: pointer;
  user-select: none;
  color: var(--text);
}

.cselect-opt:hover{ background: rgba(255,255,255,.06); }

.cselect-opt.active{
  background: rgba(124,58,237,.18);
  border: 1px solid rgba(124,58,237,.25);
}

/* =========================
   CUSTOM DATEPICKER
   ========================= */
.dfield{
  position: relative;
  min-width: 0;
  overflow: visible;
}

.date-input{
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.date-input input{
  width: 100%;
  padding-right: 44px;
}

.date-btn{
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid var(--stroke);
  background: rgba(0,0,0,.20);
  color: var(--text);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.date-btn:hover{ background: rgba(255,255,255,.06); }

.datepicker{
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  left: auto;

  width: 320px;
  max-width: min(360px, 100%);

  z-index: 30000;
  background: rgba(12,16,26,.92);
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 14px;
  padding: 10px;
  box-shadow: 0 18px 40px rgba(0,0,0,.35);
  display: none;
}

.dfield.open .datepicker{ display: block; }

.dp-head{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.dp-title{ font-weight: 800; }

.dp-nav{ display: flex; gap: 6px; }

.dp-ico{
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid var(--stroke);
  background: rgba(0,0,0,.20);
  color: var(--text);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.dp-ico:hover{ background: rgba(255,255,255,.06); }

.dp-grid{
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}

.dp-dow{
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  padding: 6px 0;
}

.dp-day{
  height: 34px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,.08);
  background: rgba(255,255,255,.04);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
}

.dp-day:hover{ background: rgba(255,255,255,.08); }
.dp-day.muted{ opacity: .45; }
.dp-day.today{ border-color: rgba(59,130,246,.35); }

.dp-day.selected{
  background: rgba(124,58,237,.22);
  border-color: rgba(124,58,237,.35);
}

.dp-day.disabled{
  opacity: .35;
  pointer-events: none;
}

/* =========================
   UPLOAD (PROFILE)
   ========================= */
.upload{
  display:flex;
  gap:12px;
  align-items:center;
  flex-wrap:wrap;
}

.upload-name{
  font-size:13px;
  color:var(--muted);
  max-width: 520px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.upload-preview{
  margin-top:10px;
  display:flex;
  align-items:center;
  gap:10px;
}

#avatar-preview{
  width:96px;
  height:96px;
  border-radius:50%;
  object-fit:cover;
  border:1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.06);
}


/* центрируем карточку */
.login-wrap{
  min-height:100vh;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:20px;
}

.login-card{
  width:100%;
  max-width:480px;
}

/* header: лого по центру + подзаголовок по центру */
.login-head{
  text-align:center;
  margin: 2px 0 18px;
}

.login-logo{
  display:flex;
  justify-content:center;
  margin-bottom:10px;
  margin-top:10px;
}

.login-logo img{
  height:52px;
  width:auto;
  display:block;
}

.login-sub{
  color:var(--muted);
  margin-top:0;
  font-size:14px;
}

/* кнопка справа */
.login-actions{
  display:flex;
  justify-content:flex-end;
  margin-top:18px;
}

.dashbord-logo{
  display:flex;
  justify-content:center;
  margin-bottom:10px;
  margin-top:10px;
}

.dashbord-logo img{
  height:52px;
  width:auto;
  display:block;
}

/* ЛОГО кликабельное (dashboard) */
.brand a{display:block; width:100%;}
.dashbord-logo img{max-width:100%; height:auto; display:block;}

/* Секции меню */
.nav{
  margin-top:16px;
  display:flex;
  flex-direction:column;
  gap:10px;
}

/* Блок секции */
.nav-section{
  display:flex;
  flex-direction:column;
  gap:8px;

  padding:12px 8px 14px 8px;
  border-radius:16px;

  background: rgba(255,255,255,.02);
  border:1px solid rgba(255,255,255,.05);

  position:relative;
}

/* Заголовок секции */
.nav-title{
  display:flex;
  align-items:center;
  gap:10px;

  padding:4px 8px;

  color: rgba(243,244,246,.9);
  font-weight:800;
  letter-spacing:.3px;
  user-select:none;
  text-transform:uppercase;
}

/* иконка секции */
.nav-title .sec-ico{
  width:22px;
  height:22px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  opacity:.95;
}

/* Пункты внутри секции */
.nav-items{
  display:flex;
  flex-direction:column;
  gap:6px;
}

/* ссылки */
.nav-items a{
  display:flex;
  align-items:center;
  gap:10px;

  padding:6px 12px;
  border-radius:12px;

  border:1px solid transparent;

  transition:all .15s ease;
}

/* hover */
.nav-items a:hover{
  background: rgba(255,255,255,.06);
  border-color: rgba(255,255,255,.08);
}

/* активный пункт */
.nav-items a.active{
  background: rgba(124,58,237,.22);
  border-color: rgba(124,58,237,.35);
}

/* =========================
   SHIFTS CALENDAR (all + emp)
   ========================= */

.shifts-card { padding: 18px; }

.shifts-head{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
  flex-wrap:wrap;
}

.shifts-title{ margin:0 0 6px 0; }
.shifts-sub{ opacity:.85; }

.shifts-form{
  display:flex;
  gap:8px;
  align-items:center;
  flex-wrap:wrap;
}

.shifts-legend{ margin-top:12px; opacity:.85; }

/* =========================
   Calendar base
   ========================= */
.cal{
  margin-top:14px;
  border:1px solid rgba(255,255,255,.08);
  border-radius:18px;
  overflow:hidden;
  background:rgba(255,255,255,.02);
}

.cal-head{
  display:grid;
  grid-template-columns:repeat(7,1fr);
  padding:10px;
  background:rgba(255,255,255,.03);
  border-bottom:1px solid rgba(255,255,255,.06);
  font-weight:800;
  text-align:center;
}
.cal-head .wknd{ opacity:.7; }

.cal-grid{
  display:grid;
  grid-template-columns:repeat(7,1fr);
}

.cal-cell{
  min-height:130px;
  padding:10px;
  border-right:1px solid rgba(255,255,255,.06);
  border-bottom:1px solid rgba(255,255,255,.06);
  position:relative;
}
.cal-cell:nth-child(7n){ border-right:none; }
.cal-cell.is-weekend{ background:rgba(255,255,255,.015); }
.cal-cell.is-empty{ background:rgba(255,255,255,.008); }

.cal-day{
  position:absolute;
  top:8px;
  right:10px;
  font-weight:800;
  opacity:.75;
}

/* =========================
   Emp mode (one big button)
   ========================= */
.shift-btn{
  width:100%;
  height:60px;
  border-radius:14px;
  border:1px solid rgba(255,255,255,.10);
  background:rgba(255,255,255,.03);
  color:inherit;
  cursor:pointer;
  font-size:22px;
  font-weight:900;
  transition: all .15s ease;
  margin-top:18px;
}
.shift-btn:hover{ background:rgba(255,255,255,.06); }
.shift-btn:disabled{ opacity:.65; cursor: default; }

/* =========================
   All mode (list of employees in a day)
   ========================= */
.cal-all{
  display:flex;
  flex-direction:column;
  gap:6px;
  margin-top:18px;
  max-height:92px;
  overflow:auto;
  padding-right:2px;
}

/* compact pill per employee */
.shift-pill{
  width:100%;
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:8px;

  border-radius:12px;
  border:1px solid rgba(255,255,255,.10);
  background:rgba(255,255,255,.03);
  color:inherit;
  cursor:pointer;
  padding:8px 10px;
  text-align:left;
}
.shift-pill:hover{ background:rgba(255,255,255,.06); }
.shift-pill:disabled{ opacity:.65; cursor: default; }

.shift-pill .pill-name{
  font-weight:700;
  opacity:.9;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  max-width:150px;
}
.shift-pill .pill-val{
  font-weight:900;
  min-width:18px;
  text-align:right;
}

/* =========================
   State colors (shared)
   ========================= */
.shift-btn.t-full, .shift-pill.t-full{
  background: rgba(34,197,94,.22);
  border-color: rgba(34,197,94,.35);
}
.shift-btn.t-half, .shift-pill.t-half{
  background: rgba(245,158,11,.22);
  border-color: rgba(245,158,11,.35);
}
.shift-btn.t-vac, .shift-pill.t-vac{
  background: rgba(99,102,241,.22);
  border-color: rgba(99,102,241,.35);
}

/* =========================
   RESPONSIVE
   ========================= */
@media (max-width:900px){
  .app{
    grid-template-columns:1fr;
    height:auto;
    overflow:visible;
    min-height:100vh;
  }
  .sidebar{ display:none; }
  .main{
    padding:16px;
    height:auto;
    overflow:visible;
  }
  .grid-2{
    grid-template-columns:1fr;
  }
  .filters input{
    width: 100%;
    max-width: 100%;
  }
}