/* Yatra Booking ERP — design system (blue / white / neutral gray) */
:root {
    --blue-900: #0a2a5e;
    --blue-700: #0b4bb3;
    --blue-600: #1160d6;
    --blue-500: #2b7be8;
    --blue-100: #e3eeff;
    --blue-50:  #f1f6ff;
    --gray-900: #172033;
    --gray-700: #3d4859;
    --gray-500: #6b7686;
    --gray-300: #d5dae2;
    --gray-200: #e6e9ef;
    --gray-100: #f3f5f8;
    --white: #fff;
    --green: #17803d;   --green-bg: #e4f5ea;
    --red: #c5221f;     --red-bg: #fde8e7;
    --amber: #a15c00;   --amber-bg: #fff1d6;
    --radius: 10px;
    --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
    --sidebar-w: 248px;
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.5; color: var(--gray-900); background: var(--gray-100); }
a { color: var(--blue-600); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
[hidden] { display: none !important; }
.muted { color: var(--gray-500); margin: .25rem 0 0; }
.icon { width: 20px; height: 20px; flex: none; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; padding: .6rem 1.1rem; border-radius: 8px; border: 1px solid transparent; font: inherit; font-weight: 600; cursor: pointer; transition: background .15s, border-color .15s; }
.btn:hover { text-decoration: none; }
.btn:disabled { opacity: .6; cursor: not-allowed; }
.btn-primary { background: var(--blue-600); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--blue-700); }
.btn-ghost { background: transparent; color: var(--gray-700); border-color: var(--gray-300); }
.btn-ghost:hover:not(:disabled) { background: var(--gray-100); }
.btn-sm { padding: .4rem .8rem; font-size: .875rem; }
.btn-block { width: 100%; }
.icon-btn { background: none; border: 0; padding: .4rem; border-radius: 8px; cursor: pointer; color: var(--gray-700); }
.icon-btn:hover { background: var(--gray-100); }

/* ---------- forms ---------- */
.form { display: grid; gap: 1rem; }
.field { display: grid; gap: .35rem; }
.field > span { font-weight: 600; font-size: .875rem; color: var(--gray-700); }
.field input, .field select, .field textarea { width: 100%; padding: .65rem .8rem; border: 1px solid var(--gray-300); border-radius: 8px; font: inherit; background: #fff; color: var(--gray-900); }
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--blue-100); border-color: var(--blue-500); }
.field.invalid input { border-color: var(--red); }
.field-error { color: var(--red); min-height: 0; font-size: .8125rem; }
.field-error:empty { display: none; }

