:root {
  --accent: #2f5496;
  --accent-dark: #1f3a6e;
  --accent-light: #e8eefa;
  --bg: #f4f6fa;
  --surface: #ffffff;
  --border: #e1e5ec;
  --text: #1c2333;
  --text-dim: #6b7280;
  --danger: #c0392b;
  --danger-bg: #fdecea;
  --success: #1e8e5a;
  --success-bg: #e8f7ee;
  --warn: #b8860b;
  --warn-bg: #fdf3dc;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(20, 30, 60, 0.06), 0 1px 2px rgba(20, 30, 60, 0.08);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); }
#app { min-height: 100vh; }

button { font-family: inherit; }
a { color: var(--accent); }

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  padding: 8px 14px; border-radius: 8px; font-size: 14px; cursor: pointer;
  transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--accent-light); border-color: var(--accent); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); }
.btn-danger { color: var(--danger); border-color: #f0c4bf; }
.btn-danger:hover { background: var(--danger-bg); }
.btn-sm { padding: 5px 10px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* --- Login --- */
.login-screen {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, var(--accent-dark), var(--accent) 60%, #4a76c9);
}
.login-card {
  background: var(--surface); border-radius: 16px; padding: 40px 36px; width: 360px;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
}
.login-card h1 { font-size: 20px; margin: 0 0 4px; }
.login-card p.sub { color: var(--text-dim); margin: 0 0 24px; font-size: 14px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; color: var(--text-dim); margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 14px; background: #fff; color: var(--text);
}
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--accent-light); border-color: var(--accent); }
.error-box { background: var(--danger-bg); color: var(--danger); padding: 10px 12px; border-radius: 8px; font-size: 13px; margin-bottom: 14px; }
.hint { color: var(--text-dim); font-size: 12px; margin-top: 4px; }

/* --- Shell layout --- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 230px; background: var(--accent-dark); color: #fff; flex-shrink: 0;
  display: flex; flex-direction: column; padding: 20px 0; position: relative;
}
.sidebar .brand-row {
  display: flex; align-items: center; justify-content: space-between; padding: 0 20px 20px;
  border-bottom: 1px solid rgba(255,255,255,.12); margin-bottom: 12px;
}
.sidebar .brand { font-weight: 700; font-size: 17px; }

.notif-bell {
  position: relative; background: none; border: none; color: rgba(255,255,255,.85); font-size: 18px;
  cursor: pointer; padding: 4px;
}
.notif-badge {
  position: absolute; top: -3px; right: -3px; background: var(--danger); color: #fff; font-size: 10px;
  font-weight: 700; border-radius: 999px; padding: 1px 5px; line-height: 1.3;
}
.notif-panel {
  position: absolute; left: 210px; top: 14px; width: 340px; max-height: 420px; overflow-y: auto;
  background: var(--surface); color: var(--text); border-radius: 10px; box-shadow: 0 16px 40px rgba(0,0,0,.25);
  z-index: 100;
}
.notif-panel-header {
  display: flex; align-items: center; justify-content: space-between; padding: 12px 14px;
  border-bottom: 1px solid var(--border); font-size: 13.5px;
}
.link-btn-sm { background: none; border: none; color: var(--accent); font-size: 12px; cursor: pointer; padding: 0; }
.notif-empty { padding: 20px; text-align: center; color: var(--text-dim); font-size: 13px; }
.notif-list { max-height: 360px; overflow-y: auto; }
.notif-item { padding: 10px 14px; border-bottom: 1px solid var(--border); cursor: default; }
.notif-item:last-child { border-bottom: none; }
.notif-item.unread { background: #eef2fb; cursor: pointer; }
.notif-msg { font-size: 13px; line-height: 1.4; }
.notif-time { font-size: 11px; color: var(--text-dim); margin-top: 4px; }
.sidebar nav a {
  display: block; padding: 10px 20px; color: rgba(255,255,255,.78); text-decoration: none; font-size: 14px;
  border-left: 3px solid transparent;
}
.sidebar nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar nav a.active { background: rgba(255,255,255,.1); color: #fff; border-left-color: #fff; }
.sidebar .spacer { flex: 1; }
.sidebar .user-box { padding: 14px 20px; border-top: 1px solid rgba(255,255,255,.12); font-size: 13px; }
.sidebar .user-box .role { color: rgba(255,255,255,.6); font-size: 12px; }
.sidebar .user-box button { margin-top: 8px; width: 100%; }

.main { flex: 1; padding: 28px 32px; max-width: 1200px; }
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; flex-wrap: wrap; gap: 10px; }
.page-header h2 { margin: 0; font-size: 21px; }
.page-header .actions { display: flex; gap: 8px; flex-wrap: wrap; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 20px; }
.card h3 { margin: 0 0 14px; font-size: 15px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
@media (max-width: 720px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { color: var(--text-dim); font-weight: 600; font-size: 12.5px; text-transform: uppercase; letter-spacing: .02em; }
tbody tr:hover { background: #fafbfd; }
.table-wrap { overflow-x: auto; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-warn { background: var(--warn-bg); color: var(--warn); }
.badge-neutral { background: #eef0f4; color: var(--text-dim); }

.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 16px; }
.filters .field { margin-bottom: 0; min-width: 160px; }

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(20,25,40,.45); display: flex; align-items: center; justify-content: center; z-index: 100;
}
.modal { background: #fff; border-radius: 12px; padding: 24px; width: 440px; max-width: 92vw; max-height: 88vh; overflow-y: auto; box-shadow: 0 24px 60px rgba(0,0,0,.3); }
.modal h3 { margin-top: 0; }
.modal .modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }

.toast {
  position: fixed; bottom: 22px; right: 22px; background: var(--text); color: #fff; padding: 12px 18px;
  border-radius: 8px; font-size: 14px; box-shadow: var(--shadow); z-index: 200; max-width: 360px;
}
.toast.error { background: var(--danger); }
.toast.success { background: var(--success); }

.empty-state { text-align: center; padding: 40px 20px; color: var(--text-dim); }
.temp-pass-box { background: var(--accent-light); border: 1px dashed var(--accent); border-radius: 8px; padding: 14px; margin-top: 10px; font-size: 14px; }
.temp-pass-box code { font-size: 15px; font-weight: 700; }

.muted { color: var(--text-dim); }
.text-right { text-align: right; }
.mt-0 { margin-top: 0; }
.spinner { display:inline-block; width:16px; height:16px; border:2px solid var(--border); border-top-color: var(--accent); border-radius:50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.photo-link { font-size: 12.5px; }

/* --- Tabs (Табель: список/сетка) --- */
.tabs { display: flex; gap: 4px; margin-bottom: 16px; border-bottom: 1px solid var(--border); }
.tab-btn {
  border: none; background: none; padding: 10px 16px; font-size: 14px; color: var(--text-dim); cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }

