/* ===========================================================================
   styles.css — базовая тема КСВ Сервис
   Светлый, воздушный интерфейс: шрифт Ubuntu, мягкие тени, тонкие границы.
   =========================================================================== */

:root {
  /* --- Фирменные цвета --- */
  --navy:        #10213c;
  --blue:        #1668c9;
  --blue-600:    #1257ab;
  --blue-50:     #eef4fd;
  --blue-100:    #dbe8fa;
  --accent:      #0d9d9d;
  --accent-600:  #0a8080;
  --accent-50:   #e6f6f6;

  /* --- Нейтральные --- */
  --bg:          #f7f8fa;
  --surface:     #ffffff;
  --surface-2:   #fbfcfd;
  --text:        #14213d;
  --text-soft:   #667085;
  --text-faint:  #98a2b3;
  --line:        #e9edf2;
  --line-strong: #dde3ea;

  /* --- Статусные --- */
  --green:       #12996b;  --green-50:  #e6f7f0;
  --yellow:      #d99413;  --yellow-50: #fdf5e5;
  --red:         #dc4a4d;  --red-50:    #fdeded;

  /* --- Тени: мягкие, почти незаметные --- */
  --shadow-xs:   0 1px 2px rgba(16,24,40,.05);
  --shadow:      0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.06);
  --shadow-md:   0 2px 4px rgba(16,24,40,.05), 0 6px 16px rgba(16,24,40,.07);
  --shadow-lg:   0 8px 24px rgba(16,24,40,.10), 0 24px 48px rgba(16,24,40,.10);

  --radius-sm:   8px;
  --radius:      12px;
  --radius-lg:   16px;
  --sidebar-w:   252px;
  --ring:        0 0 0 3px rgba(22,104,201,.14);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }

