/* ===========================================
   RCYCL System — Design System
   Light green theme based on RCYCL branding
   =========================================== */

/* ===========================================
   Inter — локальный вариативный шрифт (SIL OFL 1.1)
   Лицензия: assets/fonts/LICENSE.txt
   Один файл на набор символов, ось веса 100-900.
   Браузер грузит только нужный набор (unicode-range).
   =========================================== */

/* cyrillic-ext */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('fonts/inter-cyrillic-ext.woff2') format('woff2');
  unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}
/* cyrillic */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('fonts/inter-cyrillic.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
/* greek-ext */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('fonts/inter-greek-ext.woff2') format('woff2');
  unicode-range: U+1F00-1FFF;
}
/* greek */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('fonts/inter-greek.woff2') format('woff2');
  unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF;
}
/* vietnamese */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('fonts/inter-vietnamese.woff2') format('woff2');
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}
/* latin-ext */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('fonts/inter-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('fonts/inter-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --bg: #f0f5f2;
  --surface: #ffffff;
  --surface-hover: #f7faf8;
  --border: #d4e4da;
  --border-hover: #a8ccb5;
  --text: #1a2e28;
  --text-secondary: #3d5a4e;
  --muted: #6b8a7e;
  --primary: #1a8c4e;
  --primary-hover: #15753f;
  --primary-light: #3db85a;
  --primary-lighter: #72d957;
  --primary-dim: #e8f5ed;
  --danger: #dc3545;
  --danger-dim: #fce8ea;
  --warning: #d4940a;
  --warning-dim: #fef6e0;
  --ok: #1a8c4e;
  --ok-dim: #e8f5ed;
  --accent: #1a8c4e;
  --accent-dim: #e8f5ed;
  --radius: 16px;
  --radius-sm: 10px;
  --font: 'Inter', system-ui, -apple-system, sans-serif;
  --sidebar-w: 260px;
  --shadow: 0 1px 3px rgba(0,60,30,0.06), 0 8px 24px rgba(0,60,30,0.07);
  --shadow-sm: 0 1px 2px rgba(0,60,30,0.05);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
}

a { color: var(--primary); }
a:hover { color: var(--primary-hover); }

h1 {
  margin: 0 0 20px;
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--text);
}

h2 {
  margin: 0 0 16px;
  font-size: 1.15rem;
  font-weight: 700;
}

.muted { color: var(--muted); }

/* ===========================================
   LAYOUT — Sidebar + Content
   =========================================== */

.nav-toggle-input { display: none; }

.app {
  display: flex;
  min-height: 100vh;
}

/* ---- Sidebar ---- */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 200;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.sidebar-header canvas {
  flex-shrink: 0;
  border-radius: 8px;
}

.sidebar-brand { min-width: 0; }

.sidebar-brand-name {
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 0.18em;
  color: var(--primary);
  line-height: 1.2;
}

.sidebar-brand-sub {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.sidebar-close {
  display: none;
  margin-left: auto;
  font-size: 26px;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  padding: 4px;
  border: none;
  background: none;
}

.sidebar-close:hover { color: var(--text); }

/* ---- Sidebar Navigation ---- */
.sidebar-nav {
  flex: 1;
  padding: 12px 0;
  overflow-y: auto;
}

.nav-section {
  margin-bottom: 4px;
}

.nav-group-title {
  padding: 16px 20px 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 20px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: 0;
  transition: background 0.15s, color 0.15s;
}

.nav-item:hover {
  background: var(--primary-dim);
  color: var(--primary);
}

.nav-item.active {
  background: var(--primary-dim);
  color: var(--primary);
  font-weight: 600;
  border-right: 3px solid var(--primary);
}

.nav-icon {
  font-size: 8px;
  width: 24px;
  text-align: center;
  flex-shrink: 0;
  color: var(--primary);
}

/* ---- Sidebar Footer (user) ---- */
.sidebar-footer {
  flex-shrink: 0;
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

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

.sidebar-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}

.sidebar-user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-logout {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
}

.sidebar-logout:hover { color: var(--danger); }

/* ---- Overlay (mobile) ---- */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  z-index: 190;
  cursor: pointer;
}

