:root {
  --bg: #0b0d12;
  --card: #151a24;
  --border: #273044;
  --text: #f3f6fc;
  --muted: #8e9aae;
  --primary: #5b8cff;
  --input: #0f131c;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 10% 0%, rgba(91, 140, 255, .20), transparent 32%),
    radial-gradient(circle at 90% 100%, rgba(125, 80, 255, .18), transparent 35%),
    var(--bg);
}

.auth-page {
  min-height: 100vh;
  position: relative;
  overflow: hidden;
  display: grid;
  place-items: center;
  padding: 20px;
}

.auth-page::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: .35;
  background:
    linear-gradient(rgba(255,255,255,.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.05) 1px, transparent 1px);
  background-size: 44px 44px;
}

.login-card,
.card {
  position: relative;
  z-index: 2;
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 20px;
  background: rgba(21, 26, 36, .94);
  box-shadow: 0 24px 80px rgba(0,0,0,.35);
}

.login-card {
  width: 100%;
  max-width: 410px;
  padding: 32px;
}

.logo {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  margin-bottom: 22px;
  border-radius: 16px;
  color: white;
  font-weight: 900;
  background: linear-gradient(135deg, #5b8cff, #7b5cff);
}

h1 { margin: 0 0 10px; font-size: 28px; }
h2 { margin: 0; font-size: 18px; }

p {
  color: var(--muted);
  line-height: 1.5;
}

form {
  display: grid;
  gap: 11px;
  margin-top: 22px;
}

input,
select,
textarea,
button {
  width: 100%;
  min-height: 46px;
  border-radius: 12px;
  font: inherit;
}

input,
select,
textarea {
  padding: 0 13px;
  outline: none;
  color: var(--text);
  border: 1px solid var(--border);
  background: var(--input);
}

textarea {
  min-height: 130px;
  padding: 13px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(91,140,255,.14);
}

select option { background: #151a24; }

button {
  border: 0;
  color: white;
  cursor: pointer;
  font-weight: 800;
  background: linear-gradient(135deg, #5b8cff, #755cff);
}

button:hover { filter: brightness(1.08); }

.error {
  min-height: 18px;
  color: #ff6d81;
  font-size: 13px;
}

.quote-card {
  position: absolute;
  z-index: 1;
  width: min(540px, 42vw);
  left: max(30px, calc(50% - 590px));
  top: 50%;
  transform: translateY(-50%);
  padding: 34px;
  border: 1px solid rgba(126,161,255,.22);
  border-radius: 24px;
  background: rgba(27, 35, 55, .58);
  box-shadow: 0 24px 70px rgba(0,0,0,.3);
}

.quote-card p {
  margin: 0;
  color: #edf2ff;
  font-size: clamp(22px, 2.1vw, 34px);
  line-height: 1.2;
  font-weight: 800;
}

.quote-card small {
  display: block;
  margin-top: 18px;
  color: #9aa9c8;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.auth-page .login-card {
  margin-left: min(560px, 44vw);
}

.topbar {
  min-height: 68px;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 28px;
  background: rgba(11, 13, 18, .88);
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.topbar b { font-size: 20px; }
#userInfo { margin-left: auto; color: var(--muted); }

.logout {
  width: auto;
  min-height: 38px;
  padding: 0 15px;
  color: #d5dbea;
  background: #20283a;
  border: 1px solid var(--border);
}

.container {
  width: min(1120px, calc(100% - 36px));
  margin: 0 auto;
  padding: 38px 0 60px;
}

.page-head { margin-bottom: 22px; }
.page-head h1 { margin-bottom: 6px; }

.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
}

.tab {
  width: auto;
  min-height: 42px;
  padding: 0 18px;
  color: var(--muted);
  background: #171d29;
  border: 1px solid var(--border);
}

.tab.active {
  color: white;
  border-color: rgba(110, 148, 255, .5);
  background: linear-gradient(135deg, #416ee2, #684dd2);
}

.tab-content { display: none; }
.tab-content.active { display: block; }

.card { padding: 22px; }

.find-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}

.find-head p {
  margin-top: 6px;
  font-size: 13px;
}

.search-input { width: min(330px, 100%); }

.table-head,
.lead-row {
  display: grid;
  grid-template-columns: 1.15fr 1.15fr 1.2fr 1fr;
  gap: 14px;
  align-items: center;
}

.table-head {
  padding: 20px 8px 10px;
  color: #78869d;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .8px;
  text-transform: uppercase;
}

.lead-row {
  width: 100%;
  min-height: 64px;
  padding: 12px 8px;
  text-align: left;
  color: #bfc9da;
  background: transparent;
  border: 0;
  border-top: 1px solid rgba(255,255,255,.07);
  border-radius: 0;
}

.lead-row:hover {
  color: white;
  background: rgba(105,139,255,.06);
}

.lead-name { color: white; font-weight: 800; }
.lead-username { color: #91adff; }

.modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 18px;
}

.hidden { display: none; }

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3,5,10,.72);
  backdrop-filter: blur(7px);
}

.client-modal-card {
  position: relative;
  z-index: 1;
  width: min(620px, 100%);
  max-height: calc(100vh - 36px);
  overflow: auto;
  padding: 26px;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 22px;
  background: #151a24;
}

.modal-close {
  position: absolute;
  top: 15px;
  right: 15px;
  width: 38px;
  min-height: 38px;
  padding: 0;
  background: #20283a;
  border: 1px solid var(--border);
  font-size: 24px;
}

.modal-client-head { padding-right: 48px; }
.client-id { color: #8da9ff; font-size: 12px; font-weight: 800; }
.modal-client-head h2 { margin: 8px 0; font-size: 27px; }

.client-details {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin: 24px 0;
}

.client-details > div,
.description-box,
.related-item {
  padding: 13px;
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 13px;
  background: #10151f;
}

.client-details span,
.description-box span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
}

.description-box p {
  margin: 0;
  color: #e3e9f5;
  white-space: pre-wrap;
}

.related-title {
  margin: 22px 0 10px;
  color: #dbe5fb;
  font-weight: 800;
}

.related-list {
  display: grid;
  gap: 8px;
}

.related-item {
  display: flex;
  justify-content: space-between;
  gap: 14px;
}

.related-item b { color: #9eb6ff; }
.related-item span { color: var(--muted); font-size: 13px; }

.empty-notes { padding: 14px 0; }

@media (max-width: 850px) {
  .quote-card { display: none; }
  .auth-page .login-card { margin-left: 0; }
  .topbar { padding: 0 16px; }
  .container { width: min(100% - 24px, 1120px); padding-top: 24px; }
}

@media (max-width: 700px) {
  .find-head { align-items: stretch; flex-direction: column; }
  .search-input { width: 100%; }
  .table-head { display: none; }
  .lead-row { grid-template-columns: 1fr 1fr; gap: 8px; padding: 15px 8px; }
  .client-details { grid-template-columns: 1fr; }
  .related-item { align-items: flex-start; flex-direction: column; }
}

.worker-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 14px;
  align-items: center;
  padding: 15px 4px;
  border-top: 1px solid rgba(255,255,255,.07);
}

.worker-row b {
  display: block;
  color: white;
}

.worker-row span {
  color: var(--muted);
  font-size: 13px;
}

.worker-active,
.worker-off {
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px !important;
  font-weight: 800;
}

.worker-active {
  color: #72e6af !important;
  background: rgba(66, 211, 146, .12);
}

.worker-off {
  color: #ff8d9d !important;
  background: rgba(255, 92, 115, .12);
}

.worker-toggle {
  width: auto;
  min-height: 36px;
  padding: 0 14px;
  color: #d5dbea;
  background: #20283a;
  border: 1px solid var(--border);
}

@media (max-width: 600px) {
  .worker-row {
    grid-template-columns: 1fr;
    gap: 9px;
  }

  .worker-toggle {
    width: 100%;
  }
}
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}

