/* ==========================================================================
   MPAI Project Management — application styles
   Visual direction (Design Document 6): deep navy #183052, accent blue #23588C,
   soft neutral #F5F7FA, white surfaces, 8-point spacing, subtle borders.
   ========================================================================== */

:root {
	--mpai-navy: #183052;
	--mpai-navy-2: #21406b;
	--mpai-blue: #23588c;
	--mpai-blue-rgb: 35, 88, 140;
	--mpai-bg: #f5f7fa;
	--mpai-surface: #ffffff;
	--mpai-border: #dfe5ec;
	--mpai-border-strong: #c9d2dd;
	--mpai-text: #1f2a37;
	--mpai-muted: #5f6b7a;
	--mpai-sidebar-w: 248px;
	--mpai-topbar-h: 60px;
	--mpai-radius: 10px;
	--mpai-shadow: 0 1px 2px rgba(24, 48, 82, .06);

	--bs-body-font-family: "Aptos", "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
	--bs-body-color: var(--mpai-text);
	--bs-body-bg: var(--mpai-bg);
	--bs-primary: #23588c;
	--bs-primary-rgb: 35, 88, 140;
	--bs-link-color: #23588c;
	--bs-link-color-rgb: 35, 88, 140;
	--bs-link-hover-color: #183052;
	--bs-border-color: var(--mpai-border);
	--bs-border-radius: 8px;
	--bs-focus-ring-color: rgba(35, 88, 140, .28);
	--bs-secondary-color: var(--mpai-muted);
}

html { font-size: 15px; }
:root:lang(ja) { --bs-body-font-family: "Aptos", "Segoe UI", "Yu Gothic UI", "Meiryo UI", "Hiragino Sans", "Noto Sans JP", system-ui, -apple-system, Arial, sans-serif; }
body { background: var(--mpai-bg); color: var(--mpai-text); min-height: 100vh; }
h1, h2, h3, h4, h5 { color: var(--mpai-navy); font-weight: 650; letter-spacing: -.01em; }
a { text-decoration-thickness: 1px; text-underline-offset: 2px; }
.text-muted, .text-secondary { color: var(--mpai-muted) !important; }
.fw-semibold { font-weight: 600 !important; }
small, .small { font-size: .85em; }
.tabular { font-variant-numeric: tabular-nums; }

