:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --ink: #182033;
  --muted: #70788d;
  --border: #e7eaf0;
  --primary: #635bff;
  --primary-dark: #4d45df;
  --primary-soft: #efefff;
  --success: #16865c;
  --success-soft: #e7f7f0;
  --danger: #d83a52;
  --danger-soft: #fff0f2;
  --warning: #bd7418;
  --warning-soft: #fff6e8;
  --shadow: 0 10px 35px rgba(31, 38, 58, .07);
  --radius: 18px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; font-family: "Segoe UI", Tahoma, Arial, sans-serif; background: var(--bg); color: var(--ink); line-height: 1.5; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.week-calendar{display:grid;grid-template-columns:repeat(7,minmax(110px,1fr));gap:10px;overflow:auto}
.week-day{border:1px solid var(--border);background:var(--surface);border-radius:14px;padding:14px 10px;text-align:left;display:flex;flex-direction:column;gap:6px;cursor:pointer;color:inherit;min-height:112px}
.week-day:hover,.week-day.selected{border-color:var(--primary);box-shadow:0 6px 18px rgba(75,64,190,.14)}
.week-day strong{font-size:1.55rem}.week-day span,.week-day small{font-size:.75rem;color:var(--muted)}
.check-line{display:flex;align-items:center;gap:8px}.check-line input{width:auto}
@media (max-width:900px){.week-calendar{grid-template-columns:repeat(4,minmax(110px,1fr))}}
.muted { color: var(--muted); font-weight: 400; }
.eyebrow { margin: 0 0 5px; color: var(--primary); font-size: .72rem; font-weight: 800; letter-spacing: .04em; }
.error, .success { min-height: 1.15rem; margin: 0; font-size: .82rem; }
.error { color: var(--danger); }
.success { color: var(--success); }