/* ---- Hamburger (mobile) ---- */
.hamburger {
  display: none;
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 100;
  width: 44px;
  height: 44px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
}

.hamburger span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
}

/* ---- App Body ---- */
.app-body {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.main {
  flex: 1;
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
  padding: 32px 36px;
}

/* Data-dense pages (wide tables) use the full available width. */
.main.main-wide {
  max-width: none;
}

.app-footer {
  text-align: center;
  padding: 16px 20px;
  font-size: 12px;
  color: var(--muted);
}

/* ===========================================
   LOGIN PAGE
   =========================================== */

.page-login {
  background: linear-gradient(150deg, #e8f5ed 0%, var(--bg) 50%, #dff0e5 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-wrapper {
  width: 100%;
  max-width: 420px;
  padding: 24px;
}

.login-hero {
  text-align: center;
  margin-bottom: 28px;
}

.login-hero canvas {
  display: block;
  margin: 0 auto;
}

.login-divider {
  width: 50px;
  height: 3px;
  background: linear-gradient(90deg, #1a8c4e, #72d957);
  border-radius: 2px;
  margin: 18px auto 14px;
}

.login-brand-text {
  font-size: 36px;
  font-weight: 900;
  letter-spacing: 0.24em;
  padding-left: 0.24em;
  color: var(--primary);
}

.login-brand-sub {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 4px;
}

.login-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 32px 28px;
  box-shadow: var(--shadow);
}

.login-card h1 {
  text-align: center;
  margin-bottom: 24px;
}

/* ===========================================
   DASHBOARD
   =========================================== */

.dash-welcome {
  margin-bottom: 28px;
}

.dash-welcome h1 {
  margin-bottom: 4px;
  font-size: 1.5rem;
}

.dash-welcome p {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(155px, 1fr));
  gap: 14px;
  margin-bottom: 28px;
}

.stat {
  padding: 18px 16px;
  background: var(--surface);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.stat .num {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--primary);
  line-height: 1.2;
}

.stat .lbl {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 2px;
}

.stat.stat-warn .num { color: var(--warning); }
.stat.stat-danger .num { color: var(--danger); }

.alerts {
  margin-bottom: 28px;
}

.alerts h2 {
  font-size: 1rem;
  margin-bottom: 12px;
}

.alert-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.alert-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  color: var(--text);
  transition: transform 0.15s;
}

.alert-item:hover {
  transform: translateX(4px);
  color: var(--text);
}

.alert-item-warn {
  background: var(--warning-dim);
  border-left: 3px solid var(--warning);
}

.alert-item-danger {
  background: var(--danger-dim);
  border-left: 3px solid var(--danger);
}

.alert-item-ok {
  background: var(--ok-dim);
  border-left: 3px solid var(--ok);
}

.quick-heading {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 14px;
}

.quick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 28px;
}

.quick-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 20px 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
  box-shadow: var(--shadow-sm);
}

.quick-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
  color: var(--text);
}

.quick-icon {
  font-size: 28px;
  margin-bottom: 8px;
}

.quick-label {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
}

.quick-desc {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}

/* ===========================================
   TABLES
   =========================================== */