/* ---------- alerts ---------- */
.alert { padding: .75rem 1rem; border-radius: 8px; font-size: .9rem; border: 1px solid transparent; margin-bottom: 1rem; }
.form .alert { margin-bottom: 0; }
.alert-danger  { background: var(--red-bg);   color: var(--red);   border-color: #f6c5c3; }
.alert-success { background: var(--green-bg); color: var(--green); border-color: #bfe5cb; }
.alert-warning { background: var(--amber-bg); color: var(--amber); border-color: #f5dba0; }
.alert-info    { background: var(--blue-50);  color: var(--blue-700); border-color: var(--blue-100); }

/* ---------- auth pages ---------- */
.auth-layout { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; }
.auth-brand { background: linear-gradient(155deg, var(--blue-900), var(--blue-600)); color: #fff; padding: 4rem; display: flex; flex-direction: column; justify-content: center; gap: 1rem; }
.auth-brand h2 { font-size: 2rem; }
.auth-brand p { max-width: 30rem; opacity: .9; margin: 0; }
.auth-points { list-style: none; padding: 0; margin: 1rem 0 0; display: grid; gap: .6rem; }
.auth-points li { padding-left: 1.5rem; position: relative; opacity: .95; }
.auth-points li::before { content: ""; position: absolute; left: 0; top: .5rem; width: .6rem; height: .6rem; border-radius: 50%; background: #7fb2ff; }
.brand-lg { display: flex; align-items: center; gap: .75rem; font-size: 1.25rem; font-weight: 700; }
.brand-mark { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; background: #fff; color: var(--blue-700); font-weight: 800; }
.brand-mark-lg { width: 44px; height: 44px; font-size: 1.4rem; }
.auth-panel { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 2rem; background: #fff; }
.auth-card { width: 100%; max-width: 400px; }
.auth-title { font-size: 1.6rem; }
.auth-sub { color: var(--gray-500); margin: .35rem 0 1.5rem; }
.auth-links { text-align: center; margin: 0; font-size: .9rem; }
.auth-foot { color: var(--gray-500); font-size: .8rem; margin-top: 2rem; }

/* ---------- app shell ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar { width: var(--sidebar-w); background: var(--blue-900); color: #cfdcf5; display: flex; flex-direction: column; position: fixed; inset: 0 auto 0 0; z-index: 30; transition: transform .2s; }
.brand { display: flex; align-items: center; gap: .7rem; padding: 1.1rem 1.2rem; color: #fff; }
.brand:hover { text-decoration: none; }
.brand-text { font-weight: 700; line-height: 1.15; }
.brand-text small { display: block; font-weight: 400; font-size: .75rem; opacity: .7; }
.nav { display: grid; gap: .15rem; padding: .5rem .7rem; flex: 1; align-content: start; }
.nav-link { display: flex; align-items: center; gap: .75rem; padding: .6rem .8rem; border-radius: 8px; color: #cfdcf5; font-weight: 500; }
.nav-link:hover { background: rgba(255, 255, 255, .08); text-decoration: none; color: #fff; }
.nav-link.active { background: var(--blue-600); color: #fff; }
.sidebar-foot { padding: .7rem; border-top: 1px solid rgba(255, 255, 255, .12); }
.sidebar-backdrop { display: none; }
.main { flex: 1; margin-left: var(--sidebar-w); min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 1rem; padding: .7rem 1.5rem; background: #fff; border-bottom: 1px solid var(--gray-200); position: sticky; top: 0; z-index: 20; }
.topbar-title { font-size: 1.1rem; flex: 1; }
.topbar-right { display: flex; align-items: center; gap: 1rem; }
.topbar-right form { margin: 0; }
.menu-toggle { display: none; }
.user-chip { display: flex; align-items: center; gap: .6rem; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--blue-100); color: var(--blue-700); display: grid; place-items: center; font-weight: 700; }
.user-meta { display: grid; line-height: 1.2; }
.user-meta small { color: var(--gray-500); }
.content { padding: 1.5rem; flex: 1; }
.footer { padding: 1rem 1.5rem; color: var(--gray-500); font-size: .8rem; }

/* ---------- cards ---------- */
.card { background: #fff; border: 1px solid var(--gray-200); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-narrow { max-width: 520px; }
.card-head { padding: 1rem 1.25rem; border-bottom: 1px solid var(--gray-200); }
.card-head h2, .card-head h3 { font-size: 1rem; }
.card-body { padding: 1.25rem; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 1.25rem; }
.page-title { font-size: 1.4rem; }

/* ---------- dashboard ---------- */
.dash-body { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.25rem; }
.dash-body > *, .dash-grid > * { min-width: 0; }
.dash-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.25rem; }
.section-title { font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--gray-500); margin: 0 0 .6rem; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: .9rem; }
.stat { background: #fff; border: 1px solid var(--gray-200); border-left: 4px solid var(--blue-600); border-radius: var(--radius); padding: .9rem 1rem; box-shadow: var(--shadow); }
.stat .stat-value { font-size: 1.75rem; font-weight: 700; line-height: 1.1; }
.stat .stat-label { color: var(--gray-500); font-size: .85rem; margin-top: .2rem; }
.stat.tone-green { border-left-color: var(--green); }
.stat.tone-red   { border-left-color: var(--red); }
.stat.tone-amber { border-left-color: #e08a00; }
.stat.tone-gray  { border-left-color: var(--gray-500); }
.panel { background: #fff; border: 1px solid var(--gray-200); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1rem 1.25rem; }
.panel h3 { font-size: .95rem; margin-bottom: .8rem; }
.empty { color: var(--gray-500); font-size: .9rem; padding: .5rem 0; }

.bars { display: grid; gap: .6rem; }
.bar-row { display: grid; grid-template-columns: 9.5rem 1fr 2.5rem; align-items: center; gap: .6rem; font-size: .875rem; }
.bar-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--gray-700); }
.bar-track { height: 10px; background: var(--gray-100); border-radius: 99px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--blue-500); border-radius: 99px; width: 0; transition: width .5s; }
.bar-value { text-align: right; font-weight: 600; }

.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; justify-content: space-between; gap: 1rem; padding: .6rem 0; border-bottom: 1px solid var(--gray-100); font-size: .9rem; }
.list li:last-child { border-bottom: 0; }
.list .meta { color: var(--gray-500); font-size: .8rem; white-space: nowrap; }
.badge { display: inline-block; padding: .1rem .5rem; border-radius: 99px; font-size: .72rem; font-weight: 700; background: var(--blue-100); color: var(--blue-700); margin-left: .4rem; }
.badge-red { background: var(--red-bg); color: var(--red); }
.badge-amber { background: var(--amber-bg); color: var(--amber); }

.task-row { padding: .7rem 0; border-bottom: 1px solid var(--gray-100); }
.task-row:last-child { border-bottom: 0; }
.task-top { display: flex; justify-content: space-between; gap: 1rem; font-weight: 600; font-size: .92rem; }
.task-sub { color: var(--gray-500); font-size: .8rem; margin: .15rem 0 .4rem; }
.progress { height: 8px; background: var(--gray-100); border-radius: 99px; overflow: hidden; }
.progress > span { display: block; height: 100%; width: 0; background: var(--green); border-radius: 99px; }
.attendance-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 1rem; }
.attendance-grid .k { color: var(--gray-500); font-size: .8rem; }
.attendance-grid .v { font-size: 1.15rem; font-weight: 700; }
.balances { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .8rem; }
.balance { background: var(--blue-50); border-radius: 8px; padding: .7rem .9rem; }
.balance .v { font-size: 1.3rem; font-weight: 700; color: var(--blue-700); }
.balance .k { color: var(--gray-500); font-size: .8rem; }

.skeleton-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: .9rem; }
.skeleton { height: 78px; border-radius: var(--radius); background: linear-gradient(90deg, var(--gray-200), var(--gray-100), var(--gray-200)); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- toasts ---------- */
.toast-region { position: fixed; right: 1rem; bottom: 1rem; display: grid; gap: .5rem; z-index: 100; max-width: calc(100vw - 2rem); }
.toast { background: var(--gray-900); color: #fff; padding: .75rem 1rem; border-radius: 8px; box-shadow: 0 6px 20px rgba(0, 0, 0, .25); font-size: .9rem; max-width: 360px; }
.toast.success { background: var(--green); }
.toast.error { background: var(--red); }

/* ---------- error pages ---------- */
.error-page { display: grid; place-items: center; min-height: 100vh; background: var(--gray-100); }
.error-card { background: #fff; padding: 2.5rem; border-radius: var(--radius); box-shadow: var(--shadow); text-align: center; max-width: 420px; }
.error-code { font-size: 3.5rem; font-weight: 800; color: var(--blue-600); }
.error-card p { color: var(--gray-500); }

/* ---------- responsive ---------- */
@media (max-width: 980px) {
    .dash-grid { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
    .auth-layout { grid-template-columns: 1fr; }
    .auth-brand { display: none; }
    .sidebar { transform: translateX(-100%); }
    .shell.nav-open .sidebar { transform: none; }
    .shell.nav-open .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(10, 20, 40, .45); z-index: 25; }
    .main { margin-left: 0; }
    .menu-toggle { display: inline-flex; }
    .user-meta { display: none; }
    .content { padding: 1rem; }
    .topbar { padding: .6rem 1rem; }
    .btn-sm span { display: none; }
}
@media (max-width: 520px) {
    .bar-row { grid-template-columns: 6.5rem 1fr 2rem; }
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ======================= Stage 2: employees, tables, modal ======================= */
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #a51b18; }
.page-actions { display: flex; gap: .6rem; flex-wrap: wrap; }

.toolbar { display: flex; flex-wrap: wrap; gap: .6rem; margin-bottom: 1rem; align-items: center; }
.toolbar input[type=search], .toolbar input[type=date], .toolbar select { padding: .55rem .75rem; border: 1px solid var(--gray-300); border-radius: 8px; font: inherit; background: #fff; min-width: 0; }
.toolbar input[type=search] { flex: 1 1 240px; }
.toolbar select { flex: 0 1 180px; }
.toolbar input[type=date] { flex: 0 1 170px; }
.toolbar input:focus, .toolbar select:focus { outline: 2px solid var(--blue-100); border-color: var(--blue-500); }

.table-wrap { overflow-x: auto; background: #fff; border: 1px solid var(--gray-200); border-radius: var(--radius); box-shadow: var(--shadow); }
table.data { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.data th { text-align: left; padding: .7rem 1rem; background: var(--gray-100); color: var(--gray-700); font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; }
table.data th[data-sort] { cursor: pointer; user-select: none; }
table.data th[data-sort]:hover { color: var(--blue-700); }
table.data th .arrow { font-size: .7rem; margin-left: .25rem; }
table.data td { padding: .7rem 1rem; border-top: 1px solid var(--gray-100); vertical-align: middle; }
table.data tbody tr:hover { background: var(--blue-50); }
.cell-person { display: flex; align-items: center; gap: .7rem; }
.cell-person strong { display: block; line-height: 1.2; }
.cell-person small, .cell-sub { color: var(--gray-500); font-size: .8rem; display: block; }
.row-actions { display: flex; gap: .4rem; justify-content: flex-end; white-space: nowrap; }
.table-empty { padding: 2.5rem 1rem; text-align: center; color: var(--gray-500); }

.pager { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .8rem 1rem; border-top: 1px solid var(--gray-200); font-size: .85rem; color: var(--gray-500); flex-wrap: wrap; }
.pager-btns { display: flex; gap: .4rem; }

.badge-green { background: var(--green-bg); color: var(--green); }
.badge-gray { background: var(--gray-200); color: var(--gray-700); }
.badge-blue { background: var(--blue-100); color: var(--blue-700); }
.badge-inline { margin-left: 0; }

.avatar-img { width: 38px; height: 38px; border-radius: 50%; background: var(--blue-100); color: var(--blue-700); display: inline-grid; place-items: center; font-weight: 700; overflow: hidden; flex: none; }
.avatar-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar-img.lg { width: 96px; height: 96px; font-size: 2.2rem; }

.form-section { margin-bottom: 1.25rem; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem 1.25rem; }
.form-grid .span-2 { grid-column: 1 / -1; }
.field textarea { resize: vertical; min-height: 72px; }
.field .hint { color: var(--gray-500); font-size: .78rem; }
.check { display: flex; align-items: center; gap: .6rem; font-weight: 600; font-size: .9rem; }
.check input { width: 18px; height: 18px; }
.form-actions { display: flex; gap: .75rem; justify-content: flex-end; padding-top: .5rem; flex-wrap: wrap; }
.photo-row { display: flex; align-items: center; gap: 1.25rem; flex-wrap: wrap; }
.photo-row input[type=file] { font: inherit; }

.profile-head { display: flex; gap: 1.25rem; align-items: center; flex-wrap: wrap; padding: 1.25rem; }
.profile-head .who { flex: 1; min-width: 200px; }
.profile-head h2 { font-size: 1.4rem; }
.profile-head .who p { margin: .2rem 0 .5rem; color: var(--gray-500); }
.profile-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.25rem; margin-top: 1.25rem; }
dl.details { display: grid; grid-template-columns: 11rem 1fr; gap: .55rem 1rem; margin: 0; font-size: .9rem; }
dl.details dt { color: var(--gray-500); }
dl.details dd { margin: 0; word-break: break-word; }

.timeline { list-style: none; margin: 0; padding: 0 0 0 1.1rem; border-left: 2px solid var(--gray-200); }
.timeline li { position: relative; padding: 0 0 1rem 1rem; font-size: .9rem; }
.timeline li::before { content: ""; position: absolute; left: -1.6rem; top: .35rem; width: 10px; height: 10px; border-radius: 50%; background: var(--blue-500); border: 2px solid #fff; box-shadow: 0 0 0 1px var(--blue-500); }
.timeline .when { color: var(--gray-500); font-size: .78rem; display: block; }

.modal-backdrop { position: fixed; inset: 0; background: rgba(10, 20, 40, .5); display: grid; place-items: center; z-index: 90; padding: 1rem; }
.modal { background: #fff; border-radius: var(--radius); box-shadow: 0 20px 50px rgba(0, 0, 0, .3); width: 100%; max-width: 460px; max-height: 90vh; display: flex; flex-direction: column; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 1rem 1.25rem; border-bottom: 1px solid var(--gray-200); }
.modal-head h3 { font-size: 1.05rem; }
.modal-x { font-size: 1.4rem; line-height: 1; }
.modal-body { padding: 1.25rem; overflow-y: auto; display: grid; gap: .9rem; }
.modal-body p { margin: 0; }
.modal-foot { display: flex; justify-content: flex-end; gap: .6rem; padding: .9rem 1.25rem; border-top: 1px solid var(--gray-200); }
.secret-box { background: var(--gray-100); border: 1px dashed var(--gray-500); border-radius: 8px; padding: .8rem 1rem; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 1.1rem; letter-spacing: .05em; word-break: break-all; user-select: all; }
.kv { display: grid; grid-template-columns: 6rem 1fr; gap: .3rem 1rem; font-size: .9rem; }
.kv dt { color: var(--gray-500); }
.kv dd { margin: 0; word-break: break-all; }

@media (max-width: 860px) {
    .form-grid, .profile-grid { grid-template-columns: 1fr; }
    dl.details { grid-template-columns: 8.5rem 1fr; }
    table.data .hide-sm { display: none; }
}

/* ---------- attendance (Stage 3) ---------- */
.dash-widget { margin-bottom: 1rem; }
.att-widget .card-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.att-clock { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 1.15rem; color: var(--blue-700); }
.att-actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1rem; }
.att-note { margin: .75rem 0 0; font-size: .875rem; }
.attendance-grid .v.green { color: var(--green); }
.attendance-grid .v.amber { color: var(--amber); }
.attendance-grid .v.red { color: var(--red); }

.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: .75rem; margin: 0 0 1rem; }
.stat-card { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); padding: .75rem .9rem; border-left: 4px solid var(--gray-300); }
.stat-card .v { font-size: 1.4rem; font-weight: 700; line-height: 1.2; }
.stat-card .k { color: var(--gray-500); font-size: .8rem; }
.stat-card.tone-green { border-left-color: var(--green); }
.stat-card.tone-red { border-left-color: var(--red); }
.stat-card.tone-amber { border-left-color: var(--amber); }
.stat-card.tone-blue { border-left-color: var(--blue-500); }

.month-nav { display: flex; align-items: center; gap: .6rem; margin: 1rem 0; }
.month-nav strong { min-width: 9.5rem; text-align: center; }

.calendar { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal-dow { text-align: center; font-size: .75rem; font-weight: 600; color: var(--gray-500); padding: .25rem 0; }
.cal-cell { min-height: 54px; border-radius: 8px; padding: .3rem .4rem; display: flex; flex-direction: column; justify-content: space-between; background: var(--gray-100); border: 1px solid transparent; }
.cal-empty { background: transparent; }
.cal-day { font-size: .8rem; font-weight: 600; }
.cal-code { font-size: .7rem; font-weight: 700; text-align: right; }
.cal-today { border-color: var(--blue-500); }
.st-green { background: var(--green-bg); color: var(--green); }
.st-amber { background: var(--amber-bg); color: var(--amber); }
.st-red { background: var(--red-bg); color: var(--red); }
.st-blue { background: var(--blue-100); color: var(--blue-700); }
.st-purple { background: #efe6fb; color: #6b3fb0; }
.st-gray { background: var(--gray-200); color: var(--gray-700); }
.st-none { background: var(--gray-100); color: var(--gray-500); }
.status-pill { display: inline-block; padding: .15rem .55rem; border-radius: 99px; font-size: .78rem; font-weight: 600; white-space: nowrap; }
.legend { display: flex; flex-wrap: wrap; gap: .4rem 1rem; margin-top: 1rem; font-size: .8rem; color: var(--gray-700); }
.legend-item { display: inline-flex; align-items: center; gap: .35rem; }
.legend .dot { width: .8rem; height: .8rem; border-radius: 3px; display: inline-block; }

.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--gray-300); margin-bottom: 1rem; overflow-x: auto; }
.tab { background: none; border: 0; border-bottom: 3px solid transparent; padding: .65rem 1rem; font: inherit; font-weight: 600; color: var(--gray-500); cursor: pointer; white-space: nowrap; }
.tab:hover { color: var(--gray-900); }
.tab.active { color: var(--blue-700); border-bottom-color: var(--blue-600); }
.tab-count { background: var(--red); color: #fff; border-radius: 99px; font-size: .7rem; padding: .05rem .4rem; margin-left: .3rem; }
@media (max-width: 640px) { .cal-cell { min-height: 44px; padding: .2rem; } .cal-code { display: none; } }

/* ======================= Stage 7: notifications (bell, dropdown, page) ======================= */
.notif { position: relative; }
.notif-btn { position: relative; }
.notif-badge { position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 99px; background: var(--red); color: #fff; font-size: .68rem; font-weight: 700; display: grid; place-items: center; line-height: 1; }
.notif-panel { position: absolute; right: 0; top: calc(100% + 8px); width: 360px; max-width: calc(100vw - 2rem); background: #fff; border: 1px solid var(--gray-200); border-radius: var(--radius); box-shadow: 0 12px 32px rgba(0, 0, 0, .18); z-index: 60; display: flex; flex-direction: column; overflow: hidden; }
.notif-head { display: flex; justify-content: space-between; align-items: center; padding: .7rem 1rem; border-bottom: 1px solid var(--gray-200); }
.notif-list { max-height: 380px; overflow-y: auto; }
.notif-item { display: flex; gap: .7rem; width: 100%; text-align: left; background: #fff; border: 0; border-bottom: 1px solid var(--gray-100); padding: .7rem 1rem; font: inherit; cursor: pointer; color: inherit; }
.notif-item:hover { background: var(--blue-50); }
.notif-item.unread { background: var(--blue-50); }
.notif-dot { width: 8px; height: 8px; border-radius: 50%; background: transparent; flex: none; margin-top: .45rem; }
.notif-item.unread .notif-dot { background: var(--blue-600); }
.notif-body { display: grid; gap: .1rem; min-width: 0; font-size: .86rem; }
.notif-body strong { font-weight: 600; }
.notif-item:not(.unread) .notif-body strong { font-weight: 500; }
.notif-msg { color: var(--gray-700); overflow-wrap: anywhere; }
.notif-body small { color: var(--gray-500); }
.notif-empty { margin: 0; padding: 1.5rem 1rem; text-align: center; color: var(--gray-500); font-size: .9rem; }
.notif-foot { display: block; text-align: center; padding: .65rem; font-size: .85rem; font-weight: 600; border-top: 1px solid var(--gray-200); }
.notif-page-item { display: flex; gap: .8rem; align-items: flex-start; padding: .9rem 1rem; border-bottom: 1px solid var(--gray-100); }
.notif-page-item.unread { background: var(--blue-50); }
.notif-page-item .notif-body { flex: 1; font-size: .92rem; }
.notif-page-item .row-actions { flex-wrap: wrap; }
@media (max-width: 640px) { .notif-panel { position: fixed; left: 1rem; right: 1rem; top: 60px; width: auto; max-width: none; } }

/* ======================= Stage 6: announcements ======================= */
.ann-list { display: grid; gap: .9rem; }
.ann-card { padding: 1rem 1.25rem; border-left: 4px solid var(--gray-300); }
.ann-card.priority-urgent { border-left-color: var(--red); }
.ann-card.priority-high { border-left-color: var(--amber); }
.ann-card.priority-normal { border-left-color: var(--blue-500); }
.ann-head { display: flex; justify-content: space-between; align-items: flex-start; gap: .75rem; flex-wrap: wrap; }
.ann-head h3 { font-size: 1.05rem; margin: 0; overflow-wrap: anywhere; }
.ann-tags { display: flex; gap: .4rem; flex-wrap: wrap; }
.ann-excerpt { margin: .5rem 0 .75rem; color: var(--gray-700); overflow-wrap: anywhere; }
.ann-foot { display: flex; justify-content: space-between; align-items: center; gap: .75rem; flex-wrap: wrap; }
.ann-detail { display: grid; gap: .8rem; }
.pre-wrap { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.5; }
.modal:has(.modal-wide) { max-width: 680px; }
.modal-wide select[multiple] { min-height: 10rem; }

/* ---------- tasks (Stage 4) ---------- */
.seg { display: inline-flex; border: 1px solid var(--gray-300); border-radius: 8px; overflow: hidden; background: #fff; }
.seg-btn { background: none; border: 0; padding: .55rem 1rem; font: inherit; font-weight: 600; color: var(--gray-700); cursor: pointer; }
.seg-btn.active { background: var(--blue-600); color: #fff; }
.tk-mine { padding: 0 .4rem; }
.tk-mine input { width: 16px; height: 16px; }

.kb-board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(235px, 1fr); gap: .9rem; overflow-x: auto; align-items: start; padding-bottom: .75rem; }
.kb-col { background: var(--gray-200); border-radius: var(--radius); display: flex; flex-direction: column; max-height: calc(100vh - 260px); min-height: 160px; }
.kb-col-head { display: flex; align-items: center; justify-content: space-between; padding: .7rem .85rem; font-weight: 700; font-size: .85rem; text-transform: uppercase; letter-spacing: .04em; color: var(--gray-700); }
.kb-count { background: #fff; border-radius: 99px; padding: .05rem .55rem; font-size: .75rem; color: var(--gray-700); }
.kb-col-body { padding: 0 .6rem .6rem; display: grid; gap: .6rem; overflow-y: auto; align-content: start; min-height: 90px; flex: 1; border-radius: 0 0 var(--radius) var(--radius); }
.kb-col-body.over { background: var(--blue-100); }
.kb-empty { color: var(--gray-500); font-size: .82rem; text-align: center; padding: 1rem .5rem; }
.kb-placeholder { height: 4px; border-radius: 4px; background: var(--blue-500); }
.kb-card { background: #fff; border-radius: 9px; box-shadow: var(--shadow); padding: .7rem .8rem; border-left: 4px solid var(--gray-300); display: grid; gap: .5rem; }
.kb-card[draggable="true"] { cursor: grab; }
.kb-card.dragging { opacity: .45; }
.kb-card.prio-urgent { border-left-color: var(--red); }
.kb-card.prio-high { border-left-color: #e08a00; }
.kb-card.prio-medium { border-left-color: var(--blue-500); }
.kb-card.prio-low { border-left-color: var(--gray-300); }
.kb-title { font-weight: 600; font-size: .92rem; line-height: 1.3; color: var(--gray-900); word-break: break-word; }
.kb-title:hover { color: var(--blue-700); }
.kb-meta { display: flex; flex-wrap: wrap; gap: .35rem .6rem; align-items: center; font-size: .78rem; color: var(--gray-500); }
.kb-row { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.kb-avatars { display: inline-flex; }
.kb-avatars .avatar-img { width: 26px; height: 26px; font-size: .72rem; border: 2px solid #fff; margin-left: -6px; }
.kb-avatars .avatar-img:first-child { margin-left: 0; }
.kb-avatars .more { width: 26px; height: 26px; border-radius: 50%; background: var(--gray-200); color: var(--gray-700); font-size: .7rem; font-weight: 700; display: inline-grid; place-items: center; border: 2px solid #fff; margin-left: -6px; }
.kb-move { padding: .1rem .5rem; font-size: .75rem; }
.tk-due.overdue { color: var(--red); font-weight: 700; }
.tk-prio { display: inline-block; padding: .05rem .5rem; border-radius: 99px; font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; margin: 0; }
.tk-prio.urgent { background: var(--red-bg); color: var(--red); }
.tk-prio.high { background: var(--amber-bg); color: var(--amber); }
.tk-prio.medium { background: var(--blue-100); color: var(--blue-700); }
.tk-prio.low { background: var(--gray-200); color: var(--gray-700); }
.tk-st { display: inline-block; padding: .15rem .6rem; border-radius: 99px; font-size: .78rem; font-weight: 600; white-space: nowrap; }
.tk-st.backlog { background: var(--gray-200); color: var(--gray-700); }
.tk-st.assigned { background: var(--blue-100); color: var(--blue-700); }
.tk-st.in_progress { background: #efe6fb; color: #6b3fb0; }
.tk-st.on_hold { background: var(--amber-bg); color: var(--amber); }
.tk-st.review { background: #fff4c7; color: #7a5a00; }
.tk-st.completed { background: var(--green-bg); color: var(--green); }
.tk-st.cancelled { background: var(--red-bg); color: var(--red); }
.tk-people { display: flex; flex-wrap: wrap; gap: .3rem; }
.tk-progress-cell { min-width: 90px; }

.tk-picker { border: 1px solid var(--gray-300); border-radius: 8px; padding: .5rem; display: grid; gap: .4rem; }
.tk-picker input[type=search] { padding: .45rem .6rem; border: 1px solid var(--gray-300); border-radius: 6px; font: inherit; }
.tk-picker-list { max-height: 190px; overflow-y: auto; display: grid; gap: .1rem; }
.tk-picker-list label { display: flex; align-items: center; gap: .55rem; padding: .3rem .35rem; border-radius: 6px; cursor: pointer; font-size: .9rem; }
.tk-picker-list label:hover { background: var(--gray-100); }
.tk-picker-list input { width: 16px; height: 16px; }
.tk-picker-list small { color: var(--gray-500); }
.modal.wide { max-width: 620px; }

.tk-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 1.25rem; align-items: start; }
.tk-main, .tk-side { display: grid; gap: 1.25rem; min-width: 0; }
.tk-head { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; align-items: flex-start; margin-bottom: 1.25rem; }
.tk-head h2 { font-size: 1.4rem; word-break: break-word; }
.tk-head .tk-tags { display: flex; gap: .5rem; align-items: center; margin-top: .4rem; flex-wrap: wrap; }
.tk-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.tk-desc { white-space: pre-wrap; word-break: break-word; margin: 0; }
.tk-section-head { display: flex; justify-content: space-between; align-items: center; gap: .5rem; margin-bottom: .8rem; }
.tk-section-head h3 { font-size: .95rem; }
.tk-kv { display: grid; grid-template-columns: 6.5rem minmax(0, 1fr); gap: .55rem .75rem; font-size: .88rem; margin: 0; }
.tk-kv dt { color: var(--gray-500); }
.tk-kv dd { margin: 0; word-break: break-word; }
.tk-range { width: 100%; }
.tk-range-row { display: flex; gap: .6rem; align-items: center; }
.tk-range-row output { min-width: 2.6rem; text-align: right; font-weight: 700; }
.tk-sub { display: flex; align-items: center; gap: .6rem; padding: .45rem 0; border-bottom: 1px solid var(--gray-100); }
.tk-sub:last-child { border-bottom: 0; }
.tk-sub input[type=checkbox] { width: 18px; height: 18px; flex: none; }
.tk-sub .t { flex: 1; word-break: break-word; }
.tk-sub .t.done { text-decoration: line-through; color: var(--gray-500); }
.tk-add { display: flex; gap: .5rem; margin-top: .8rem; }
.tk-add input { flex: 1; min-width: 0; padding: .55rem .7rem; border: 1px solid var(--gray-300); border-radius: 8px; font: inherit; }
.tk-comment { display: flex; gap: .7rem; padding: .8rem 0; border-bottom: 1px solid var(--gray-100); }
.tk-comment:last-child { border-bottom: 0; }
.tk-comment .body { flex: 1; min-width: 0; }
.tk-comment .who { font-size: .85rem; }
.tk-comment .who small { color: var(--gray-500); margin-left: .4rem; }
.tk-comment p { margin: .2rem 0 0; white-space: pre-wrap; word-break: break-word; }
.tk-comment .row-actions { justify-content: flex-start; margin-top: .3rem; }
.tk-comment-form { display: grid; gap: .5rem; margin-top: .8rem; }
.tk-comment-form textarea { width: 100%; padding: .65rem .8rem; border: 1px solid var(--gray-300); border-radius: 8px; font: inherit; resize: vertical; min-height: 70px; }
.tk-file { display: flex; align-items: center; gap: .7rem; padding: .5rem 0; border-bottom: 1px solid var(--gray-100); }
.tk-file:last-child { border-bottom: 0; }
.tk-file .info { flex: 1; min-width: 0; }
.tk-file .info a { font-weight: 600; word-break: break-all; }
.tk-file .info small { display: block; color: var(--gray-500); }
.tk-file img { width: 44px; height: 44px; object-fit: cover; border-radius: 6px; border: 1px solid var(--gray-200); }
.tk-file .ico { width: 44px; height: 44px; border-radius: 6px; background: var(--blue-50); color: var(--blue-700); display: grid; place-items: center; font-size: .7rem; font-weight: 800; text-transform: uppercase; }
.tk-upload { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin-top: .8rem; }
.tk-upload input[type=file] { font: inherit; max-width: 100%; }
.tk-banner { margin-bottom: 1rem; }
@media (max-width: 980px) {
    .tk-layout { grid-template-columns: 1fr; }
    .kb-col { max-height: none; }
}

/* ======================= Stage 9: audit log viewer ======================= */
.inline-date { display: inline-flex; align-items: center; gap: .4rem; font-size: .85rem; color: var(--gray-700); }
.inline-date input { padding: .5rem .6rem; border: 1px solid var(--gray-300); border-radius: 8px; font: inherit; }
.nowrap { white-space: nowrap; }
.audit-detail { display: grid; gap: 1rem; }
.modal:has(.audit-detail) { max-width: 760px; }
.kv-wide { grid-template-columns: 7rem 1fr; }
.diff-table td { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .8rem; overflow-wrap: anywhere; vertical-align: top; }
.diff-table tr.diff-changed .diff-old { background: var(--red-bg); }
.diff-table tr.diff-changed .diff-new { background: var(--green-bg); }
.modal:has(.form-grid), .modal:has(.tk-picker) { max-width: 620px; }

/* ======================= Stage 5/6: departments & leave ======================= */
.dept-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 1rem; }
.dept-card { background: #fff; border: 1px solid var(--gray-200); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1rem 1.1rem; display: flex; flex-direction: column; gap: .7rem; }
.dept-card.is-inactive { opacity: .72; background: var(--gray-100); }
.dept-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: .6rem; }
.dept-card-head h3 { font-size: 1.05rem; word-break: break-word; }
.dept-card-head h3 a { color: var(--gray-900); }
.dept-code { display: inline-block; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .75rem; font-weight: 700; background: var(--blue-50); color: var(--blue-700); padding: .05rem .45rem; border-radius: 6px; margin-right: .4rem; }
.dept-desc { color: var(--gray-500); font-size: .85rem; margin: 0; min-height: 1.3em; }
.dept-manager { display: flex; align-items: center; gap: .6rem; font-size: .88rem; }
.dept-manager .avatar-img { width: 30px; height: 30px; font-size: .85rem; }
.dept-manager small { display: block; color: var(--gray-500); font-size: .75rem; line-height: 1.1; }
.dept-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; border-top: 1px solid var(--gray-100); padding-top: .7rem; }
.dept-metrics .v { font-size: 1.25rem; font-weight: 700; line-height: 1.1; }
.dept-metrics .k { color: var(--gray-500); font-size: .75rem; }
.dept-card-foot { display: flex; gap: .4rem; flex-wrap: wrap; margin-top: auto; }
.crumbs { font-size: .85rem; color: var(--gray-500); margin-bottom: .4rem; }
.crumbs a { color: var(--gray-500); }
.split { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 1.25rem; margin-top: 1.25rem; }
.section-head { display: flex; justify-content: space-between; align-items: center; gap: .75rem; margin-bottom: .75rem; flex-wrap: wrap; }
.section-head h3 { font-size: 1rem; }
.stack { display: grid; gap: 1.25rem; }
.mini-list { list-style: none; margin: 0; padding: 0; }
.mini-list li { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .55rem 0; border-bottom: 1px solid var(--gray-100); font-size: .9rem; }
.mini-list li:last-child { border-bottom: 0; }
.pick-list { display: grid; gap: .35rem; max-height: 240px; overflow-y: auto; }
.pick-item { display: flex; align-items: center; gap: .6rem; padding: .45rem .6rem; border: 1px solid var(--gray-200); border-radius: 8px; background: #fff; cursor: pointer; text-align: left; font: inherit; width: 100%; }
.pick-item:hover { background: var(--blue-50); }
.pick-item.selected { border-color: var(--blue-600); background: var(--blue-50); }
.pick-item small { color: var(--gray-500); display: block; }
.modal.modal-wide { max-width: 560px; }
.inline-note { font-size: .85rem; padding: .5rem .75rem; border-radius: 8px; background: var(--blue-50); color: var(--blue-700); }
.inline-note.bad { background: var(--red-bg); color: var(--red); }
.inline-note.good { background: var(--green-bg); color: var(--green); }
.leave-tabs-note { margin: 0 0 1rem; }
.cal-events { display: grid; gap: 2px; margin-top: .2rem; }
.cal-chip { font-size: .68rem; line-height: 1.25; padding: .05rem .3rem; border-radius: 4px; background: var(--blue-100); color: var(--blue-700); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-chip.wfh { background: #efe6fb; color: #6b3fb0; }
.cal-more { font-size: .68rem; color: var(--gray-500); }
.cal-holiday { background: var(--amber-bg); }
.cal-weekend { background: var(--gray-200); }
.cal-grid .cal-cell { min-height: 84px; align-items: stretch; justify-content: flex-start; }
.bal-cell { background: none; border: 1px solid var(--gray-200); border-radius: 6px; padding: .2rem .5rem; font: inherit; font-size: .82rem; cursor: pointer; color: var(--gray-900); white-space: nowrap; }
.bal-cell:hover { background: var(--blue-50); border-color: var(--blue-500); }
.bal-cell.low { color: var(--red); }
.bal-cell.none { color: var(--gray-500); border-style: dashed; }
.subtabs { display: flex; gap: .4rem; margin-bottom: 1rem; flex-wrap: wrap; }
.subtabs .btn.active { background: var(--blue-100); color: var(--blue-700); border-color: var(--blue-100); }
.cell-truncate { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 860px) { .split { grid-template-columns: 1fr; } }

/* ======================= Stage 8: reports ======================= */
.rep-note { margin: -.25rem 0 1rem; font-size: .85rem; }
.rep-panel { margin-bottom: 1rem; }
.rep-h { font-size: .95rem; margin: 1.25rem 0 .6rem; }
#repBody .table-wrap { margin-bottom: 1rem; }
.bar-fill.tone-green { background: var(--green); }
.bar-fill.tone-red { background: var(--red); }
.bar-fill.tone-amber { background: #d9891a; }
.bar-fill.tone-blue { background: var(--blue-500); }
.bar-fill.tone-purple { background: #7c52c4; }
.bar-fill.tone-gray { background: var(--gray-500); }
#repBody .bar-row { grid-template-columns: 10rem 1fr minmax(2.5rem, auto); }
.mt-1 { margin-top: 1rem; }
.stack > *, .split > * { min-width: 0; }
.modal-wide .form-grid { align-items: start; }

/* ======================= Stage 13: internal chat ======================= */
.visually-hidden { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.nav-heading { font-size: .68rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: rgba(207, 220, 245, .55); padding: .9rem .8rem .25rem; }
.nav-heading:first-child { padding-top: .2rem; }
.nav-badge { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; background: var(--red); color: #fff; font-size: .7rem; font-weight: 700; display: inline-grid; place-items: center; }

.chat { display: grid; grid-template-columns: 340px minmax(0, 1fr); height: calc(100vh - 172px); height: calc(100dvh - 172px); min-height: 460px; background: #fff; border: 1px solid var(--gray-200); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.chat-list { border-right: 1px solid var(--gray-200); display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.chat-list-head { display: flex; gap: .5rem; padding: .75rem; align-items: center; }
.chat-search { flex: 1; min-width: 0; }
.chat-search input { width: 100%; padding: .5rem .7rem; border: 1px solid var(--gray-300); border-radius: 8px; font: inherit; }
.chat-tabs { margin: 0; padding: 0 .5rem; }
.chat-tabs .tab { padding: .5rem .75rem; font-size: .875rem; }
.chat-scroll { overflow-y: auto; flex: 1; min-height: 0; }
.chat-section { font-size: .72rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--gray-500); padding: .75rem 1rem .3rem; }

.chat-item { display: flex; gap: .7rem; align-items: center; width: 100%; padding: .7rem .9rem; border: 0; border-bottom: 1px solid var(--gray-100); background: #fff; text-align: left; font: inherit; color: inherit; cursor: pointer; }
.chat-item:hover { background: var(--blue-50); }
.chat-item.active { background: var(--blue-100); }
.chat-item:focus-visible { outline: 2px solid var(--blue-500); outline-offset: -2px; }
.chat-item-body { flex: 1; min-width: 0; display: grid; gap: .1rem; }
.chat-item-top, .chat-item-bottom { display: flex; align-items: center; justify-content: space-between; gap: .5rem; min-width: 0; }
.chat-item-title { font-weight: 600; font-size: .92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-item.unread .chat-item-title { font-weight: 700; }
.chat-item-time { color: var(--gray-500); font-size: .72rem; white-space: nowrap; flex: none; }
.chat-item-preview { color: var(--gray-500); font-size: .84rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.chat-item.unread .chat-item-preview { color: var(--gray-900); font-weight: 500; }
.chat-item-preview.wrap { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.chat-unread { background: var(--blue-600); color: #fff; border-radius: 99px; min-width: 20px; height: 20px; padding: 0 6px; font-size: .72rem; font-weight: 700; display: inline-grid; place-items: center; flex: none; }
.chat-muted { font-size: .75rem; flex: none; }

.chat-avatar { position: relative; display: inline-block; flex: none; }
.chat-avatar .avatar-img { width: 40px; height: 40px; }
.chat-avatar .group-avatar { background: var(--blue-50); font-size: 1.1rem; }
.presence { position: absolute; right: -1px; bottom: -1px; width: 11px; height: 11px; border-radius: 50%; background: var(--gray-300); border: 2px solid #fff; }
.presence.on { background: #22a559; }

.chat-thread { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--gray-100); }
.chat-thread-inner { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.chat-thread-inner[hidden] { display: none; }
.chat-empty { margin: auto; text-align: center; padding: 2rem; max-width: 380px; }
.chat-empty h2 { font-size: 1.2rem; margin: .6rem 0 .25rem; }
.chat-empty .btn { margin-top: 1rem; }
.chat-empty-icon { width: 56px; height: 56px; margin: 0 auto; border-radius: 50%; background: var(--blue-100); color: var(--blue-700); display: grid; place-items: center; }
.chat-empty-icon .icon { width: 28px; height: 28px; }
.chat-thread-head { display: flex; align-items: center; gap: .7rem; padding: .65rem 1rem; background: #fff; border-bottom: 1px solid var(--gray-200); }
.chat-back { display: none; }
.chat-head-avatar .avatar-img { width: 38px; height: 38px; }
.chat-head-info { display: grid; text-align: left; background: none; border: 0; font: inherit; color: inherit; cursor: pointer; padding: .1rem .3rem; border-radius: 8px; min-width: 0; flex: 1; }
.chat-head-info:hover { background: var(--gray-100); }
.chat-head-info strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-head-info small { color: var(--gray-500); }
.chat-head-info small.is-online { color: #17803d; }

.chat-messages { flex: 1; overflow-y: auto; padding: 1rem 1.25rem; display: flex; flex-direction: column; gap: .15rem; min-height: 0; scroll-behavior: auto; }
.chat-messages:focus-visible { outline: 2px solid var(--blue-500); outline-offset: -2px; }
.chat-older { align-self: center; margin-bottom: .5rem; }
.chat-start { text-align: center; color: var(--gray-500); margin: auto; }
.msg-day { align-self: center; margin: .8rem 0 .4rem; padding: .15rem .7rem; background: #fff; border: 1px solid var(--gray-200); border-radius: 99px; font-size: .74rem; color: var(--gray-500); }
.msg-unread-divider { display: flex; align-items: center; gap: .6rem; margin: .8rem 0 .4rem; color: var(--blue-700); font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.msg-unread-divider::before, .msg-unread-divider::after { content: ""; flex: 1; height: 1px; background: var(--blue-500); opacity: .4; }
.msg-system { align-self: center; color: var(--gray-500); font-size: .78rem; margin: .5rem 0; text-align: center; }
.msg { display: flex; gap: .55rem; align-items: flex-end; max-width: 100%; margin-top: .55rem; position: relative; }
.msg.grouped { margin-top: .12rem; }
.msg.mine { flex-direction: row-reverse; }
.msg-avatar { width: 30px; flex: none; }
.msg-avatar .avatar-img { width: 30px; height: 30px; font-size: .8rem; }
.msg-body { display: grid; gap: .15rem; max-width: min(72%, 620px); min-width: 0; }
.msg.mine .msg-body { justify-items: end; }
.msg-meta { font-size: .74rem; color: var(--gray-500); display: flex; gap: .5rem; }
.msg-name { font-weight: 700; color: var(--gray-700); }
.msg-bubble { background: #fff; border: 1px solid var(--gray-200); padding: .5rem .75rem; border-radius: 14px 14px 14px 4px; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.4; }
.msg.mine .msg-bubble { background: var(--blue-600); border-color: var(--blue-600); color: #fff; border-radius: 14px 14px 4px 14px; }
.msg.mine .msg-bubble a { color: #fff; text-decoration: underline; }
.msg.deleted .msg-bubble { background: transparent; border-style: dashed; color: var(--gray-500); }
.msg.flash .msg-bubble { box-shadow: 0 0 0 3px #f7c948; }
.msg-status { font-size: .7rem; color: var(--gray-500); }
.msg-status.seen { color: var(--blue-700); }
.msg-del { opacity: 0; align-self: center; font-size: .85rem; transition: opacity .12s; }
.msg:hover .msg-del, .msg:focus-within .msg-del { opacity: 1; }
.chat-new-pill { position: absolute; left: 50%; bottom: 84px; transform: translateX(-50%); background: var(--blue-700); color: #fff; border: 0; border-radius: 99px; padding: .4rem .9rem; font-weight: 600; font-size: .85rem; box-shadow: 0 4px 14px rgba(0, 0, 0, .25); cursor: pointer; z-index: 3; }
.chat-composer { display: flex; gap: .6rem; align-items: flex-end; padding: .7rem .9rem; background: #fff; border-top: 1px solid var(--gray-200); position: relative; }
.chat-composer textarea { flex: 1; resize: none; padding: .6rem .8rem; border: 1px solid var(--gray-300); border-radius: 10px; font: inherit; line-height: 1.35; max-height: 140px; min-height: 42px; }
.chat-composer textarea:focus { outline: 2px solid var(--blue-100); border-color: var(--blue-500); }
.chat-count { position: absolute; right: 6.2rem; top: -1.2rem; font-size: .72rem; color: var(--gray-500); background: #fff; padding: 0 .3rem; border-radius: 4px; }
.chat-count.over { color: var(--red); font-weight: 700; }
.chat-readonly { margin: 0; padding: .9rem 1rem; text-align: center; color: var(--gray-500); background: #fff; border-top: 1px solid var(--gray-200); font-size: .9rem; }

.chat-person { display: flex; align-items: center; gap: .7rem; width: 100%; padding: .5rem .6rem; border: 0; border-radius: 8px; background: none; font: inherit; text-align: left; color: inherit; cursor: pointer; }
.chat-person:hover:not(.static) { background: var(--blue-50); }
.chat-person.static { cursor: default; }
.chat-person input[type=checkbox] { width: 18px; height: 18px; flex: none; }
.chat-person-info { display: grid; min-width: 0; flex: 1; }
.chat-person-info small { color: var(--gray-500); }
.chat-picker { display: grid; gap: .5rem; }
.chat-picker > input { padding: .55rem .75rem; border: 1px solid var(--gray-300); border-radius: 8px; font: inherit; width: 100%; }
.chat-picker-list { max-height: 260px; overflow-y: auto; border: 1px solid var(--gray-200); border-radius: 8px; padding: .25rem; }
.chat-chips { display: flex; flex-wrap: wrap; gap: .35rem; }
.chat-chip { display: inline-flex; align-items: center; gap: .3rem; background: var(--blue-100); color: var(--blue-700); border-radius: 99px; padding: .15rem .3rem .15rem .7rem; font-size: .82rem; font-weight: 600; }
.chat-chip button { border: 0; background: none; color: inherit; cursor: pointer; font-size: 1rem; line-height: 1; padding: 0 .25rem; }
.chat-aud { display: flex; flex-wrap: wrap; gap: .4rem 1.1rem; }
.chat-info { display: grid; gap: .6rem; }
.chat-info-head { display: flex; align-items: center; gap: .8rem; }
.chat-members { max-height: 240px; overflow-y: auto; }
.field-label { font-weight: 600; font-size: .875rem; color: var(--gray-700); }
.modal.modal-chat { max-width: 520px; }

@media (max-width: 860px) {
    .chat { grid-template-columns: 1fr; height: calc(100vh - 150px); height: calc(100dvh - 150px); }
    .chat-thread { display: none; }
    .chat.is-thread .chat-list { display: none; }
    .chat.is-thread .chat-thread { display: flex; }
    .chat-back { display: inline-flex; }
    .msg-body { max-width: 84%; }
    .msg-del { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) { .msg-del { transition: none; } }

/* ---- Dashboard slider ---- */
a.stat { display: block; color: inherit; text-decoration: none; }
a.stat:hover { box-shadow: var(--shadow-lg, 0 4px 14px rgba(0,0,0,.12)); }
a.stat:focus-visible, .slider-tab:focus-visible, .slider-track:focus-visible { outline: 2px solid var(--blue-600); outline-offset: 2px; }
.slider-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: 1rem; }
.slider-tabs { display: flex; gap: .4rem; overflow-x: auto; scrollbar-width: none; min-width: 0; padding: 2px; }
.slider-tabs::-webkit-scrollbar { display: none; }
.slider-tab { flex: none; border: 1px solid var(--gray-200); background: #fff; color: var(--gray-700, #374151); border-radius: 99px; padding: .35rem .85rem; font: inherit; font-size: .85rem; cursor: pointer; white-space: nowrap; }
.slider-tab.is-active { background: var(--blue-600); border-color: var(--blue-600); color: #fff; font-weight: 600; }
.slider-nav { display: flex; gap: .35rem; flex: none; }
.slider-nav .btn { min-width: 2.2rem; }
.slider-nav .btn[disabled] { opacity: .4; cursor: default; }
.slider-track { display: flex; align-items: flex-start; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; overscroll-behavior-x: contain; }
.slider-track::-webkit-scrollbar { display: none; }
.slide { flex: 0 0 100%; min-width: 0; scroll-snap-align: start; scroll-snap-stop: always; display: flex; flex-direction: column; gap: 1.25rem; padding: 2px; box-sizing: border-box; }
.quick-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.quick-actions .btn { text-decoration: none; }
@media (max-width: 640px) { .slider-nav { display: none; } }
@media (prefers-reduced-motion: no-preference) { .slider-tab { transition: background .15s, color .15s; } }

/* ---- Teams ---- */
.pick-row { flex-wrap: wrap; font-weight: 500; padding: .3rem .2rem; }
.pick-row small { flex-basis: 100%; margin-left: 1.9rem; }
#teamView .panel { margin-bottom: 1rem; }
#teamView .page-title .badge { margin-left: .6rem; vertical-align: middle; }
#teamView .table-wrap { margin-bottom: 1rem; }

/* ---- Work updates ---- */
.wu-list { display: grid; gap: .9rem; margin-bottom: 1rem; }
.wu-card { background: #fff; border: 1px solid var(--gray-200); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1rem 1.25rem; display: grid; gap: .6rem; }
.wu-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; }
.wu-head small { display: block; }
.wu-block small { text-transform: uppercase; letter-spacing: .04em; font-size: .7rem; font-weight: 700; }
.wu-text { margin: .15rem 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.wu-review { border-left: 3px solid var(--gray-300); padding-left: .75rem; }
#workUpdates .panel { margin-bottom: 1rem; }

/* ---- Settings ---- */
#settings .panel { margin-bottom: 1rem; }
.day-picks { display: flex; flex-wrap: wrap; gap: .4rem 1rem; padding: .35rem 0; }
.day-picks .check { font-weight: 500; }
.matrix-wrap { max-height: 70vh; overflow: auto; }
.matrix th { position: sticky; top: 0; z-index: 1; text-align: center; }
.matrix th:first-child { text-align: left; }
.matrix-sub { display: block; font-weight: 400; text-transform: none; letter-spacing: 0; font-size: .72rem; }
.matrix-cell { text-align: center; }
.matrix-cell input { width: 18px; height: 18px; }
.matrix-group td { background: var(--gray-100); font-weight: 700; font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--gray-700); }
.matrix-actions { display: flex; align-items: center; gap: 1rem; margin-top: 1rem; flex-wrap: wrap; }

/* ---- Stage 14: consistency pass ---- */
/* The sidebar has many sections for admins: the menu scrolls, the footer stays put. */
.nav { overflow-y: auto; min-height: 0; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, .25) transparent; }
.sidebar-foot { flex: none; }
/* One keyboard-focus style for every control. */
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible { outline: 2px solid var(--blue-500); outline-offset: 2px; }
.nav-link:focus-visible { outline-color: #fff; outline-offset: -2px; }
/* Both stat card styles look identical. */
.stat-card { border-left-color: var(--gray-300); }
.stat-card, .stat { box-shadow: var(--shadow); }
/* Tables scroll sideways on small screens: show a shadow on the edge that has more to reveal. */
.table-wrap { background:
    linear-gradient(to right, #fff 30%, rgba(255, 255, 255, 0)) left center / 2rem 100% no-repeat local,
    linear-gradient(to left, #fff 30%, rgba(255, 255, 255, 0)) right center / 2rem 100% no-repeat local,
    radial-gradient(farthest-side at 0 50%, rgba(16, 24, 40, .18), rgba(16, 24, 40, 0)) left center / .7rem 100% no-repeat scroll,
    radial-gradient(farthest-side at 100% 50%, rgba(16, 24, 40, .18), rgba(16, 24, 40, 0)) right center / .7rem 100% no-repeat scroll,
    #fff; }
@media (max-width: 640px) {
    .page-head { flex-direction: column; align-items: stretch; }
    .page-actions .btn { flex: 1 1 auto; justify-content: center; }
    .toolbar > select, .toolbar > input[type=search], .toolbar > input[type=date] { flex: 1 1 100%; }
    .toolbar > .btn { flex: 1 1 auto; }
    .content { padding: .9rem; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