/* تسجيل الدخول */
.screen.center { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-shell { width: min(920px, 100%); min-height: 570px; display: grid; grid-template-columns: 1.05fr .95fr; background: var(--surface); border: 1px solid var(--border); border-radius: 28px; overflow: hidden; box-shadow: var(--shadow); }
.login-intro { position: relative; padding: 56px; overflow: hidden; color: #fff; background: linear-gradient(145deg, #25205f, #635bff 72%, #837dff); }
.login-intro::after { content: ""; position: absolute; width: 300px; height: 300px; left: -100px; bottom: -140px; border: 70px solid rgba(255,255,255,.08); border-radius: 50%; }
.brand-mark { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 15px; background: #fff; color: var(--primary); font-weight: 900; font-size: 1.4rem; box-shadow: 0 8px 22px rgba(0,0,0,.12); }
.brand-mark.small { width: 34px; height: 34px; border-radius: 10px; font-size: 1rem; box-shadow: none; }
.login-intro h1 { margin: 58px 0 14px; font-size: clamp(2rem, 4vw, 3rem); line-height: 1.25; }
.login-intro > p { color: rgba(255,255,255,.72); max-width: 350px; }
.login-feature { display: flex; align-items: center; gap: 12px; margin-top: 22px; font-size: .9rem; }
.login-feature span { color: rgba(255,255,255,.55); font-size: .7rem; }
.login-card { display: flex; flex-direction: column; justify-content: center; padding: 58px; gap: 16px; }
.login-card h2 { margin: 0; font-size: 1.8rem; }
.login-copy { margin: -8px 0 10px; font-size: .88rem; }
.mobile-brand { display: none; align-items: center; gap: 9px; font-weight: 800; }

/* حقول وأزرار */
label { display: flex; flex-direction: column; gap: 7px; color: #4f586d; font-size: .78rem; font-weight: 700; }
input, textarea, select { width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 11px; background: #fff; color: var(--ink); outline: none; transition: border-color .15s, box-shadow .15s; }
input:focus, textarea:focus, select:focus { border-color: #aaa6ff; box-shadow: 0 0 0 4px var(--primary-soft); }
textarea { resize: vertical; }
.primary-button, .secondary-button, .sidebar-create, .text-button, .icon-button { border: 0; border-radius: 11px; font-weight: 750; }
.primary-button { min-height: 44px; padding: 10px 18px; background: var(--primary); color: #fff; box-shadow: 0 7px 18px rgba(99,91,255,.2); }
.primary-button:hover { background: var(--primary-dark); }
.primary-button.compact { width: auto; min-width: 140px; }
.secondary-button { min-height: 42px; padding: 9px 14px; background: var(--surface); color: var(--ink); border: 1px solid var(--border); }
.secondary-button:hover { background: var(--surface-soft); }
.text-button { padding: 8px; background: transparent; color: var(--primary); }
.icon-button { width: 36px; height: 36px; padding: 0; display: grid; place-items: center; background: transparent; color: var(--muted); font-size: 1.15rem; }
.icon-button:hover { background: #eef0f5; color: var(--ink); }
.optional { color: var(--muted); font-weight: 400; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* هيكل التطبيق */
.app-layout { min-height: 100vh; display: flex; }
.sidebar { position: sticky; top: 0; width: 236px; height: 100vh; flex: 0 0 236px; padding: 25px 17px 18px; display: flex; flex-direction: column; background: #211d48; color: #fff; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px; font-size: 1.05rem; font-weight: 850; }
.sidebar .brand-mark { background: var(--primary); color: #fff; }
.nav-label { margin: 36px 12px 10px; color: #8580ae; font-size: .67rem; font-weight: 800; }
.side-nav { display: flex; flex-direction: column; gap: 5px; }
.side-nav a { display: flex; align-items: center; gap: 11px; padding: 11px 13px; border-radius: 11px; color: #aaa6c6; text-decoration: none; font-size: .86rem; font-weight: 650; }
.side-nav a:hover, .side-nav a.active { color: #fff; background: rgba(255,255,255,.09); }
.side-nav a span { width: 20px; text-align: center; font-size: 1rem; }
.sidebar-spacer { flex: 1; }
.sidebar-create { display: flex; justify-content: center; align-items: center; gap: 7px; min-height: 43px; margin-bottom: 13px; background: var(--primary); color: #fff; }
.sidebar-create:hover { background: #766fff; }
.sidebar-user { display: grid; grid-template-columns: 38px 1fr 36px; align-items: center; gap: 9px; padding-top: 14px; border-top: 1px solid rgba(255,255,255,.09); }
.user-avatar { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 12px; background: #ffd8aa; color: #744918; font-weight: 800; }
.user-avatar.employee { background: #cbe9ff; color: #235d84; }
.sidebar-user strong, .sidebar-user span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user strong { font-size: .79rem; }
.sidebar-user span { color: #8e89ad; font-size: .67rem; }
.sidebar .icon-button { color: #8e89ad; }
.sidebar-tip { padding: 14px; margin-bottom: 15px; border: 1px solid rgba(255,255,255,.08); border-radius: 14px; background: rgba(255,255,255,.05); }
.sidebar-tip > span { display: block; margin-bottom: 7px; }
.sidebar-tip strong { font-size: .75rem; }
.sidebar-tip p { margin: 5px 0 0; color: #aaa6c6; font-size: .68rem; line-height: 1.65; }
.app-main { min-width: 0; flex: 1; }
.mobile-topbar { display: none; }
.dashboard-shell { width: min(1220px, calc(100% - 48px)); margin: 0 auto; padding: 38px 0 60px; }
.welcome-row { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; margin-bottom: 28px; }
.welcome-row h1 { margin: 0; font-size: clamp(1.55rem, 2.5vw, 2.2rem); letter-spacing: -.025em; }
.welcome-row > div > p:last-child { margin: 7px 0 0; color: var(--muted); font-size: .87rem; }
.welcome-actions { display: flex; align-items: center; justify-content: flex-end; gap: 9px; }
.quick-menu { position: relative; }
.quick-menu summary { min-height: 42px; padding: 9px 14px; display: flex; align-items: center; gap: 7px; border: 1px solid var(--border); border-radius: 11px; background: var(--surface); font-size: .78rem; font-weight: 750; cursor: pointer; list-style: none; }
.quick-menu summary::-webkit-details-marker { display: none; }
.quick-menu summary::after { content: "⌄"; color: var(--muted); }
.quick-menu[open] summary { border-color: #c9c5ff; box-shadow: 0 0 0 3px var(--primary-soft); }
.quick-menu-panel { position: absolute; z-index: 20; top: calc(100% + 8px); right: 0; width: 230px; padding: 8px; display: flex; flex-direction: column; gap: 6px; border: 1px solid var(--border); border-radius: 13px; background: var(--surface); box-shadow: var(--shadow); }
.quick-menu-panel .secondary-button { width: 100%; min-width: 0; text-align: left; box-shadow: none; }

/* الإحصائيات والأقسام */
.stats-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 13px; margin-bottom: 24px; }
.stat-box { position: relative; overflow: hidden; padding: 19px; background: var(--surface); border: 1px solid var(--border); border-radius: 15px; }
.stat-box::before { content: ""; position: absolute; right: 0; top: 0; width: 4px; height: 100%; background: #d8d5ff; }
.stat-box:nth-child(3)::before { background: #9fdec5; }
.stat-box:nth-child(4)::before { background: #ffb5bf; }
.stat-box .num { font-size: 1.65rem; font-weight: 850; letter-spacing: -.04em; }
.stat-box .label { margin-top: 2px; color: var(--muted); font-size: .75rem; }
.stat-box small { display: block; margin-top: 5px; color: var(--muted); font-size: .63rem; }
button.stat-box { width: 100%; color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
button.stat-box:hover { border-color: #c9c5ff; background: #fbfbff; }
.stat-box.alert-stat::before { background: #ffb5bf; }
.stat-box.message-stat::before { background: var(--primary); }
.content-section { margin-top: 18px; padding: 22px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 18px; }
.section-head h2 { margin: 0; font-size: 1.15rem; }
.employee-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 13px; }
.employee-card { padding: 16px; border: 1px solid var(--border); border-radius: 15px; background: #fff; transition: transform .16s, box-shadow .16s, border-color .16s; }
.employee-card:hover { transform: translateY(-2px); border-color: #d9d6ff; box-shadow: 0 10px 24px rgba(31,38,58,.07); }
.employee-card-head { display: flex; align-items: center; gap: 10px; }
.employee-avatar { width: 43px; height: 43px; flex: 0 0 43px; display: grid; place-items: center; border-radius: 13px; background: var(--primary-soft); color: var(--primary); font-weight: 850; }
.employee-identity { flex: 1; min-width: 0; }
.employee-identity .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .88rem; font-weight: 800; }
.employee-identity .meta { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: .69rem; }
.connection-dot { width: 8px; height: 8px; border-radius: 50%; }
.connection-dot.online { background: #25ac76; box-shadow: 0 0 0 4px var(--success-soft); }
.connection-dot.offline { background: #9ca3af; box-shadow: 0 0 0 4px #f0f1f4; }
.employee-stats { display: grid; grid-template-columns: repeat(4, 1fr); margin: 14px 0; background: var(--surface-soft); border-radius: 11px; }
.employee-stats div { display: flex; flex-direction: column; align-items: center; padding: 9px; }
.employee-stats div + div { border-right: 1px solid var(--border); }
.employee-stats strong { font-size: 1rem; }
.employee-stats span { color: var(--muted); font-size: .65rem; }
.employee-task-preview { min-height: 80px; display: flex; flex-direction: column; gap: 7px; }
.mini-task { display: grid; grid-template-columns: 7px minmax(0, 1fr) auto; align-items: center; gap: 7px; font-size: .72rem; }
.mini-task span:nth-child(2) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-task time { color: var(--muted); font-size: .64rem; }
.priority-dot { width: 7px; height: 7px; border-radius: 50%; background: #eba035; }
.priority-dot.high { background: #eb5266; }
.priority-dot.low { background: #2eb57e; }
.empty-mini { margin: 14px 0; color: var(--muted); text-align: center; font-size: .72rem; }
.employee-card-actions { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 11px; padding-top: 11px; border-top: 1px solid var(--border); }
.employee-card-actions button { width: auto; padding: 6px 0; border: 0; background: transparent; color: var(--primary); font-size: .7rem; font-weight: 750; }
.employee-card-actions .card-primary-action { padding: 7px 10px; border-radius: 8px; background: var(--primary-soft); }
.employee-card-actions .card-primary-action:hover { background: #e3e1ff; }
.linked-label { color: var(--success); font-size: .66rem; }
.attention-label { padding: 3px 7px; border-radius: 999px; background: var(--danger-soft); color: var(--danger); font-size: .66rem; font-weight: 800; }
.recurring-list { display: flex; flex-direction: column; }
.recurring-item { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto auto; align-items: center; gap: 11px; padding: 11px 4px; border-bottom: 1px solid var(--border); }
.recurring-item:last-child { border-bottom: 0; }
.recurring-icon { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; background: var(--primary-soft); color: var(--primary); font-weight: 900; }
.recurring-item strong, .recurring-item span { display: block; }
.recurring-item strong { font-size: .78rem; }
.recurring-item div > span { color: var(--muted); font-size: .65rem; }
.danger-text { color: var(--danger); }

/* جدول المهام */
.tasks-heading { align-items: flex-start; }
.filters { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; }
.filters select, .filters input { width: auto; min-height: 38px; padding: 7px 9px; font-size: .72rem; background: var(--surface-soft); }
.table-wrap { overflow-x: auto; }
.tasks-table { width: 100%; min-width: 720px; border-collapse: collapse; }
.tasks-table th, .tasks-table td { padding: 13px 10px; border-bottom: 1px solid var(--border); text-align: left; font-size: .78rem; }
.tasks-table th { color: var(--muted); font-size: .68rem; font-weight: 750; }
.tasks-table tbody tr:hover { background: #fafbfe; }
.tasks-table tbody tr:last-child td { border-bottom: 0; }
.tasks-table .ghost { width: auto; padding: 6px 9px; border: 0; border-radius: 8px; background: var(--danger-soft); color: var(--danger); font-size: .68rem; }
.tasks-table .ghost.detail-button { background: var(--primary-soft); color: var(--primary-dark); }
.task-title-button { display: block; padding: 0; border: 0; background: transparent; color: var(--ink); text-align: right; font-weight: 800; cursor: pointer; }
.task-title-button { text-align: left; }
.task-title-button:hover { color: var(--primary); }
.task-source, .table-time { margin-top: 2px; color: var(--muted); font-size: .62rem; }
.status-pill, .priority-badge { display: inline-flex; align-items: center; border-radius: 999px; padding: 3px 8px; font-size: .66rem; font-weight: 800; white-space: nowrap; }
.status-pill.pending, .priority-badge.medium { background: var(--warning-soft); color: var(--warning); }
.status-pill.completed, .priority-badge.low { background: var(--success-soft); color: var(--success); }
.status-pill.new { background: #f0f1f5; color: #656d7f; }
.status-pill.acknowledged { background: #eaf4ff; color: #2670a8; }
.status-pill.in_progress { background: var(--primary-soft); color: var(--primary-dark); }
.priority-badge.high { background: var(--danger-soft); color: var(--danger); }

/* واجهة الموظف */
.employee-shell { max-width: 960px; }
.banner { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 12px 15px; margin-bottom: 15px; border: 1px solid #f5d69b; border-radius: 12px; background: var(--warning-soft); color: #79531f; font-size: .78rem; }
.ai-briefing { display: block; padding: 15px; border-color: #dcd8fa; background: #f7f6ff; color: var(--text); }
.ai-briefing-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.ai-briefing-head strong { color: var(--primary-dark); }
.ai-briefing-head small { color: var(--muted); }
.ai-briefing > p { margin: 7px 0 0; color: var(--muted); line-height: 1.5; }
.ai-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 12px; }
.ai-action { min-width: 0; padding: 10px 11px; border: 1px solid var(--border); border-left: 3px solid #eba035; border-radius: 10px; background: #fff; color: var(--text); text-align: left; cursor: pointer; }
.ai-action.urgency-high { border-left-color: var(--danger); }
.ai-action:disabled { cursor: default; opacity: 1; }
.ai-action span { display: flex; justify-content: space-between; gap: 6px; font-size: .72rem; font-weight: 800; }
.ai-action span small { flex: none; padding: 2px 5px; border-radius: 999px; background: var(--warning-soft); color: #79531f; font-size: .58rem; }
.ai-action em { display: block; margin-top: 4px; color: var(--muted); font-size: .65rem; font-style: normal; line-height: 1.35; }
.attendance-table { min-width: 1040px; }
.attendance-table td:first-child strong, .attendance-table td:first-child small { display: block; }
.attendance-table td:first-child small { margin-top: 2px; color: var(--muted); font-size: .62rem; }
.attendance-state { display: inline-block; white-space: nowrap; font-size: .68rem; font-weight: 750; }
.attendance-state.present { color: var(--success); }
.attendance-state.absent { color: var(--danger); }
.attendance-total { font-weight: 850; color: var(--primary-dark); }
.employee-overview { display: grid; grid-template-columns: .75fr 1.25fr; gap: 14px; margin-bottom: 18px; }
.progress-card, .focus-card { padding: 20px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); }
.progress-copy { display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 3px; }
.progress-copy .eyebrow { grid-column: 1 / -1; }
.progress-copy strong { font-size: 2rem; letter-spacing: -.05em; }
.progress-copy span { color: var(--muted); font-size: .7rem; }
.progress-track { height: 8px; margin-top: 20px; overflow: hidden; border-radius: 999px; background: #eceef4; }
.progress-track span { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--primary), #8d87ff); transition: width .35s ease; }
.focus-card { position: relative; overflow: hidden; background: linear-gradient(135deg, #282354, #393273); color: #fff; border: 0; box-shadow: 0 13px 30px rgba(38,33,88,.17); }
.focus-card::after { content: ""; position: absolute; width: 160px; height: 160px; left: -45px; bottom: -95px; border: 35px solid rgba(255,255,255,.05); border-radius: 50%; }
.focus-top { position: relative; z-index: 1; display: flex; justify-content: space-between; align-items: center; }
.focus-label { color: #b9b5e1; font-size: .68rem; font-weight: 800; }
.focus-card h3 { position: relative; z-index: 1; margin: 13px 0 3px; font-size: 1.05rem; }
.focus-card > p { position: relative; z-index: 1; margin: 0; color: #b9b5e1; font-size: .73rem; }
.focus-meta { position: relative; z-index: 1; display: flex; gap: 14px; margin-top: 15px; color: #d8d5ee; font-size: .67rem; }
.focus-action { position: relative; z-index: 1; margin-top: 14px; padding: 0; border: 0; background: transparent; color: #fff; font-size: .69rem; font-weight: 800; }
.focus-empty { position: relative; z-index: 1; height: 100%; display: flex; align-items: center; gap: 13px; }
.focus-empty > span { width: 39px; height: 39px; display: grid; place-items: center; border-radius: 50%; background: rgba(255,255,255,.13); }
.focus-empty strong { display: block; font-size: .82rem; }
.focus-empty p { margin: 2px 0 0; color: #b9b5e1; font-size: .68rem; }
.small-select { width: auto; min-width: 110px; min-height: 38px; padding: 7px 10px; background: var(--surface-soft); font-size: .72rem; }
.todo-board { display: flex; flex-direction: column; gap: 19px; }
.todo-group { display: flex; flex-direction: column; gap: 8px; }
.todo-group-title { display: flex; justify-content: space-between; align-items: center; padding: 0 2px; color: var(--muted); font-size: .72rem; font-weight: 800; }
.todo-group-title span:last-child { min-width: 23px; height: 23px; display: grid; place-items: center; border-radius: 999px; background: #eef0f5; }
.todo-item { display: flex; align-items: flex-start; gap: 12px; padding: 14px; border: 1px solid var(--border); border-right: 4px solid #eba035; border-radius: 12px; background: #fff; transition: transform .15s, box-shadow .15s; }
.todo-item:hover { transform: translateY(-1px); box-shadow: 0 7px 20px rgba(31,38,58,.06); }
.todo-item.priority-high { border-right-color: #eb5266; }
.todo-item.priority-low { border-right-color: #2eb57e; }
.todo-item.is-completed { opacity: .62; border-right-color: #2eb57e; }
.todo-item.is-completed .todo-title { text-decoration: line-through; }
.todo-check { width: 25px; height: 25px; flex: 0 0 25px; padding: 0; border: 2px solid #cbd0dc; border-radius: 8px; background: #fff; color: #fff; font-size: .75rem; }
.todo-check:hover { border-color: var(--primary); background: var(--primary-soft); }
.todo-check:disabled { border-color: var(--success); background: var(--success); }
.todo-check.state-acknowledged { border-color: #4a9bd5; background: #eaf4ff; color: #2670a8; }
.todo-check.state-in_progress { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.todo-content { min-width: 0; flex: 1; }
.todo-title { font-size: .85rem; font-weight: 800; }
.task-desc { margin-top: 3px; color: var(--muted); font-size: .72rem; }
.todo-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 9px; color: var(--muted); font-size: .66rem; }
.workflow-label { font-weight: 750; color: #596175; }
.unread-chip { padding: 2px 6px; border-radius: 999px; background: var(--danger-soft); color: var(--danger); font-weight: 800; }
.task-more { width: 31px; height: 29px; flex: 0 0 31px; padding: 0; border: 0; border-radius: 8px; background: var(--surface-soft); color: var(--muted); letter-spacing: 1px; }
.task-more:hover { background: var(--primary-soft); color: var(--primary); }
.employee-list-actions { display: flex; align-items: center; gap: 8px; }
.mobile-self-task { display: none; }
.empty-state { padding: 45px 20px; text-align: center; color: var(--muted); }
.empty-state > div { font-size: 2rem; }
.empty-state strong { display: block; margin-top: 7px; color: var(--ink); }
.empty-state p { margin: 4px 0 0; font-size: .78rem; }

/* النوافذ والتنبيهات */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.modal-overlay { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 20px; background: rgba(18, 18, 35, .55); backdrop-filter: blur(4px); }
.modal-card { width: min(420px, 100%); max-height: calc(100vh - 40px); overflow-y: auto; padding: 24px; display: flex; flex-direction: column; gap: 14px; background: var(--surface); border-radius: 20px; box-shadow: 0 25px 70px rgba(13,16,30,.2); }
.task-composer { width: min(520px, 100%); }
.task-details-card { width: min(620px, 100%); }
.modal-title-row { display: flex; justify-content: space-between; align-items: flex-start; }
.modal-title-row h2, .modal-card > h2 { margin: 0; font-size: 1.25rem; }
.modal-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 4px; }
.modal-actions button { width: auto; min-width: 92px; }
#addEmployeeForm { padding: 24px; }
.link-code { display: block; padding: 12px; border-radius: 10px; background: var(--primary-soft); color: var(--primary-dark); text-align: center; font-size: 1.25rem; font-weight: 850; letter-spacing: 3px; }
.detail-meta { display: flex; flex-wrap: wrap; gap: 8px; color: var(--muted); font-size: .7rem; }
.detail-meta > span:not(.priority-badge) { padding: 3px 7px; border-radius: 999px; background: var(--surface-soft); }
.detail-description { margin: 0; padding: 13px; border-radius: 11px; background: var(--surface-soft); color: #555e72; font-size: .78rem; }
.workflow-actions { display: flex; flex-wrap: wrap; gap: 9px; }
.workflow-actions > .primary-button { width: auto; }
.detail-reminder { flex: 1 1 290px; display: flex; gap: 7px; }
.detail-reminder input { min-width: 170px; }
.detail-reminder button { white-space: nowrap; }
.conversation-head { display: flex; justify-content: space-between; align-items: center; margin-top: 5px; padding-top: 15px; border-top: 1px solid var(--border); }
.conversation-head strong, .conversation-head span { display: block; }
.conversation-head strong { font-size: .82rem; }
.conversation-head div > span { color: var(--muted); font-size: .64rem; }
.task-messages { max-height: 250px; min-height: 90px; overflow-y: auto; display: flex; flex-direction: column; gap: 9px; padding: 3px; }
.message { max-width: 82%; align-self: flex-start; padding: 9px 11px; border-radius: 12px 12px 4px 12px; background: #f0f2f6; }
.message.mine { align-self: flex-end; border-radius: 12px 12px 12px 4px; background: var(--primary-soft); }
.message > div { display: flex; justify-content: space-between; gap: 15px; }
.message strong { font-size: .65rem; }
.message time { color: var(--muted); font-size: .56rem; }
.message p { margin: 4px 0 0; font-size: .75rem; white-space: pre-wrap; }
.empty-conversation { padding: 25px 10px; color: var(--muted); text-align: center; font-size: .72rem; }
.message-composer { display: flex; gap: 8px; }
.message-composer button { width: auto; min-width: 75px; }
.section-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.manager-inbox { display: flex; flex-direction: column; gap: 8px; }
.inbox-item { width: 100%; display: grid; grid-template-columns: 42px minmax(0, 1fr) auto; align-items: center; gap: 11px; padding: 12px; border: 1px solid var(--border); border-radius: 13px; background: var(--surface); color: var(--ink); text-align: left; }
.inbox-item:hover { border-color: #c9c5ff; background: #fbfbff; }
.inbox-item.unread { border-left: 4px solid var(--primary); background: #faf9ff; }
.inbox-avatar { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 12px; background: var(--primary-soft); color: var(--primary); font-weight: 850; }
.inbox-copy { min-width: 0; }
.inbox-copy strong, .inbox-copy span { display: block; }
.inbox-copy strong { font-size: .8rem; }
.inbox-task { margin-top: 2px; color: var(--primary-dark); font-size: .66rem; font-weight: 750; }
.inbox-preview { margin-top: 4px; overflow: hidden; color: var(--muted); font-size: .72rem; text-overflow: ellipsis; white-space: nowrap; }
.inbox-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; color: var(--muted); font-size: .62rem; }
.inbox-unread { min-width: 21px; height: 21px; display: grid; place-items: center; border-radius: 999px; background: var(--primary); color: #fff; font-weight: 800; }
.wide-modal { width: min(760px, 100%); }
.team-management-list { display: flex; flex-direction: column; gap: 10px; }
.team-member-row { display: grid; grid-template-columns: minmax(150px, .9fr) minmax(180px, 1.1fr) auto; align-items: center; gap: 10px; padding: 12px; border: 1px solid var(--border); border-radius: 13px; }
.team-member-row.archived { background: var(--surface-soft); opacity: .82; }
.team-member-identity strong, .team-member-identity span { display: block; }
.team-member-identity strong { font-size: .8rem; }
.team-member-identity span { color: var(--muted); font-size: .65rem; }
.team-member-controls { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.team-member-controls button { width: auto; min-height: 34px; padding: 6px 9px; font-size: .67rem; }
.replacement-select { min-height: 36px; padding: 6px 8px; font-size: .68rem; }
.delete-warning { margin: 0; padding: 12px; border: 1px solid #ffc5cd; border-radius: 11px; background: var(--danger-soft); color: #92283a; font-size: .76rem; }
.danger-button { background: var(--danger); box-shadow: 0 7px 18px rgba(216,58,82,.18); }
.danger-button:hover { background: #b92c42; }
.toast { position: fixed; z-index: 90; left: 24px; bottom: 24px; max-width: min(380px, calc(100% - 48px)); padding: 12px 16px; border-radius: 11px; background: #262b38; color: #fff; font-size: .78rem; box-shadow: var(--shadow); opacity: 0; transform: translateY(15px); pointer-events: none; transition: opacity .2s, transform .2s; }
.toast.visible { opacity: 1; transform: translateY(0); }
.toast.success { background: #176747; }
.toast.error { background: #a82e40; }

@media (max-width: 1120px) { .stats-row { grid-template-columns: repeat(3, 1fr); } .employee-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

@media (max-width: 800px) {
  body { padding-bottom: 68px; }
  .app-layout { display: block; }
  .sidebar { position: fixed; z-index: 40; top: auto; right: 0; bottom: 0; width: 100%; height: 64px; padding: 7px 14px; display: block; background: #211d48; }
  .sidebar > .brand, .sidebar > .nav-label, .sidebar-spacer, .sidebar-create, .sidebar-user, .sidebar-tip { display: none; }
  .side-nav { height: 100%; flex-direction: row; justify-content: space-around; }
  .side-nav a { min-width: 0; padding: 6px 4px; flex: 1; flex-direction: column; justify-content: center; gap: 1px; font-size: .58rem; }
  .side-nav a span { font-size: 1rem; }
  .mobile-topbar { height: 58px; padding: 0 18px; display: flex; justify-content: space-between; align-items: center; background: var(--surface); border-bottom: 1px solid var(--border); }
  .mobile-topbar .brand { padding: 0; }
  .mobile-topbar .brand-mark { background: var(--primary); color: #fff; }
  .dashboard-shell { width: min(100% - 28px, 680px); padding: 25px 0 38px; }
  .welcome-row { align-items: flex-start; }
  .welcome-row .primary-button { min-width: 122px; padding-inline: 12px; }
  .welcome-actions { width: 100%; justify-content: flex-start; }
  .quick-menu { flex: 1; }
  .quick-menu summary { justify-content: center; }
  .quick-menu-panel { right: auto; left: 0; width: min(260px, calc(100vw - 44px)); }
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .employee-cards { grid-template-columns: 1fr; }
  .employee-overview { grid-template-columns: 1fr; }
  .ai-actions { grid-template-columns: 1fr; }
  .tasks-heading { align-items: stretch; flex-direction: column; }
  .filters { justify-content: stretch; }
  .filters select, .filters input { flex: 1 1 120px; width: 100%; }
  .content-section { padding: 17px; }
  .recurring-item { grid-template-columns: 34px minmax(0, 1fr) auto; }
  .recurring-item .priority-badge { display: none; }
  .mobile-self-task { display: inline-flex; width: auto; }
  .team-member-row { grid-template-columns: 1fr; }
  .team-member-controls { justify-content: flex-start; }
}

@media (max-width: 560px) {
  .screen.center { padding: 0; background: #fff; }
  .login-shell { min-height: 100vh; display: block; border: 0; border-radius: 0; box-shadow: none; }
  .login-intro { display: none; }
  .login-card { min-height: 100vh; padding: 34px 25px; }
  .mobile-brand { display: flex; margin-bottom: auto; }
  .login-card .error { margin-bottom: auto; }
  .form-row { grid-template-columns: 1fr; }
  .welcome-row h1 { font-size: 1.45rem; }
  .welcome-row { align-items: stretch; flex-direction: column; }
  .welcome-row .primary-button { width: 100%; }
  .welcome-actions .primary-button { width: auto; flex: 1; }
  .welcome-row > div > p:last-child { max-width: 280px; }
  .stats-row { gap: 9px; }
  .stat-box { padding: 15px; }
  .stat-box .num { font-size: 1.4rem; }
  .section-head { align-items: flex-start; }
  .todo-section .section-head { align-items: center; }
  .modal-overlay { align-items: end; padding: 0; }
  .modal-card { width: 100%; max-height: 92vh; border-radius: 22px 22px 0 0; padding: 22px; }
  .detail-reminder { flex-direction: column; }
  .detail-reminder button { width: 100%; }
  .inbox-item { grid-template-columns: 38px minmax(0, 1fr); }
  .inbox-meta { grid-column: 2; flex-direction: row; align-items: center; }
  .section-actions { width: 100%; }
  .section-actions button { flex: 1; }
  .toast { right: 16px; left: 16px; bottom: 82px; max-width: none; text-align: center; }
}