body {
  font-family: 'Ubuntu', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
  letter-spacing: -0.005em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5 { letter-spacing: -0.02em; font-weight: 700; line-height: 1.25; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
svg { width: 20px; height: 20px; }
::selection { background: var(--blue-100); }

/* Тонкие скроллбары */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d7dde5; border-radius: 99px; border: 3px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #c3ccd7; }

/* ---------------------------- Кнопки ------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid transparent; border-radius: 10px; padding: 9px 16px;
  font-size: 14px; font-weight: 500; color: var(--text); background: var(--surface);
  border-color: var(--line-strong); box-shadow: var(--shadow-xs);
  transition: background .15s, border-color .15s, box-shadow .15s, transform .08s;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-2); border-color: #cfd7e0; }
.btn:active { transform: translateY(.5px); }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }

.btn--primary { background: var(--blue); color: #fff; border-color: var(--blue); box-shadow: var(--shadow-xs); }
.btn--primary:hover { background: var(--blue-600); border-color: var(--blue-600); }
.btn--accent { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn--accent:hover { background: var(--accent-600); border-color: var(--accent-600); }
.btn--ghost { background: transparent; border-color: transparent; color: var(--text-soft); box-shadow: none; }
.btn--ghost:hover { background: #eff2f6; border-color: transparent; color: var(--text); }
.btn--sm { padding: 6px 12px; font-size: 13px; border-radius: 8px; }
.btn--block { width: 100%; }
.btn svg { width: 17px; height: 17px; }
.btn:disabled { opacity: .55; pointer-events: none; }

/* --------------------------- Поля форм ----------------------------------- */
.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 500; font-size: 13px; margin-bottom: 6px; color: var(--text); }

.input, .textarea, .select {
  width: 100%; border: 1px solid var(--line-strong); border-radius: 10px;
  padding: 10px 13px; font-size: 14px; font-family: inherit;
  background: var(--surface); color: var(--text);
  transition: border-color .15s, box-shadow .15s;
  box-shadow: var(--shadow-xs);
}
.input::placeholder, .textarea::placeholder { color: var(--text-faint); }
.input:hover, .textarea:hover, .select:hover { border-color: #cfd7e0; }
.input:focus, .textarea:focus, .select:focus { outline: none; border-color: var(--blue); box-shadow: var(--ring); }
.textarea { resize: vertical; min-height: 84px; line-height: 1.5; }
.select { appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23667085' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center; background-size: 16px; padding-right: 36px;
}

/* --------------------------- Бейджи -------------------------------------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 9px; border-radius: 7px; font-size: 12px; font-weight: 500;
  border: 1px solid transparent; line-height: 1.5;
}
.badge--work,  .badge--blue   { background: var(--blue-50);   color: var(--blue-600);  border-color: var(--blue-100); }
.badge--await, .badge--yellow { background: var(--yellow-50); color: #9a6a10;          border-color: #f6e6c4; }
.badge--postponed, .badge--red{ background: var(--red-50);    color: #b3393c;          border-color: #f7d4d5; }
.badge--green                 { background: var(--green-50);  color: #0c7a54;          border-color: #c9ecdd; }
.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; flex-shrink: 0; }

/* --------------------------- Карточки ------------------------------------ */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  transition: box-shadow .18s, border-color .18s, transform .18s;
}

/* ============================ Каркас кабинета ============================= */
.app { display: flex; min-height: 100vh; }

/* --- Светлый сайдбар --- */
.sidebar {
  width: var(--sidebar-w); flex-shrink: 0;
  background: var(--surface); border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  position: fixed; inset: 0 auto 0 0; height: 100vh; z-index: 40;
}
.sidebar__brand { padding: 20px 18px 16px 23px; display: flex; align-items: center; justify-content: flex-start; }
.sidebar__brand img { width: 100%; max-width: 152px; height: auto; }

.nav { padding: 6px 12px; flex: 1; overflow-y: auto; }
.nav__item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 11px; border-radius: 9px; margin-bottom: 2px;
  color: var(--text-soft); font-weight: 500; font-size: 14px;
  cursor: pointer; transition: background .14s, color .14s; user-select: none;
}
.nav__item:hover { background: #f2f5f8; color: var(--text); }
.nav__item.active { background: var(--blue-50); color: var(--blue-600); font-weight: 600; }
.nav__item svg { width: 18px; height: 18px; opacity: .85; }
.nav__item.active svg { opacity: 1; }

.sidebar__foot { padding: 12px; border-top: 1px solid var(--line); }
.sidebar__foot .btn { justify-content: flex-start; padding-left: 3px; gap: 10px; }
.sidebar__user { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; padding: 0 4px; }
.sidebar__user .ava {
  width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, var(--blue), #2f86e0);
  color: #fff; display: grid; place-items: center; font-weight: 500; font-size: 13px;
}
.sidebar__user b { font-size: 13.5px; font-weight: 600; display: block; line-height: 1.3; }
.sidebar__user small { color: var(--text-faint); font-size: 12px; }

.main { flex: 1; margin-left: var(--sidebar-w); display: flex; flex-direction: column; min-width: 0; }

.topbar {
  height: 62px; background: rgba(255,255,255,.85); backdrop-filter: saturate(1.6) blur(8px);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 26px; position: sticky; top: 0; z-index: 30;
}
.topbar h1 { font-size: 18px; font-weight: 700; }
.topbar__right { display: flex; align-items: center; gap: 12px; }
.hamburger { display: none; background: none; border: none; color: var(--text); font-size: 19px; padding: 6px; border-radius: 8px; }
.hamburger:hover { background: #f2f5f8; }
.role-switch[hidden] { display: none !important; }

.content { padding: 26px; flex: 1; max-width: 1500px; width: 100%; }

.view { display: none; }
.view.active { display: block; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.content > * { animation: rise .28s cubic-bezier(.22,.9,.36,1); }

.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; gap: 14px; flex-wrap: wrap; }
.page-head h2 { font-size: 19px; }

.fab {
  width: 38px; height: 38px; border-radius: 10px; flex-shrink: 0;
  background: var(--blue); color: #fff; border: none;
  display: grid; place-items: center; box-shadow: var(--shadow-md);
  transition: background .15s, transform .12s;
}
.fab:hover { background: var(--blue-600); transform: translateY(-1px); }
.fab svg { width: 19px; height: 19px; }

/* --------------------------- Таблицы ------------------------------------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
table.tbl { width: 100%; border-collapse: collapse; }
.tbl th {
  text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--text-faint); font-weight: 600; padding: 12px 18px;
  border-bottom: 1px solid var(--line); background: var(--surface-2);
}
.tbl td { padding: 14px 18px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: none; }
.tbl tbody tr { transition: background .12s; }
.tbl tbody tr:hover td { background: var(--surface-2); }

/* --------------------------- Модальные окна ------------------------------ */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(16,33,60,.32); backdrop-filter: blur(3px);
  display: grid; place-items: center; z-index: 100; padding: 20px;
  animation: fadeIn .16s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.985); } to { opacity: 1; transform: none; } }