.table-wrap {
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th, td {
  text-align: left;
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
}

th {
  background: var(--surface-hover);
  color: var(--muted);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

tr:last-child td { border-bottom: none; }

tr:hover td {
  background: rgba(26, 140, 78, 0.04);
}

tr.row-warn td {
  background: rgba(212, 148, 10, 0.07);
}

tr.row-soon td {
  background: rgba(212, 148, 10, 0.05);
}

/* ---- Work-hours grid (many narrow input columns per row) ---- */
.wh-grid th,
.wh-grid td {
  padding: 6px 5px;
}

.wh-grid input,
.wh-grid select {
  width: 100%;
  padding: 4px;
  font-size: 13px;
}

/* The default 14px side padding leaves too little room for "HH:MM" plus the
   native clock icon, so Windows and mobile browsers clip the value. */
.wh-grid .wh-time,
.wh-grid .wh-ot,
.wh-grid .wh-ut {
  min-width: 92px;
  text-align: center;
}

.wh-grid .wh-code,
.wh-grid .wh-ut-code {
  min-width: 56px;
}

.wh-grid input[type="checkbox"] {
  width: auto;
  min-width: 0;
}

/* ===========================================
   BUTTONS
   =========================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: background 0.15s, color 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.btn-primary {
  background: linear-gradient(180deg, var(--primary-light), var(--primary));
  color: #fff;
  box-shadow: 0 2px 6px rgba(26, 140, 78, 0.25);
}

.btn-primary:hover {
  background: linear-gradient(180deg, var(--primary), var(--primary-hover));
  color: #fff;
  box-shadow: 0 4px 12px rgba(26, 140, 78, 0.3);
}

.btn-ghost {
  background: var(--surface);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  color: var(--primary);
  border-color: var(--primary);
  background: var(--primary-dim);
}

.btn-danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid var(--border);
}

.btn-danger:hover {
  border-color: var(--danger);
  background: var(--danger-dim);
}

/* ===========================================
   BADGES
   =========================================== */

.badge {
  display: inline-block;
  padding: 3px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.badge-active {
  background: var(--ok-dim);
  color: var(--ok);
}

.badge-leave {
  background: var(--warning-dim);
  color: var(--warning);
}

.badge-term {
  background: var(--danger-dim);
  color: var(--danger);
}

.badge-muted {
  background: #e5e7eb;
  color: #6b7280;
}

/* ===========================================
   FORMS
   =========================================== */

label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

input,
select,
textarea {
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

textarea {
  min-height: 88px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26, 140, 78, 0.15);
}

.form-grid {
  display: grid;
  gap: 16px;
  max-width: 520px;
}

.form-grid-wide {
  max-width: 720px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

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

.filter-bar {
  display: flex;
  flex-wrap: nowrap;
  gap: 10px;
  align-items: flex-end;
  margin-bottom: 24px;
  padding: 14px 18px;
  background: var(--surface);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
}

.filter-bar > div:not(.filter-actions) {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex-shrink: 0;
}

.filter-bar label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.filter-actions {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  align-items: flex-end;
  flex-shrink: 0;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.hint {
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--muted);
  font-weight: 400;
}

/* ===========================================
   TOOLBAR
   =========================================== */

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-bottom: 20px;
}

/* ===========================================
   FLASH MESSAGES
   =========================================== */

.flash {
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  margin-bottom: 20px;
  font-size: 14px;
  font-weight: 500;
}

.flash-ok {
  background: var(--ok-dim);
  border: 1px solid rgba(26, 140, 78, 0.3);
  color: var(--ok);
}

.flash-err {
  background: var(--danger-dim);
  border: 1px solid rgba(220, 53, 69, 0.3);
  color: var(--danger);
}

.empty {
  color: var(--muted);
  padding: 24px 0;
}

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

/* ===========================================
   ANNOUNCEMENTS
   =========================================== */

.ann-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px;
}

.announcement-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.announcement-card {
  padding: 20px 22px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.announcement-card h2 {
  margin: 0 0 8px;
  font-size: 1.12rem;
}

.announcement-card h2 a {
  color: var(--text);
  text-decoration: none;
}

.announcement-card h2 a:hover { color: var(--primary); }

.ann-meta {
  margin: 0 0 12px;
  font-size: 13px;
  color: var(--muted);
}

.ann-excerpt {
  margin: 0;
  color: var(--text);
  line-height: 1.55;
}

.announcement-full .ann-body {
  margin-top: 16px;
  line-height: 1.65;
  font-size: 15px;
}

/* ---- Rich content (rendered Quill HTML) ---- */
.rich-content img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-sm);
  margin: 12px 0;
}

.rich-content h1,
.rich-content h2,
.rich-content h3 {
  margin: 20px 0 8px;
}

.rich-content ul,
.rich-content ol {
  padding-left: 24px;
  margin: 8px 0;
}

.rich-content blockquote {
  border-left: 4px solid var(--primary);
  margin: 12px 0;
  padding: 8px 16px;
  background: var(--primary-dim);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text-secondary);
}