.spacer-flex { flex: 1; }

/* --- Badges: переработка и статусы дня --- */
.badge-overtime { background: #fde8d7; color: #b25a1e; }
.badge-status-sick, .badge-status-absence, .badge-status-unpaid, .badge-status-vacation { font-weight: 600; }
.grid-legend { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-left: auto; font-size: 12px; }

.status-chip {
  display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 22px;
  padding: 0 3px; border-radius: 6px; font-size: 11px; font-weight: 700;
}
.status-sick { background: var(--warn-bg); color: var(--warn); }
.status-absence { background: var(--danger-bg); color: var(--danger); }
.status-unpaid { background: #e6e9f5; color: #4c5aa8; }
.status-vacation { background: #eafaf0; color: #1e8e5a; }

.status-pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; white-space: nowrap; }

/* --- Карточка сотрудника в расчёте оплаты --- */
.ed-summary { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 18px; margin-bottom: 16px; font-size: 13.5px; }
.ed-summary strong { font-size: 14.5px; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }

/* --- Календарная сетка табеля --- */
.grid-table { font-size: 12.5px; }
.grid-table th, .grid-table td { padding: 5px 4px; text-align: center; white-space: nowrap; }
.grid-name-head, .grid-name-cell { text-align: left !important; position: sticky; left: 0; background: var(--surface); z-index: 1; padding-right: 12px !important; }
.grid-day-head { color: var(--text-dim); font-weight: 500; min-width: 26px; }
.grid-cell { cursor: pointer; min-width: 26px; }
.grid-cell:hover { background: var(--accent-light); }
.grid-cell-overtime { background: #fde8d7; }
.grid-cell-overtime:hover { background: #fbdcbd; }
.grid-cell-status { background: #f4f5fb; }
.grid-total-cell { font-weight: 700; text-align: right !important; padding-right: 10px !important; }