.stat-card {
  padding: 18px;
  border: 1px solid rgba(255,255,255,.09);
  border-radius: 16px;
  background: rgba(21,26,36,.9);
}

.stat-card span {
  display: block;
  margin-bottom: 9px;
  color: var(--muted);
  font-size: 13px;
}

.stat-card b {
  color: white;
  font-size: 28px;
}

.funding-box {
  margin: 18px 0;
  padding: 15px;
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 13px;
  background: #10151f;
}

.funding-box > span {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 12px;
}

.status-new { color: #91adff; }
.status-funded { color: #72e6af; }

.funding-controls {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 10px;
  margin-top: 14px;
}

.funding-controls button {
  width: auto;
  padding: 0 16px;
}

.worker-row {
  grid-template-columns: 1.1fr 1.5fr auto auto;
}

.worker-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.worker-stats span {
  padding: 6px 9px;
  border-radius: 9px;
  background: #10151f;
  color: var(--muted);
  font-size: 12px;
}

.worker-stats b {
  color: #dce6ff;
}

@media (max-width: 800px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .funding-controls {
    grid-template-columns: 1fr;
  }

  .funding-controls button {
    width: 100%;
  }

  .worker-row {
    grid-template-columns: 1fr;
  }
}
.stats-page-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.stats-grid-inside {
  grid-template-columns: repeat(3, 1fr);
  margin-top: 18px;
  margin-bottom: 0;
}

.stats-grid-inside .stat-card {
  padding: 14px;
  background: #10151f;
}

.stats-grid-inside .stat-card b {
  font-size: 23px;
}

.leaderboard-card {
  margin-top: 18px;
}

.leaderboard-head,
.leader-row {
  display: grid;
  grid-template-columns: 42px 1.5fr .7fr .7fr .9fr;
  gap: 12px;
  align-items: center;
}

.leaderboard-head {
  padding: 20px 8px 10px;
  color: #78869d;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .8px;
  text-transform: uppercase;
}

.leader-row {
  padding: 13px 8px;
  border-top: 1px solid rgba(255,255,255,.07);
  color: #c7d1e3;
}

.leader-row b {
  display: block;
  color: white;
}

.leader-row small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
}

.leader-place {
  color: #9eb6ff;
  font-weight: 900;
}

.leader-money {
  color: #72e6af;
  font-weight: 800;
}

.leader-me {
  background: rgba(91, 140, 255, .09);
}

@media (max-width: 850px) {
  .stats-page-grid {
    grid-template-columns: 1fr;
  }

  .stats-grid-inside {
    grid-template-columns: 1fr;
  }

  .leaderboard-head {
    display: none;
  }

  .leader-row {
    grid-template-columns: 32px 1fr 1fr;
  }

  .leader-row > span:nth-child(4),
  .leader-row > span:nth-child(5) {
    grid-column: 2;
  }
}

.bonus-card {
  padding: 26px;
}

.bonus-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.bonus-head h2 {
  margin-bottom: 6px;
}

.bonus-head p {
  margin: 0;
}

.bonus-label {
  padding: 7px 10px;
  border: 1px solid rgba(126, 161, 255, .25);
  border-radius: 999px;
  color: #9eb6ff;
  background: rgba(91, 140, 255, .10);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.bonus-text {
  min-height: 120px;
  padding: 20px;
  border: 1px solid rgba(126, 161, 255, .16);
  border-radius: 16px;
  color: #e8efff;
  background:
    linear-gradient(135deg, rgba(91, 140, 255, .10), rgba(117, 92, 255, .07)),
    #10151f;
  white-space: pre-wrap;
  line-height: 1.65;
}

.bonus-admin {
  display: grid;
  gap: 10px;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid rgba(255,255,255,.08);
}

.bonus-admin label {
  color: #cfd9ee;
  font-size: 13px;
  font-weight: 800;
}

.bonus-admin button {
  width: auto;
  min-width: 210px;
  justify-self: start;
  padding: 0 18px;
}

@media (max-width: 600px) {
  .bonus-head {
    flex-direction: column;
  }

  .bonus-admin button {
    width: 100%;
  }
}

.edit-description-button {
  width: auto;
  min-height: 36px;
  margin-top: 14px;
  padding: 0 14px;
  color: #d5dbea;
  background: #20283a;
  border: 1px solid var(--border);
}

.description-editor {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.description-editor textarea {
  min-height: 140px;
}

.description-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.description-actions button {
  width: auto;
  min-height: 38px;
  padding: 0 16px;
}

.description-cancel {
  color: #d5dbea !important;
  background: #20283a !important;
  border: 1px solid var(--border) !important;
}

@media (max-width: 600px) {
  .description-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .description-actions button {
    width: 100%;
  }
}

.worker-clickable {
  cursor: pointer;
}

.worker-clickable:hover {
  border-color: rgba(117, 92, 255, .55);
  background: rgba(117, 92, 255, .06);
}

.worker-stats-modal {
  max-width: 780px;
}

.worker-stats-modal h3 {
  margin: 24px 0 0;
  color: #dbe6ff;
  font-size: 15px;
}

.worker-week-title {
  padding-top: 20px;
  border-top: 1px solid rgba(255,255,255,.08);
}

.client-danger-zone {
  display: flex;
  justify-content: flex-end;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid rgba(255,255,255,.08);
}

.delete-client-button {
  width: auto;
  min-height: 38px;
  padding: 0 16px;
  color: #ffd9df;
  background: rgba(225, 75, 100, .12);
  border: 1px solid rgba(225, 75, 100, .35);
}

.delete-client-button:hover {
  background: rgba(225, 75, 100, .22);
  border-color: rgba(255, 110, 130, .7);
}
/* ===== Материалы ===== */

.materials-card {
  max-width: 980px;
  margin: 0 auto;
}

.materials-top {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.materials-top h2 {
  margin: 0 0 6px;
}

.materials-top p {
  margin: 0;
  color: #91a4c7;
}

.materials-create-form {
  display: flex;
  gap: 10px;
  margin-bottom: 22px;
}

.materials-create-form input {
  flex: 1;
}

.materials-create-form button {
  width: auto;
  min-width: 170px;
  white-space: nowrap;
}

#foldersList {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 14px;
}

.folder-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 13px;
  min-height: 90px;
  padding: 16px;
  border: 1px solid #263452;
  border-radius: 16px;
  background: linear-gradient(135deg, #151d2d, #111724);
  cursor: pointer;
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}

.folder-row:hover {
  transform: translateY(-3px);
  border-color: #6e5cff;
  box-shadow: 0 12px 28px rgba(61, 49, 160, .22);
}

.folder-icon {
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  font-size: 24px;
  background: rgba(104, 89, 255, .17);
  border: 1px solid rgba(126, 108, 255, .35);
}

.folder-info {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.folder-info b {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 16px;
}

.folder-info span {
  color: #91a4c7;
  font-size: 13px;
}

.folder-delete {
  position: absolute;
  top: 12px;
  right: 12px;
  width: auto !important;
  min-width: auto !important;
  padding: 7px 10px !important;
  border: 1px solid rgba(255, 90, 116, .35) !important;
  border-radius: 9px !important;
  background: rgba(255, 76, 104, .12) !important;
  color: #ff8da1 !important;
  font-size: 12px !important;
}

.folder-delete:hover {
  background: rgba(255, 76, 104, .23) !important;
}

/* Окно с фото внутри папки */

.materials-modal-card {
  width: min(960px, calc(100vw - 30px));
  max-height: 88vh;
  overflow: auto;
}

.materials-files-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.material-file {
  overflow: hidden;
  border: 1px solid #263452;
  border-radius: 15px;
  background: #111724;
}

.material-preview {
  display: block;
  width: 100%;
  height: 155px;
  object-fit: cover;
  background: #0b0f17;
}

.material-file-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 12px 0;
}

.material-file-info b {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
}

.material-file-info span {
  color: #91a4c7;
  font-size: 12px;
}

.material-file-actions {
  display: flex;
  gap: 8px;
  padding: 12px;
}

.material-download,
.material-delete {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  min-height: 36px;
  border-radius: 9px;
  text-decoration: none;
  font-size: 13px;
  font-weight: 700;
}

.material-download {
  color: white;
  background: linear-gradient(135deg, #4f8cff, #7358ff);
}

.material-delete {
  border: 1px solid rgba(255, 90, 116, .35);
  background: rgba(255, 76, 104, .12);
  color: #ff8da1;
  cursor: pointer;
}

@media (max-width: 600px) {
  .materials-create-form {
    flex-direction: column;
  }

  .materials-create-form button {
    width: 100%;
  }

  #foldersList {
    grid-template-columns: 1fr;
  }
}
.stats-header{
display:flex;
justify-content:space-between;
align-items:center;
margin-bottom:25px;
gap:20px;
flex-wrap:wrap;
}

.stats-periods{
display:flex;
gap:10px;
}

.period-btn{

padding:10px 18px;

border:none;

border-radius:10px;

background:#1a2333;

color:#fff;

cursor:pointer;

transition:.2s;

font-weight:600;
}

.period-btn:hover{

background:#2d3d59;

}

.period-btn.active{

background:#5b7fff;

}

.stats-page{
    width:100%;
    max-width:1200px;
    margin:0 auto;
}
#tab-stats.active{
    display:flex;
    justify-content:center;
}

.stats-card{

    width:100%;

    max-width:1350px;

    margin:0 auto;

}

#tab-stats.active{

    display:flex;

    justify-content:center;

}

.stats-header{

    display:flex;

    justify-content:space-between;

    align-items:center;

    margin-bottom:35px;

    gap:30px;

    flex-wrap:wrap;

}

.stats-periods{

    display:flex;

    gap:10px;

}

.period-btn{

    border:none;

    background:#20283a;

    color:#fff;

    padding:10px 18px;

    border-radius:10px;

    cursor:pointer;

    transition:.2s;

    font-weight:600;

}

.period-btn:hover{

    background:#30405f;

}

.period-btn.active{

    background:#4f7dff;

}

.stats-sections{

    display:grid;

    grid-template-columns:1fr 1fr;

    gap:45px;

    margin-bottom:40px;

}

.stats-section h3{

    text-align:center;

    margin-bottom:18px;

}

.stats-grid-inside{

    display:grid;

    grid-template-columns:repeat(3,1fr);

    gap:18px;

}

.leaderboard-top{

    margin:30px 0 20px;

}