.rich-content a {
  color: var(--primary);
  text-decoration: underline;
}

/* ---- Quill editor overrides ---- */
#editor-container {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  min-height: 200px;
  font-family: var(--font);
  font-size: 15px;
  color: var(--text);
}

#editor-container .ql-editor {
  min-height: 200px;
  line-height: 1.6;
}

#editor-container .ql-editor.ql-blank::before {
  color: var(--muted);
  font-style: normal;
}

.ql-toolbar.ql-snow {
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  background: var(--surface-hover);
  font-family: var(--font);
}

.ql-container.ql-snow {
  border: none !important;
}

.ql-snow .ql-stroke { stroke: var(--text-secondary); }
.ql-snow .ql-fill { fill: var(--text-secondary); }
.ql-snow .ql-picker { color: var(--text-secondary); }

.ql-snow .ql-active .ql-stroke,
.ql-snow button:hover .ql-stroke { stroke: var(--primary); }
.ql-snow .ql-active .ql-fill,
.ql-snow button:hover .ql-fill { fill: var(--primary); }
.ql-snow button:hover,
.ql-snow .ql-picker-label:hover { color: var(--primary); }

.ql-emoji {
  font-size: 18px !important;
  line-height: 1 !important;
  width: auto !important;
  padding: 0 4px !important;
}

/* ---- Emoji Picker ---- */
.emoji-picker {
  position: absolute;
  top: 100%;
  right: 0;
  z-index: 300;
  display: block;
  width: 380px;
  max-height: 360px;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  padding: 10px;
}

.emoji-cat-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 8px 0 4px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}

.emoji-cat-title:first-child {
  margin-top: 0;
}

.emoji-cat-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
}

.emoji-item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  font-size: 20px;
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.12s;
}

.emoji-item:hover {
  background: var(--primary-dim);
}

.announcement-card h3 {
  margin: 0 0 8px;
  font-size: 1.05rem;
}

.announcement-card h3 a {
  color: var(--text);
  text-decoration: none;
}

.announcement-card h3 a:hover { color: var(--primary); }

/* ===========================================
   HR NOTES
   =========================================== */

.hr-note-new {
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

.hr-notes-thread {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.hr-note-card {
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
}

.hr-note-card-focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26, 140, 78, 0.12);
}

.hr-note-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}

.hr-note-meta {
  font-size: 13px;
  color: var(--muted);
}

.hr-note-body {
  line-height: 1.55;
  font-size: 15px;
}

.hr-comment-list {
  margin: 16px 0 0;
  padding: 12px 0 0 18px;
  border-top: 1px solid var(--border);
  list-style: disc;
  color: var(--text);
}

.hr-comment-list li { margin-bottom: 12px; }

.hr-comment-form {
  margin-top: 12px;
  display: grid;
  gap: 8px;
}

.hr-comment-form textarea { max-width: 100%; }

.hr-note-delete {
  display: inline;
  margin: 0;
}

/* ===========================================
   DIRECTORY
   =========================================== */

.directory-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 14px;
}

.directory-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.directory-card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow);
}

.directory-card-photo {
  position: absolute;
  top: 16px;
  right: 16px;
}
.directory-card-photo img,
.directory-card-photo > div {
  box-shadow: 0 3px 12px rgba(0,0,0,0.10);
}