.modal {
  background: var(--surface); border-radius: var(--radius-lg); width: 100%; max-width: 470px;
  box-shadow: var(--shadow-lg); max-height: 90vh; display: flex; flex-direction: column;
  animation: pop .22s cubic-bezier(.22,.9,.36,1);
}
.modal--wide { max-width: 940px; }
.modal__head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.modal__head h3 { font-size: 16.5px; }
.modal__close {
  background: none; border: none; font-size: 20px; line-height: 1; color: var(--text-faint);
  width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; flex-shrink: 0;
  transition: background .14s, color .14s;
}
.modal__close:hover { background: #f2f5f8; color: var(--text); }
.modal__body { padding: 22px; overflow-y: auto; }
.modal__actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }

/* --------------------------- Уведомления --------------------------------- */
#toast-wrap { position: fixed; right: 22px; bottom: 22px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast {
  background: var(--navy); color: #fff; padding: 12px 18px; border-radius: 11px;
  box-shadow: var(--shadow-lg); font-weight: 500; font-size: 13.5px;
  opacity: 0; transform: translateY(10px); transition: opacity .25s, transform .25s; max-width: 340px;
}
.toast--in { opacity: 1; transform: none; }
.toast--success { background: #0c7a54; }
.toast--error   { background: #c2393c; }
.toast--info    { background: var(--blue-600); }

/* --------------------------- Утилиты ------------------------------------- */
.grid { display: grid; gap: 16px; }
.muted { color: var(--text-soft); }

.search-bar { position: relative; max-width: 400px; flex: 1; min-width: 220px; }
.search-bar input {
  width: 100%; padding: 10px 14px 10px 38px; border: 1px solid var(--line-strong);
  border-radius: 10px; font-size: 14px; font-family: inherit; background: var(--surface);
  box-shadow: var(--shadow-xs); transition: border-color .15s, box-shadow .15s;
}
.search-bar input:focus { outline: none; border-color: var(--blue); box-shadow: var(--ring); }
.search-bar svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--text-faint); pointer-events: none; }

.empty { text-align: center; color: var(--text-faint); padding: 48px 20px; font-size: 14px; }

.tag-list { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 7px;
  padding: 3px 9px; font-size: 12px; color: var(--text-soft); font-weight: 500;
}

/* --------------------------- Адаптив ------------------------------------- */
@media (max-width: 900px) {
  .btn-label { display: none; }          /* на телефоне оставляем только иконку */
  .sidebar { transform: translateX(-100%); transition: transform .26s cubic-bezier(.22,.9,.36,1); box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: none; }
  .main { margin-left: 0; }
  .hamburger { display: grid; place-items: center; }
  .content { padding: 18px 16px; }
  .topbar { padding: 0 16px; }
  .modal__body { padding: 18px; }
}