/* Accessibility */
.skip-link { position: absolute; left: -999px; top: 8px; z-index: 2000; background: #fff; color: var(--mpai-navy); padding: 8px 16px; border-radius: 6px; box-shadow: var(--mpai-shadow); }
.skip-link:focus { left: 8px; }
:focus-visible { outline: 3px solid rgba(35, 88, 140, .55); outline-offset: 2px; border-radius: 4px; }

/* Buttons */
.btn { font-weight: 550; }
.btn-primary { --bs-btn-bg: var(--mpai-navy); --bs-btn-border-color: var(--mpai-navy); --bs-btn-hover-bg: var(--mpai-blue); --bs-btn-hover-border-color: var(--mpai-blue); --bs-btn-active-bg: var(--mpai-blue); --bs-btn-active-border-color: var(--mpai-blue); --bs-btn-disabled-bg: var(--mpai-navy); --bs-btn-disabled-border-color: var(--mpai-navy); --bs-btn-focus-shadow-rgb: 35, 88, 140; }
.btn-outline-primary { --bs-btn-color: var(--mpai-navy); --bs-btn-border-color: var(--mpai-border-strong); --bs-btn-hover-bg: var(--mpai-navy); --bs-btn-hover-border-color: var(--mpai-navy); --bs-btn-active-bg: var(--mpai-navy); --bs-btn-active-border-color: var(--mpai-navy); }
.btn-outline-secondary { --bs-btn-color: #3b4756; --bs-btn-border-color: var(--mpai-border-strong); --bs-btn-hover-bg: #eef2f6; --bs-btn-hover-color: var(--mpai-navy); --bs-btn-hover-border-color: var(--mpai-border-strong); --bs-btn-active-bg: #e4eaf1; --bs-btn-active-color: var(--mpai-navy); }
.btn-light { --bs-btn-bg: #fff; --bs-btn-border-color: var(--mpai-border); }
.form-control, .form-select { border-color: var(--mpai-border-strong); }
.form-control:focus, .form-select:focus { border-color: var(--mpai-blue); box-shadow: 0 0 0 .2rem rgba(35, 88, 140, .2); }
.form-label { font-weight: 600; font-size: .88rem; color: #2b3746; margin-bottom: .3rem; }
.form-text { color: var(--mpai-muted); }
.req::after { content: " *"; color: #b42318; }

/* ----------------------------------------------------------------- shell */
.app-shell { display: flex; min-height: 100vh; }
.sidebar { position: fixed; z-index: 1040; inset: 0 auto 0 0; width: var(--mpai-sidebar-w); background: var(--mpai-navy); color: #d6e0ee; display: flex; flex-direction: column; transition: transform .2s ease, width .2s ease; }
.sidebar-brand { display: flex; align-items: center; height: var(--mpai-topbar-h); padding: 0 20px; text-decoration: none; border-bottom: 1px solid rgba(255, 255, 255, .08); }
.sidebar-brand:hover { color: #fff; }
/* The MPAI logo (assets/img): the white version sits on dark surfaces, the navy one on light surfaces. */
.brand-logo { display: block; height: 32px; width: auto; max-width: 100%; flex: none; }
.brand-mark-img { display: none; height: 28px; width: auto; }
.sidebar-nav { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 14px 12px; }
.sidebar-section { text-transform: uppercase; font-size: .68rem; letter-spacing: .09em; color: #8ea3bf; padding: 16px 10px 6px; font-weight: 700; }
.sidebar .nav-link { display: flex; align-items: center; gap: 12px; color: #d6e0ee; padding: 9px 12px; border-radius: 8px; font-weight: 520; font-size: .94rem; margin-bottom: 2px; }
.sidebar .nav-link i { font-size: 1.05rem; opacity: .9; width: 20px; text-align: center; }
.sidebar .nav-link:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.sidebar .nav-link.active { background: #fff; color: var(--mpai-navy); }
.sidebar .nav-link.active i { opacity: 1; color: var(--mpai-blue); }
.sidebar .nav-link .nav-count { margin-left: auto; background: #e5484d; color: #fff; border-radius: 999px; font-size: .72rem; padding: 1px 8px; font-weight: 700; }
.sidebar-foot { padding: 10px 12px; border-top: 1px solid rgba(255, 255, 255, .08); }
.sidebar-foot .nav-link { margin-bottom: 0; cursor: pointer; font: inherit; font-weight: 520; font-size: .94rem; }
.sidebar-foot .nav-link:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.sidebar-backdrop { display: none; position: fixed; inset: 0; background: rgba(15, 25, 40, .5); z-index: 1035; }

/* Collapsed left menu (wide screens only): an icon rail. Labels stay in the page for screen readers; hovering an icon names it
   (app.js adds a title), and the pending-approvals count becomes a small badge on its icon. */
@media (min-width: 992px) {
	body.sidebar-collapsed { --mpai-sidebar-w: 72px; }
	body.sidebar-collapsed .sidebar-brand { justify-content: center; padding: 0; }
	body.sidebar-collapsed .brand-logo { display: none; }
	body.sidebar-collapsed .brand-mark-img { display: block; }
	body.sidebar-collapsed .sidebar-nav { padding: 14px 10px; }
	body.sidebar-collapsed .sidebar-foot { padding: 10px; }
	body.sidebar-collapsed .sidebar .nav-link { justify-content: center; position: relative; padding: 11px 0; gap: 0; }
	body.sidebar-collapsed .sidebar .nav-link i { width: auto; font-size: 1.2rem; }
	body.sidebar-collapsed .sidebar .nav-link > span:not(.nav-count) { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
	body.sidebar-collapsed .sidebar .nav-link .nav-count { position: absolute; top: 2px; right: 6px; margin: 0; padding: 0 5px; font-size: .62rem; line-height: 1.5; }
	body.sidebar-collapsed .sidebar-section { height: 1px; margin: 12px 12px; padding: 0; overflow: hidden; font-size: 0; background: rgba(255, 255, 255, .14); }
}
@media (prefers-reduced-motion: reduce) { .sidebar, .app-main { transition: none; } }

.app-main { flex: 1; margin-left: var(--mpai-sidebar-w); min-width: 0; display: flex; flex-direction: column; transition: margin-left .2s ease; }
.topbar { position: sticky; top: 0; z-index: 1020; height: var(--mpai-topbar-h); background: var(--mpai-surface); border-bottom: 1px solid var(--mpai-border); display: grid; grid-template-columns: minmax(0, 1fr) minmax(180px, 34%) minmax(max-content, 1fr); align-items: center; gap: 14px; padding: 0 24px; }
/* Three groups: breadcrumbs on the left, the search box in the centre of the bar, notifications / language / account on the right. */
.topbar-left { display: flex; align-items: center; gap: 8px; min-width: 0; }
.topbar-right { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
.topbar .crumbs { font-size: .9rem; color: var(--mpai-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.topbar .crumbs a { color: var(--mpai-muted); text-decoration: none; }
.topbar .crumbs a:hover { color: var(--mpai-navy); text-decoration: underline; }
.topbar .crumbs .current { color: var(--mpai-navy); font-weight: 600; }
.topbar-search { position: relative; width: 100%; }
.topbar-search input { padding-left: 34px; background: #f1f4f8; border-color: transparent; }
.topbar-search input:focus { background: #fff; }
.topbar-search .bi { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--mpai-muted); pointer-events: none; }
.icon-btn { position: relative; width: 38px; height: 38px; border-radius: 50%; display: inline-grid; place-items: center; border: 0; background: transparent; color: #3b4756; font-size: 1.15rem; }
.icon-btn:hover { background: #eef2f6; color: var(--mpai-navy); }
.badge-dot { position: absolute; top: 3px; right: 2px; min-width: 18px; height: 18px; border-radius: 999px; background: #e5484d; color: #fff; font-size: .68rem; font-weight: 700; display: grid; place-items: center; padding: 0 4px; }
.badge-dot:empty, .badge-dot[hidden] { display: none; }
/* EN / 日本語 switch (partials/lang_switch.php) */
.lang-switch { display: inline-flex; margin: 0 6px; border: 1px solid var(--mpai-border-strong); border-radius: 8px; overflow: hidden; background: #fff; }
.lang-switch button { border: 0; background: transparent; padding: 4px 11px; font-size: .82rem; font-weight: 600; line-height: 1.5; color: var(--mpai-muted); cursor: pointer; }
.lang-switch button + button { border-left: 1px solid var(--mpai-border); }
.lang-switch button:hover { background: #eef2f6; color: var(--mpai-navy); }
.lang-switch button.active { background: #dde8f5; color: var(--mpai-navy); cursor: default; }
.lang-switch button:focus-visible { outline: 2px solid var(--mpai-blue); outline-offset: -2px; }
.user-menu-btn { display: flex; align-items: center; gap: 8px; border: 0; background: transparent; padding: 4px 8px; border-radius: 999px; color: var(--mpai-text); font-weight: 550; }
.user-menu-btn:hover { background: #eef2f6; }
.main { padding: 24px; max-width: 1480px; width: 100%; }
.notif-menu { width: min(380px, 94vw); padding: 0; }
.notif-menu .notif-item { display: block; padding: 10px 16px; border-bottom: 1px solid var(--mpai-border); text-decoration: none; color: inherit; }
.notif-menu .notif-item:hover { background: #f5f8fb; }
.notif-menu .notif-item.unread { background: #f0f6fd; }
.notif-menu .notif-item strong { display: block; font-size: .9rem; color: var(--mpai-navy); }
.notif-menu .notif-item span { font-size: .82rem; color: var(--mpai-muted); }

@media (max-width: 991.98px) {
	.sidebar { transform: translateX(-100%); box-shadow: none; }
	body.sidebar-open .sidebar { transform: none; box-shadow: 8px 0 30px rgba(0, 0, 0, .25); }
	body.sidebar-open .sidebar-backdrop { display: block; }
	.app-main { margin-left: 0; }
	.topbar { padding: 0 14px; gap: 8px; grid-template-columns: minmax(0, auto) minmax(100px, 1fr) auto; }
	.main { padding: 16px 14px 28px; }
}
@media (max-width: 575.98px) {
	/* Phones: the search box gets a row of its own so it stays usable next to the language switch. */
	.topbar { height: auto; padding: 8px 14px; row-gap: 8px; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "left right" "search search"; }
	.topbar-left { grid-area: left; }
	.topbar-right { grid-area: right; }
	.topbar-search { grid-area: search; }
	.topbar-spacer { display: none; }
	.topbar .crumbs { display: none; }
	.topbar .user-name { display: none; }
	.lang-switch button { padding: 4px 7px; font-size: .78rem; }
}

/* ------------------------------------------------------------- page chrome */
.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-header h1 { font-size: 1.55rem; margin: 0 0 2px; }
.page-header .lead { margin: 0; color: var(--mpai-muted); font-size: .95rem; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.card { border: 1px solid var(--mpai-border); border-radius: var(--mpai-radius); box-shadow: var(--mpai-shadow); background: var(--mpai-surface); }
.card-header { background: transparent; border-bottom: 1px solid var(--mpai-border); font-weight: 650; color: var(--mpai-navy); padding: 12px 18px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.card-header .subtle { font-weight: 500; font-size: .85rem; color: var(--mpai-muted); }
.card-body { padding: 18px; }
.card-footer { background: transparent; border-top: 1px solid var(--mpai-border); }

.stat-card { padding: 16px 18px; height: 100%; }
.stat-card .stat-label { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--mpai-muted); font-weight: 650; display: flex; align-items: center; gap: 6px; }
.stat-card .stat-value { font-size: 1.85rem; font-weight: 700; color: var(--mpai-navy); line-height: 1.15; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat-card .stat-sub { font-size: .82rem; color: var(--mpai-muted); margin-top: 2px; }
a.stat-card { text-decoration: none; display: block; color: inherit; transition: border-color .15s, box-shadow .15s; }
a.stat-card:hover { border-color: var(--mpai-blue); box-shadow: 0 2px 8px rgba(24, 48, 82, .1); }
.stat-card.is-alert .stat-value { color: #b42318; }

.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-bottom: 16px; }
.filters .form-control, .filters .form-select { min-width: 150px; }
.filters .grow { flex: 1; min-width: 200px; }
.filters label { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--mpai-muted); font-weight: 650; margin-bottom: 2px; display: block; }

/* Tables */
.table { --bs-table-bg: transparent; margin-bottom: 0; }
.table > :not(caption) > * > * { padding: .7rem .9rem; vertical-align: middle; }
.table thead th { font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--mpai-muted); font-weight: 700; border-bottom: 1px solid var(--mpai-border-strong); background: #fafbfd; white-space: nowrap; }
.table tbody tr:hover { background: #f8fafc; }
.table-card { padding: 0; overflow: hidden; }
.table-responsive { -webkit-overflow-scrolling: touch; }
.table a.row-link { color: var(--mpai-navy); font-weight: 600; text-decoration: none; }
.table a.row-link:hover { text-decoration: underline; color: var(--mpai-blue); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.row-actions { white-space: nowrap; text-align: right; }

/* Badges, avatars, progress */
.badge-soft { font-weight: 600; font-size: .75rem; padding: .32em .65em; border-radius: 999px; border: 1px solid transparent; letter-spacing: .01em; }
.badge-soft-primary { background: #e4eefa; color: #1b4a7a; border-color: #cfe0f4; }
.badge-soft-secondary { background: #eef1f5; color: #4b5767; border-color: #dde3ea; }
.badge-soft-success { background: #e2f5ea; color: #0f6a3a; border-color: #c6ebd5; }
.badge-soft-danger { background: #fde8e8; color: #a3281f; border-color: #f7cdcb; }
.badge-soft-warning { background: #fff2d9; color: #8a5a00; border-color: #fbe3b0; }
.badge-soft-info { background: #e1f4f9; color: #0b5d70; border-color: #c2e6ef; }
.badge-soft-dark { background: #e5e8ec; color: #2b3440; border-color: #d3d8de; }
.avatar { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--mpai-navy-2); color: #fff; font-weight: 650; font-size: .78rem; flex: none; }
.presence-wrap { position: relative; display: inline-flex; flex: none; }
.presence-dot { position: absolute; right: 1px; bottom: 1px; width: 16px; height: 16px; border-radius: 50%; border: 3px solid #fff; background: #98a2b3; }
.presence-dot.is-on { background: #12b76a; }
.week-row .form-check-inline { margin-right: 0; }
.week-time { width: 8.25rem; }
.week-time .form-control { padding-right: .5rem; }
.help-tip { border: 0; background: none; padding: 0 0 0 6px; margin: 0; color: var(--mpai-muted, #667085); line-height: 1; cursor: help; vertical-align: baseline; }
.help-tip:hover, .help-tip:focus-visible { color: var(--mpai-blue, #1d4f91); }
.help-tooltip { --bs-tooltip-opacity: 1; }
.help-tooltip .tooltip-inner { max-width: 340px; text-align: left; padding: 8px 10px; }
.avatar-sm { width: 26px; height: 26px; font-size: .68rem; }
.avatar-lg { width: 64px; height: 64px; font-size: 1.3rem; }
.avatar-xl { width: 112px; height: 112px; font-size: 2.2rem; }
img.avatar-img { object-fit: cover; background: #e6ebf1; display: inline-block; }
.person { display: inline-flex; align-items: center; gap: 8px; }
.progress-wrap { display: flex; align-items: center; gap: 10px; min-width: 120px; }
.progress-wrap .progress { flex: 1; height: 7px; background: #e6ebf1; }
.progress-wrap .progress-bar { background: var(--mpai-blue); }
.progress-text { font-size: .8rem; color: var(--mpai-muted); font-variant-numeric: tabular-nums; min-width: 34px; text-align: right; }
.progress.is-over .progress-bar, .progress-bar.bg-over { background: #d92d20; }

/* Empty / loading / notices */
.empty-state { text-align: center; padding: 44px 20px; color: var(--mpai-muted); }
.empty-state .bi { font-size: 2.2rem; color: #a6b3c4; display: block; margin-bottom: 8px; }
.empty-state h3 { font-size: 1.05rem; margin-bottom: 4px; }
.notice { border: 1px solid var(--mpai-border); border-left: 4px solid var(--mpai-blue); background: #fff; border-radius: 8px; padding: 12px 16px; }
.notice.warn { border-left-color: #e0a100; background: #fffaf0; }
.notice.danger { border-left-color: #d92d20; background: #fff6f5; }
.notice.ok { border-left-color: #12a150; background: #f4fbf7; }
.flash-stack .alert { box-shadow: var(--mpai-shadow); border-radius: 8px; margin-bottom: .5rem; }
.suggest-list { position: absolute; z-index: 20; left: 0; right: 0; margin: 2px 0 0; padding: 4px; list-style: none; background: #fff; border: 1px solid var(--bs-border-color, #dee2e6); border-radius: 8px; box-shadow: 0 6px 18px rgba(16, 32, 54, .12); max-height: 240px; overflow: auto; }
.suggest-list li { padding: 6px 10px; border-radius: 6px; cursor: pointer; }
.suggest-list li:hover, .suggest-list li.active { background: #e4eefa; }
.rte { border: 1px solid var(--bs-border-color, #dee2e6); border-radius: 8px; background: #fff; }
.rte:focus-within { border-color: #86b7fe; box-shadow: 0 0 0 .2rem rgba(13, 110, 253, .15); }
.rte-bar { display: flex; flex-wrap: wrap; gap: 2px; padding: 4px; border-bottom: 1px solid var(--bs-border-color, #dee2e6); background: #f6f8fb; border-radius: 8px 8px 0 0; }
.rte-btn { border: 0; background: transparent; width: 32px; height: 30px; border-radius: 6px; color: inherit; }
.rte-btn:hover, .rte-btn:focus-visible { background: rgba(0, 0, 0, .08); outline: none; }
.rte-body { min-height: 150px; max-height: 420px; overflow: auto; padding: 10px 12px; outline: none; }
.rich-text > :last-child { margin-bottom: 0; }
.rich-text h3 { font-size: 1.1rem; margin: .8rem 0 .4rem; }
.rich-text blockquote { border-left: 3px solid #cfd8e3; margin: .5rem 0; padding: .1rem .8rem; color: #5b6b7d; }
.rich-text pre, .rich-text code { background: #f1f4f8; border-radius: 4px; padding: .1rem .3rem; }
.rich-text a { overflow-wrap: anywhere; }
.attachment-list a { max-width: 55%; }
.skill-list .badge { white-space: normal; text-align: left; line-height: 1.35; padding-top: .4em; padding-bottom: .4em; } /* a long skill wraps instead of running out of the card */
.flash-stack .alert:last-child { margin-bottom: 1rem; } /* the gap lives on the messages, so an emptied stack leaves none */
.toast-stack { position: fixed; right: 16px; bottom: 16px; z-index: 1100; display: flex; flex-direction: column; gap: 8px; max-width: min(380px, 92vw); }
.toast-stack .toast { border: 0; box-shadow: 0 6px 24px rgba(24, 48, 82, .22); }
.is-loading { opacity: .55; pointer-events: none; }
.spinner-inline { width: 1rem; height: 1rem; border-width: .15em; }

/* Definition lists */
.kv { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 8px 16px; margin: 0; } /* minmax(0, ...) lets long values wrap instead of pushing out of the card */
.kv dt { color: var(--mpai-muted); font-weight: 600; font-size: .85rem; }
.kv dd { margin: 0; min-width: 0; overflow-wrap: break-word; }
.kv-stack { grid-template-columns: minmax(0, 1fr); gap: 2px 0; } /* label above value, for narrow cards (a person's profile card) */
.kv-stack dd { margin-bottom: 10px; }

/* Tabs */
.nav-tabs { border-bottom: 1px solid var(--mpai-border-strong); gap: 4px; flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; }
.nav-tabs .nav-link { border: 0; border-bottom: 3px solid transparent; color: var(--mpai-muted); font-weight: 600; padding: .65rem 1rem; white-space: nowrap; background: transparent; }
.nav-tabs .nav-link:hover { color: var(--mpai-navy); border-bottom-color: var(--mpai-border-strong); }
.nav-tabs .nav-link.active { color: var(--mpai-navy); border-bottom-color: var(--mpai-blue); background: transparent; }
.nav-pills .nav-link { color: #3b4756; font-weight: 600; }
.nav-pills .nav-link.active { background: var(--mpai-navy); }

/* Public pages --------------------------------------------------------- */
.public-header { background: #fff; border-bottom: 1px solid var(--mpai-border); position: sticky; top: 0; z-index: 10; }
.public-header .container { display: flex; align-items: center; gap: 24px; height: 64px; }
.public-header .brand { display: flex; align-items: center; text-decoration: none; }
.public-header .brand-logo { height: 34px; }
.public-header nav { display: flex; gap: 20px; margin-left: auto; align-items: center; }
.public-header nav a:not(.btn) { color: #3b4756; text-decoration: none; font-weight: 550; }
.public-header nav a:not(.btn):hover { color: var(--mpai-blue); }
.hero { background: linear-gradient(160deg, #183052 0%, #23588c 100%); color: #fff; padding: 84px 0 92px; }
.hero h1 { color: #fff; font-size: clamp(2rem, 4.6vw, 3.2rem); line-height: 1.12; font-weight: 750; max-width: 760px; }
.hero p { font-size: 1.15rem; max-width: 640px; color: #d6e4f4; margin: 18px 0 30px; }
.hero .btn-light { color: var(--mpai-navy); font-weight: 650; }
.feature-card { height: 100%; padding: 22px; }
.feature-card .feature-icon { width: 44px; height: 44px; border-radius: 11px; background: #e4eefa; color: var(--mpai-blue); display: grid; place-items: center; font-size: 1.25rem; margin-bottom: 14px; }
.feature-card h3 { font-size: 1.05rem; }
.feature-card p { color: var(--mpai-muted); margin: 0; font-size: .93rem; }
.how-step { text-align: center; padding: 12px; }
.how-step .step-no { width: 40px; height: 40px; border-radius: 50%; background: var(--mpai-navy); color: #fff; display: inline-grid; place-items: center; font-weight: 700; margin-bottom: 10px; }
.public-footer { background: #fff; border-top: 1px solid var(--mpai-border); padding: 24px 0; color: var(--mpai-muted); font-size: .9rem; }
.auth-wrap { min-height: 100vh; display: flex; flex-direction: column; background: var(--mpai-bg); }
.auth-card { width: min(440px, 100%); margin: 6vh auto; padding: 32px; }
.auth-card .brand { display: flex; justify-content: center; align-items: center; margin: 4px 0 24px; }
.auth-card .brand-logo { height: 40px; }

/* ------------------------------------------------------------- Time Log */
.attendance-card { background: linear-gradient(135deg, #183052, #23588c); color: #fff; border: 0; }
.attendance-card h2, .attendance-card .text-white-50 { color: inherit; }
.attendance-card .state-label { text-transform: uppercase; letter-spacing: .08em; font-size: .75rem; opacity: .8; font-weight: 700; }
.attendance-card .state-value { font-size: 1.5rem; font-weight: 700; }
.attendance-card .elapsed { font-size: 2.1rem; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.attendance-card .btn-start { background: #fff; color: var(--mpai-navy); font-weight: 700; padding: .85rem 2rem; font-size: 1.1rem; border-radius: 10px; }
.attendance-card .btn-start:hover { background: #e9f1fb; }
.attendance-card .btn-end { background: rgba(255, 255, 255, .14); color: #fff; border: 1px solid rgba(255, 255, 255, .5); font-weight: 650; }
.attendance-card .btn-end:hover { background: rgba(255, 255, 255, .26); color: #fff; }
.metric-row { display: flex; gap: 12px; flex-wrap: wrap; }
.metric { flex: 1; min-width: 140px; border: 1px solid var(--mpai-border); border-radius: 10px; padding: 12px 14px; background: #fff; }
.metric .metric-label { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--mpai-muted); font-weight: 650; }
.metric .metric-value { font-size: 1.45rem; font-weight: 700; color: var(--mpai-navy); font-variant-numeric: tabular-nums; }
.metric .metric-note { font-size: .78rem; color: var(--mpai-muted); }
.entry-row { display: flex; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--mpai-border); align-items: flex-start; }
.entry-row:last-child { border-bottom: 0; }
.entry-row .entry-dur { font-weight: 700; color: var(--mpai-navy); min-width: 64px; font-variant-numeric: tabular-nums; }
.entry-row .entry-main { flex: 1; min-width: 0; }
.entry-row .entry-desc { color: #3b4756; font-size: .92rem; overflow-wrap: anywhere; }

/* Timesheet grid */
.day-block { border: 1px solid var(--mpai-border); border-radius: 10px; background: #fff; margin-bottom: 12px; overflow: hidden; }
.day-block.is-weekend { background: #fafbfc; }
.day-head { display: flex; justify-content: space-between; align-items: center; padding: 9px 16px; background: #f4f7fb; font-weight: 650; color: var(--mpai-navy); gap: 12px; flex-wrap: wrap; }
.day-head .day-total { font-variant-numeric: tabular-nums; }
.day-head .flag { font-size: .75rem; margin-left: 6px; }
.period-pill { border: 1px solid var(--mpai-border); border-radius: 10px; padding: 12px 14px; background: #fff; display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.month-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.month-grid .dow { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--mpai-muted); font-weight: 700; text-align: center; padding: 4px 0; }
.month-cell { min-height: 78px; border: 1px solid var(--mpai-border); border-radius: 8px; padding: 6px 8px; background: #fff; text-decoration: none; color: inherit; display: block; font-size: .8rem; }
.month-cell:hover { border-color: var(--mpai-blue); }
.month-cell.is-off { background: #f6f8fa; color: #98a3b1; }
.month-cell.is-outside { visibility: hidden; }
.month-cell .mc-day { font-weight: 700; color: var(--mpai-navy); }
.month-cell .mc-total { display: block; margin-top: 6px; font-weight: 700; font-variant-numeric: tabular-nums; }
.month-cell.is-missing { border-color: #f1c36d; background: #fffaf0; }

/* ----------------------------------------------------------------- Board */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: 14px; overflow-x: auto; padding-bottom: 10px; align-items: start; }
.board-col { background: #eaeff5; border-radius: 12px; padding: 10px; min-height: 140px; }
.board-col-head { display: flex; justify-content: space-between; align-items: center; padding: 4px 6px 10px; font-weight: 700; color: var(--mpai-navy); font-size: .88rem; }
.board-col-head .count { background: #fff; border-radius: 999px; padding: 0 9px; font-size: .75rem; color: var(--mpai-muted); }
.board-col.drop-ok { outline: 2px dashed var(--mpai-blue); outline-offset: -3px; background: #e0ebf7; }
.board-col.drop-no { outline: 2px dashed #d92d20; outline-offset: -3px; opacity: .65; }
.kanban-card { background: #fff; border: 1px solid var(--mpai-border); border-radius: 9px; padding: 10px 12px; margin-bottom: 8px; box-shadow: var(--mpai-shadow); cursor: grab; }
.kanban-card:active { cursor: grabbing; }
.kanban-card.dragging { opacity: .45; }
.kanban-card .kc-key { font-size: .75rem; color: var(--mpai-muted); font-weight: 650; }
.kanban-card .kc-title { display: block; font-weight: 600; color: var(--mpai-navy); text-decoration: none; margin: 2px 0 8px; overflow-wrap: anywhere; }
.kanban-card .kc-title:hover { text-decoration: underline; }
.kanban-card .kc-meta { display: flex; align-items: center; justify-content: space-between; gap: 6px; flex-wrap: wrap; font-size: .78rem; }
.kanban-card.is-overdue { border-left: 4px solid #d92d20; }
.kanban-card.is-blocked { border-left: 4px solid #e0a100; }
.kanban-card .kc-flags { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 6px; }

/* Gantt-style timeline */
.timeline { position: relative; overflow-x: auto; }
.timeline-grid { min-width: 760px; }
.tl-head, .tl-row { display: grid; grid-template-columns: 240px 1fr; align-items: center; }
.tl-head { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--mpai-muted); font-weight: 700; border-bottom: 1px solid var(--mpai-border-strong); padding: 6px 0; }
.tl-row { border-bottom: 1px solid var(--mpai-border); min-height: 38px; }
.tl-label { padding: 6px 12px 6px 4px; font-size: .88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-track { position: relative; height: 38px; background-image: linear-gradient(to right, var(--mpai-border) 1px, transparent 1px); background-size: calc(100% / var(--tl-cols, 8)) 100%; }
.tl-bar { position: absolute; top: 9px; height: 20px; border-radius: 6px; background: var(--mpai-blue); color: #fff; font-size: .72rem; padding: 0 8px; line-height: 20px; overflow: hidden; white-space: nowrap; min-width: 8px; }
.tl-bar.done { background: #12a150; }
.tl-bar.blocked { background: #d92d20; }
.tl-bar.todo { background: #7b8ba1; }
.tl-diamond { position: absolute; top: 11px; width: 16px; height: 16px; background: #e0a100; transform: rotate(45deg) translateX(-8px); border-radius: 2px; }
.tl-today { position: absolute; top: 0; bottom: 0; width: 2px; background: #d92d20; opacity: .7; z-index: 2; }

/* Resource heat grid */
.heat { display: inline-block; min-width: 56px; padding: 3px 8px; border-radius: 6px; text-align: center; font-weight: 650; font-size: .82rem; font-variant-numeric: tabular-nums; }
.heat-0 { background: #f1f4f8; color: #7b8794; }
.heat-1 { background: #e1f4f9; color: #0b5d70; }
.heat-2 { background: #e2f5ea; color: #0f6a3a; }
.heat-3 { background: #fff2d9; color: #8a5a00; }
.heat-4 { background: #fde8e8; color: #a3281f; }

/* Activity feed */
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--mpai-border); }
.feed li:last-child { border-bottom: 0; }
.feed .feed-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--mpai-blue); margin-top: 7px; flex: none; }
.feed .feed-body { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.feed .feed-time { font-size: .78rem; color: var(--mpai-muted); white-space: nowrap; }
.mention { background: #e4eefa; color: #1b4a7a; padding: 0 4px; border-radius: 4px; font-weight: 600; }
.comment { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--mpai-border); }
.comment:last-child { border-bottom: 0; }
.comment-body { flex: 1; min-width: 0; overflow-wrap: anywhere; }

.chart-box { position: relative; height: 260px; }
.chart-box.sm { height: 200px; }
.role-matrix th, .role-matrix td { text-align: center; }
.role-matrix th:first-child, .role-matrix td:first-child { text-align: left; }
.role-matrix .group-row td { background: #f4f7fb; font-weight: 700; color: var(--mpai-navy); text-align: left; }
.code { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: .85em; background: #eef1f5; padding: 1px 6px; border-radius: 4px; }
.sticky-actions { position: sticky; bottom: 0; background: linear-gradient(to top, var(--mpai-bg) 70%, transparent); padding: 14px 0 4px; }
.nowrap { white-space: nowrap; }

@media (max-width: 767.98px) {
	.kv { grid-template-columns: 1fr; gap: 2px 0; }
	.kv dd { margin-bottom: 8px; }
	.page-header h1 { font-size: 1.3rem; }
	.attendance-card .btn-start { width: 100%; }
	.entry-row { flex-wrap: wrap; }
	.month-cell { min-height: 56px; padding: 4px; }
	.card-body { padding: 14px; }
	.stat-card .stat-value { font-size: 1.5rem; }
	.tl-head, .tl-row { grid-template-columns: 150px 1fr; }
	/* Dense tables scroll horizontally instead of becoming unreadable */
	.table-responsive-sm-scroll { overflow-x: auto; }
}

@media print {
	.sidebar, .topbar, .page-actions, .filters, .toast-stack { display: none !important; }
	.app-main { margin: 0; }
	.card { box-shadow: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