.directory-card-dates {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border, #eee);
  text-align: center;
  font-size: .8rem;
  color: var(--muted, #888);
}
.directory-card--has-photo .directory-card-dates {
  margin-right: -80px;
}

.directory-card-name {
  font-weight: 700;
  font-size: 1.05rem;
  margin-bottom: 6px;
}

.directory-card-name a {
  color: var(--text);
  text-decoration: none;
}

.directory-card-name a:hover { color: var(--primary); }

.directory-card-line {
  font-size: 14px;
  margin-top: 4px;
}

.directory-card-line.muted,
.directory-card .muted {
  color: var(--muted);
}

.directory-phone a {
  color: var(--primary);
  font-weight: 600;
  text-decoration: none;
}

/* ===========================================
   EMPLOYEE VIEW
   =========================================== */

.employee-view-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 16px;
}

.employee-view-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 26px;
  max-width: 640px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: visible;
}

.employee-view-dl {
  display: grid;
  grid-template-columns: minmax(140px, 34%) 1fr;
  gap: 12px 20px;
  margin: 0;
  font-size: 15px;
}

.employee-view-dl dt {
  margin: 0;
  color: var(--muted);
  font-weight: 500;
}

.employee-view-dl dd { margin: 0; }

.employee-view-photo {
  flex-shrink: 0;
}

.employee-view-photo--float {
  position: absolute;
  top: -20px;
  right: -20px;
}
.employee-view-photo--float img,
.employee-view-photo--float > div {
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}

@media (max-width: 600px) {
  .employee-view-card {
    flex-direction: column-reverse !important;
    align-items: center !important;
    padding-right: 26px !important;
  }
  .employee-view-photo {
    margin-bottom: 12px;
  }
  .employee-view-photo--float {
    position: static;
    margin: 0 auto 12px;
  }
}

.employee-view-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-width: 900px;
}

/* ===========================================
   ORGCHART
   =========================================== */

.orgchart-tabs { margin-bottom: 20px; }

.orgchart-wrap {
  overflow-x: auto;
  padding: 8px 0 16px;
}

.org-tree {
  list-style: none;
  margin: 0;
  padding-left: 0;
}

.org-tree .org-tree {
  margin-top: 10px;
  padding-left: 22px;
  border-left: 2px solid var(--border);
}

.org-tree > li { margin-bottom: 12px; }

.org-node {
  display: inline-block;
  max-width: 320px;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
}

.org-node-dept {
  border-color: var(--primary);
  border-left-width: 3px;
}

.org-node-title { font-weight: 700; }

.org-node-person .org-node-title a {
  color: inherit;
  text-decoration: none;
}

.org-node-person .org-node-title a:hover { color: var(--primary); }

.org-node-sub {
  font-size: 13px;
  margin-top: 4px;
  color: var(--muted);
}

.org-node-meta {
  font-size: 12px;
  color: var(--muted);
}

.org-node-self {
  border-color: var(--primary);
  border-width: 2px;
  background: var(--primary-dim);
  box-shadow: 0 0 0 3px rgba(26, 140, 78, 0.12);
}

.org-node-warn {
  border-color: var(--warning);
  background: var(--warning-dim);
}

.org-warn-badge {
  display: inline-block;
  font-size: 15px;
  vertical-align: middle;
  cursor: help;
}

/* ---- People org chart (positions computed in JS, see orgchart.php) ---- */
.oc-wrap {
  padding: 20px 0;
  position: relative;
}

/* fallback layout used before JS lays the tree out */
.oc-wrap ul {
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  align-items: flex-start;
  gap: 12px;
  padding: 28px 0 0;
  margin: 0;
  position: relative;
  list-style: none;
}

#oc-tree > ul { padding-top: 0; }

.oc-wrap li {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  flex: 0 0 auto;
}

/* JS-driven layout: cards are absolutely placed, lines drawn as SVG */
.oc-canvas {
  position: relative;
  margin: 0 auto;
}

.oc-canvas .oc-card {
  position: absolute;
  margin: 0;
}

.oc-lines {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
  overflow: visible;
}

.oc-lines path {
  stroke: var(--border);
}

.oc-card {
  display: block;
  box-sizing: border-box;
  padding: 9px 12px;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  text-align: center;
  width: 172px;
  position: relative;
  text-decoration: none;
  color: var(--text);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.oc-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow);
  color: var(--text);
}

.oc-card-self {
  border-color: var(--primary);
  background: var(--primary-dim);
  box-shadow: 0 0 0 3px rgba(26, 140, 78, 0.12);
}

.oc-card-warn {
  border-color: var(--warning);
  background: var(--warning-dim);
}

.oc-card-name {
  font-weight: 700;
  font-size: 14px;
}

.oc-card-role {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.oc-card-dept {
  font-size: 11px;
  color: var(--muted);
}

.oc-card-warn-text {
  font-size: 11px;
  color: var(--warning);
  font-weight: 600;
  margin-top: 4px;
}

.oc-tooltip {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface, #fff);
  border: 1px solid var(--border, #ddd);
  border-radius: 6px;
  padding: 8px 12px;
  box-shadow: 0 4px 16px rgba(0,0,0,.13);
  white-space: nowrap;
  z-index: 100;
  text-align: left;
  font-size: 12px;
  color: var(--text);
  pointer-events: none;
}

.oc-tooltip::before {
  content: '';
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-bottom-color: var(--border, #ddd);
}

.oc-card:hover .oc-tooltip { display: block; }

.oc-card--up .oc-tooltip {
  top: auto;
  bottom: calc(100% + 8px);
}

.oc-card--up .oc-tooltip::before {
  bottom: auto;
  top: 100%;
  border-bottom-color: transparent;
  border-top-color: var(--border, #ddd);
}

.oc-tooltip-title {
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--muted, #888);
  font-size: 11px;
}

.oc-tooltip-item {
  color: var(--text);
  line-height: 1.5;
}

.oc-tooltip-title--skills {
  color: #2e7d32;
}

.oc-tooltip-item--skills {
  color: #2e7d32;
}

.oc-hover-photo {
  display: none;
  position: absolute;
  top: 7px;
  right: calc(100% + 8px);
  z-index: 101;
}

.oc-hover-photo img {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 4px 12px rgba(0,0,0,.15);
}

.oc-card:hover .oc-hover-photo {
  display: block;
}

/* ===========================================
   SHIFTS GRID
   =========================================== */

.shift-week-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.shift-grid-wrap {
  overflow-x: auto;
  margin-bottom: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
}

.shift-grid {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 720px;
}

.shift-grid th,
.shift-grid td {
  border: 1px solid var(--border);
  padding: 8px 10px;
  vertical-align: top;
}

.shift-grid thead th {
  background: var(--surface-hover);
  color: var(--muted);
  font-weight: 600;
  text-align: center;
}

.shift-grid-dow { color: var(--primary); }
.shift-grid-date { color: var(--text); font-size: 12px; }

.shift-grid-emp {
  text-align: left;
  white-space: nowrap;
  background: var(--surface-hover);
  font-weight: 600;
}

.shift-grid-emp a {
  color: var(--text);
  text-decoration: none;
}

.shift-grid-emp a:hover { color: var(--primary); }

.shift-grid-cell {
  text-align: left;
  min-width: 100px;
}

.shift-grid-slot {
  display: block;
  line-height: 1.35;
}

/* ===========================================
   MISC COMPONENTS
   =========================================== */

.history-list {
  margin: 0 0 24px;
  padding-left: 20px;
  color: var(--text);
}

.history-list li { margin-bottom: 10px; }

.check-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-weight: 500;
  cursor: pointer;
}

.check-row input {
  width: auto;
  margin-top: 4px;
}

.time-summary {
  margin: 0 0 20px;
  font-size: 15px;
  color: var(--text);
}

/* ===========================================
   RESPONSIVE
   =========================================== */

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    box-shadow: none;
  }

  .nav-toggle-input:checked + .app .sidebar {
    transform: translateX(0);
    box-shadow: 8px 0 24px rgba(0,0,0,0.15);
  }

  .nav-toggle-input:checked + .app .sidebar-overlay {
    display: block;
  }

  .sidebar-close { display: block; }

  .hamburger { display: flex; }

  .app-body {
    margin-left: 0;
    padding-top: 0;
  }

  .main {
    padding: 68px 16px 24px;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .stats {
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  }

  .quick-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
  }

  .directory-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .main {
    padding: 64px 12px 20px;
  }

  .filter-bar {
    flex-wrap: wrap;
  }

  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .toolbar h1 {
    text-align: center;
  }
}

/* ── Calendar ── */
.cal-year-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
}
.cal-month {
  min-width: 0;
}
.cal-month-title {
  font-weight: 700;
  font-size: .95rem;
  margin-bottom: 6px;
  text-align: center;
}
.cal-header-row {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-size: .75rem;
  font-weight: 600;
  color: var(--muted, #6b7280);
  margin-bottom: 2px;
}
.cal-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}
.cal-day {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  margin: 1px auto;
  font-size: .82rem;
  border-radius: 6px;
  text-decoration: none;
  color: inherit;
  cursor: default;
}
a.cal-day {
  cursor: pointer;
}
a.cal-day:hover {
  background: var(--bg-hover, #e8f5e9);
}
.cal-day-empty {
  visibility: hidden;
}
.cal-weekend .cal-day-num {
  color: var(--muted, #6b7280);
}
.cal-today {
  background: var(--primary, #1a8c4e);
  color: #fff;
  font-weight: 700;
  border-radius: 50%;
}
.cal-today .cal-day-num {
  color: #fff;
}
.cal-has-event {
  font-weight: 700;
}
.cal-has-event .cal-day-num {
  color: inherit;
}
.cal-tip-wrap {
  position: relative;
}
.cal-tip {
  display: none;
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: #1e293b;
  color: #fff;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: .82rem;
  font-weight: 400;
  line-height: 1.45;
  white-space: nowrap;
  z-index: 100;
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(0,0,0,.25);
}
.cal-tip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: #1e293b;
}
.cal-tip-wrap:hover .cal-tip {
  display: block;
}

@media (max-width: 900px) {
  .cal-year-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}
@media (max-width: 600px) {
  .cal-year-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.msel-wrap {
  position: relative;
  width: 100%;
}
.msel-display {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border: 1px solid var(--border, #ccc);
  border-radius: var(--radius-sm, 6px);
  background: var(--surface, #fff);
  cursor: pointer;
  font-size: .88rem;
  min-height: 38px;
}
.msel-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  color: var(--text);
}
.msel-arrow {
  margin-left: 8px;
  color: var(--muted, #888);
  font-size: .75rem;
}
.msel-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 50;
  background: var(--surface, #fff);
  border: 1px solid var(--border, #ccc);
  border-top: none;
  border-radius: 0 0 var(--radius-sm, 6px) var(--radius-sm, 6px);
  max-height: 220px;
  overflow-y: auto;
  box-shadow: 0 4px 12px rgba(0,0,0,.1);
}
.msel-dropdown.msel-open { display: block; }
.msel-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  font-size: .85rem;
  cursor: pointer;
  transition: background .1s;
}
.msel-item:hover { background: var(--primary-dim, #f0faf4); }
.msel-item input[type="checkbox"] {
  accent-color: var(--primary, #1a8c4e);
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.login-details summary {
  cursor: pointer;
  list-style: none;
}
.login-details summary::before {
  content: '▶';
  display: inline-block;
  margin-right: 6px;
  font-size: .7em;
  transition: transform .15s;
}
.login-details[open] summary::before {
  transform: rotate(90deg);
}
.login-details summary::-webkit-details-marker { display: none; }
