@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');
@import url('https://fonts.googleapis.com/icon?family=Material+Icons+Round');

:root {
  --primary: #1a73e8; --primary-dark: #1557b0; --primary-light: #e8f0fe;
  --sidebar: #1e293b; --sidebar-hover: #334155; --sidebar-active: #1a73e8;
  --bg: #f1f5f9; --card: #ffffff; --border: #e2e8f0;
  --text: #1e293b; --text-muted: #64748b; --text-light: #94a3b8;
  --success: #10b981; --warning: #f59e0b; --danger: #ef4444; --info: #3b82f6;
  --success-bg: #ecfdf5; --warning-bg: #fffbeb; --danger-bg: #fef2f2; --info-bg: #eff6ff;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
  --radius: 12px; --radius-sm: 8px;
  --sidebar-w: 240px; --header-h: 60px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Inter', sans-serif; background: var(--bg); color: var(--text); display: flex; height: 100vh; overflow: hidden; }

/* ── SIDEBAR ── */
#sidebar {
  width: var(--sidebar-w); background: var(--sidebar); display: flex; flex-direction: column;
  flex-shrink: 0; transition: width .25s; overflow: hidden; z-index: 100;
}
.sidebar-logo { padding: 20px 16px; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid #334155; }
.sidebar-logo img { width: 32px; height: 32px; border-radius: 8px; }
.sidebar-logo-text { color: #fff; font-weight: 700; font-size: 15px; line-height: 1.2; }
.sidebar-logo-text span { color: var(--primary); }
.sidebar-user { padding: 14px 16px; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid #334155; }
.sidebar-avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--primary); display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 600; font-size: 14px; flex-shrink: 0; }
.sidebar-user-info .name { color: #fff; font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 160px; }
.sidebar-user-info .role { color: var(--text-light); font-size: 11px; white-space: nowrap; }
nav { flex: 1; padding: 12px 8px; overflow-y: auto; }
.nav-section { margin-bottom: 4px; }
.nav-label { color: #475569; font-size: 10px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; padding: 8px 8px 4px; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: var(--radius-sm); cursor: pointer; color: #94a3b8; font-size: 13px; font-weight: 500; transition: all .15s; position: relative; user-select: none; }
.nav-item:hover { background: var(--sidebar-hover); color: #e2e8f0; }
.nav-item.active { background: var(--primary); color: #fff; }
.nav-item .material-icons-round { font-size: 18px; }
.nav-badge { margin-left: auto; background: var(--danger); color: #fff; font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 99px; min-width: 18px; text-align: center; }

/* ── NEXT.JS WRAPPERS (body > #__next > #app-shell > sidebar/main) ── */
#__next   { display: flex; flex: 1; height: 100vh; overflow: hidden; }
#app-shell { display: flex; flex: 1; overflow: hidden; }

/* ── MAIN ── */
#main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
header { height: var(--header-h); background: var(--card); border-bottom: 1px solid var(--border); display: flex; align-items: center; padding: 0 24px; gap: 16px; flex-shrink: 0; box-shadow: var(--shadow); }
.header-title { font-size: 16px; font-weight: 600; flex: 1; }
.header-search { display: flex; align-items: center; gap: 8px; background: var(--bg); border: 1px solid var(--border); border-radius: 99px; padding: 6px 14px; width: 260px; }
.header-search input { border: none; background: transparent; outline: none; font-size: 13px; width: 100%; color: var(--text); }
.header-search .material-icons-round { font-size: 16px; color: var(--text-muted); }
.header-actions { display: flex; align-items: center; gap: 8px; }
.icon-btn { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; border: none; background: transparent; color: var(--text-muted); transition: background .15s; position: relative; }
.icon-btn:hover { background: var(--bg); color: var(--text); }
.icon-btn .material-icons-round { font-size: 20px; }
.notif-dot { position: absolute; top: 6px; right: 6px; width: 8px; height: 8px; background: var(--danger); border-radius: 50%; border: 2px solid #fff; }
#content { flex: 1; overflow-y: auto; padding: 24px; }

/* ── VIEWS ── */
.view { display: none; animation: fadeIn .2s; }
.view.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.view-title { font-size: 20px; font-weight: 700; margin-bottom: 20px; display: flex; align-items: center; gap: 10px; }
.view-title .material-icons-round { color: var(--primary); font-size: 24px; }

/* ── CARDS ── */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.card-title { font-size: 13px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 12px; display: flex; align-items: center; justify-content: space-between; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* ── STAT CARDS ── */
.stat-card { display: flex; align-items: center; gap: 14px; }
.stat-icon { width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center; }
.stat-icon .material-icons-round { font-size: 22px; color: #fff; }
.stat-icon.blue   { background: var(--primary); }
.stat-icon.green  { background: var(--success); }
.stat-icon.orange { background: var(--warning); }
.stat-icon.red    { background: var(--danger); }
.stat-icon.purple { background: #8b5cf6; }
.stat-value { font-size: 26px; font-weight: 700; line-height: 1; }
.stat-label { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ── ALERTS ── */
.alert { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 8px; cursor: pointer; transition: opacity .15s; }
.alert:hover { opacity: .85; }
.alert.warning { background: var(--warning-bg); color: #92400e; border: 1px solid #fde68a; }
.alert.info    { background: var(--info-bg);    color: #1e40af; border: 1px solid #bfdbfe; }
.alert.success { background: var(--success-bg); color: #065f46; border: 1px solid #a7f3d0; }
.alert.danger  { background: var(--danger-bg);  color: #991b1b; border: 1px solid #fecaca; }

/* ── BADGES ── */
.badge { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 99px; font-size: 11px; font-weight: 600; }
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: #d97706; }
.badge-danger  { background: var(--danger-bg);  color: var(--danger); }
.badge-info    { background: var(--info-bg);     color: var(--info); }
.badge-gray    { background: #f1f5f9; color: var(--text-muted); }

/* ── EMPLOYEE CARDS ── */
.emp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px,1fr)); gap: 16px; }
.emp-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; text-align: center; transition: box-shadow .15s, transform .15s; cursor: pointer; }
.emp-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.emp-avatar { width: 64px; height: 64px; border-radius: 50%; margin: 0 auto 12px; background: var(--primary-light); display: flex; align-items: center; justify-content: center; font-size: 22px; font-weight: 700; color: var(--primary); overflow: hidden; }
.emp-avatar img { width: 100%; height: 100%; object-fit: cover; }
.emp-name { font-size: 14px; font-weight: 600; margin-bottom: 2px; }
.emp-title { font-size: 12px; color: var(--text-muted); margin-bottom: 8px; }
.emp-dept { font-size: 11px; }

/* ── TABLES ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; padding: 10px 14px; background: var(--bg); color: var(--text-muted); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #fafafa; }
.td-name { display: flex; align-items: center; gap: 10px; font-weight: 500; }
.td-avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--primary-light); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; color: var(--primary); flex-shrink: 0; }

/* ── FORMS ── */
.form-group { margin-bottom: 16px; }
label { display: block; font-size: 12px; font-weight: 600; color: var(--text-muted); margin-bottom: 6px; text-transform: uppercase; letter-spacing: .04em; }
input, select, textarea { width: 100%; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 9px 12px; font-size: 14px; font-family: inherit; color: var(--text); outline: none; transition: border .15s; background: var(--card); }
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
textarea { resize: vertical; min-height: 80px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ── BUTTONS ── */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 9px 18px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 600; cursor: pointer; border: none; transition: all .15s; font-family: inherit; }
.btn .material-icons-round { font-size: 16px; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--success); color: #fff; }
.btn-danger  { background: var(--danger);  color: #fff; }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover { background: var(--bg); }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ── KPI ── */
.kpi-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; border-left: 4px solid var(--primary); }
.kpi-card.pending { border-left-color: var(--warning); }
.kpi-card.completed { border-left-color: var(--success); }
.kpi-name { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.kpi-meta { font-size: 11px; color: var(--text-muted); display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.kpi-score-row { display: flex; align-items: center; gap: 16px; }
.kpi-score-box { text-align: center; }
.kpi-score-box .score { font-size: 24px; font-weight: 700; color: var(--primary); }
.kpi-score-box .slabel { font-size: 10px; color: var(--text-muted); }
.score-bar { flex: 1; height: 8px; background: var(--bg); border-radius: 99px; overflow: hidden; }
.score-bar-fill { height: 100%; border-radius: 99px; background: var(--primary); transition: width .5s; }
.score-bar-fill.green  { background: var(--success); }
.score-bar-fill.orange { background: var(--warning); }
.score-bar-fill.red    { background: var(--danger); }
.star-rating { display: flex; gap: 4px; }
.star-rating .star { font-size: 28px; cursor: pointer; color: #e2e8f0; transition: color .1s; }
.star-rating .star.on, .star-rating .star:hover ~ .star { color: #e2e8f0; }
.star-rating .star.on { color: var(--warning); }

/* ── VACATION ── */
.vacation-balance { display: grid; grid-template-columns: repeat(4,1fr); gap: 12px; }
.balance-box { text-align: center; padding: 16px; background: var(--bg); border-radius: var(--radius-sm); }
.balance-num { font-size: 28px; font-weight: 700; color: var(--primary); }
.balance-lbl { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.request-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.request-dates { font-weight: 600; font-size: 14px; }
.request-days { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ── BIRTHDAY ── */
.bday-list { display: flex; flex-direction: column; gap: 8px; }
.bday-item { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: var(--radius-sm); background: var(--bg); }
.bday-item.today { background: linear-gradient(135deg, #fef3c7, #fde68a); }
.bday-avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--primary-light); display: flex; align-items: center; justify-content: center; font-size: 16px; font-weight: 700; color: var(--primary); flex-shrink: 0; }
.bday-name { font-size: 13px; font-weight: 600; }
.bday-info { font-size: 11px; color: var(--text-muted); }
.bday-days { margin-left: auto; font-size: 12px; font-weight: 600; color: var(--primary); white-space: nowrap; }

/* ── ORG CHART ── */
.org-tree  { display: flex; flex-direction: column; align-items: center; padding: 24px 32px; overflow: auto; min-width: max-content; }
.org-node  { display: flex; flex-direction: column; align-items: center; }

.org-vline { width: 2px; height: 24px; background: var(--border); flex-shrink: 0; }
.org-children { display: flex; flex-direction: row; align-items: flex-start; }
.org-children > .org-node {
  position: relative; display: flex; flex-direction: column; align-items: center; padding: 24px 12px 0;
}
.org-children > .org-node::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px; background: var(--border);
}
.org-children > .org-node:first-child::before { left: 50%; }
.org-children > .org-node:last-child::before  { right: 50%; }
.org-children > .org-node:only-child::before  { display: none; }
.org-children > .org-node::after {
  content: ''; position: absolute; top: 0; left: 50%; transform: translateX(-50%); width: 2px; height: 24px; background: var(--border);
}

.org-card { background: var(--card); border: 2px solid var(--border); border-radius: 10px; padding: 12px 16px; text-align: center; width: 150px; cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.org-card:hover { border-color: var(--primary); box-shadow: 0 4px 12px rgba(26,115,232,.15); }
.org-card.leader { border-color: var(--primary); }
.org-card .oa { width: 42px; height: 42px; border-radius: 50%; background: var(--primary-light); margin: 0 auto 6px; display: flex; align-items: center; justify-content: center; font-size: 15px; font-weight: 700; color: var(--primary); }
.org-card .on { font-size: 12px; font-weight: 600; line-height: 1.3; }
.org-card .ot { font-size: 10px; color: var(--text-muted); margin-top: 2px; }
.org-badge { font-size: 10px; margin-top: 4px; }
.org-dept  { display: inline-block; font-size: 9px; color: var(--text-muted); background: var(--bg); padding: 1px 7px; border-radius: 10px; margin-top: 4px; }
.org-toggle-btn { display: block; margin: 6px auto 0; padding: 2px 10px; font-size: 10px; font-weight: 600; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); cursor: pointer; color: var(--text-muted); transition: background .15s, color .15s, border-color .15s; line-height: 1.6; }
.org-toggle-btn:hover { background: var(--primary-light); color: var(--primary); border-color: var(--primary); }

/* ── MODAL ── */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 16px; animation: fadeIn .15s; }
.modal { background: var(--card); border-radius: var(--radius); box-shadow: 0 20px 60px rgba(0,0,0,.2); width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto; }
.modal-header { padding: 20px 24px 0; display: flex; align-items: center; justify-content: space-between; }
.modal-header h3 { font-size: 17px; font-weight: 700; }
.modal-body { padding: 20px 24px; }
.modal-footer { padding: 0 24px 20px; display: flex; justify-content: flex-end; gap: 8px; }

/* ── LOADER ── */
.loader { display: flex; align-items: center; justify-content: center; padding: 40px; gap: 10px; color: var(--text-muted); font-size: 14px; }
.spinner { width: 24px; height: 24px; border: 3px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── TOAST ── */
#toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast { background: #1e293b; color: #fff; padding: 12px 18px; border-radius: var(--radius-sm); font-size: 13px; display: flex; align-items: center; gap: 8px; box-shadow: var(--shadow-md); animation: slideUp .2s; max-width: 320px; }
.toast.success { background: var(--success); }
.toast.error   { background: var(--danger); }
@keyframes slideUp { from { opacity:0; transform:translateY(10px); } to { opacity:1; transform:translateY(0); } }

/* ── TABS ── */
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--border); margin-bottom: 20px; }
.tab { padding: 10px 16px; font-size: 13px; font-weight: 500; cursor: pointer; color: var(--text-muted); border-bottom: 2px solid transparent; margin-bottom: -2px; transition: all .15s; }
.tab:hover { color: var(--primary); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

/* ── MISC ── */
.empty-state { text-align: center; padding: 40px 20px; color: var(--text-muted); }
.empty-state .material-icons-round { font-size: 48px; opacity: .3; margin-bottom: 8px; }
.empty-state p { font-size: 14px; }
.divider { height: 1px; background: var(--border); margin: 16px 0; }
.flex { display: flex; } .items-center { align-items: center; } .justify-between { justify-content: space-between; } .gap-8 { gap: 8px; } .gap-10 { gap: 10px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; }
.mt-4 { margin-top: 4px; } .mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mt-20 { margin-top: 20px; }
.mb-8 { margin-bottom: 8px; } .mb-12 { margin-bottom: 12px; } .mb-16 { margin-bottom: 16px; } .mb-20 { margin-bottom: 20px; }
.text-sm { font-size: 13px; } .text-xs { font-size: 11px; } .text-muted { color: var(--text-muted); } .font-600 { font-weight: 600; } .text-right { text-align: right; }
.w-full { width: 100%; }
.progress-wrap { background: var(--bg); border-radius: 99px; height: 6px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 99px; background: var(--primary); transition: width .5s; }

/* ── Semaphore KPI selector ── */
.sem-sel { display: flex; gap: 6px; margin: 8px 0; }
.sem-btn { flex: 1; padding: 10px 6px; border: 2px solid var(--border); border-radius: 8px; background: var(--bg); color: var(--text); cursor: pointer; font-size: 12px; font-weight: 600; text-align: center; transition: all .15s; font-family: inherit; line-height: 1.4; }
.sem-btn:hover { border-color: var(--primary); background: var(--card); }
.sem-btn.selected-red    { border-color: #ef4444; background: #fee2e2; color: #b91c1c; }
.sem-btn.selected-yellow { border-color: #f59e0b; background: #fef3c7; color: #92400e; }
.sem-btn.selected-green  { border-color: #22c55e; background: #dcfce7; color: #15803d; }
@media (prefers-color-scheme: dark) {
  .sem-btn.selected-red    { background: #450a0a; color: #fca5a5; }
  .sem-btn.selected-yellow { background: #451a03; color: #fde68a; }
  .sem-btn.selected-green  { background: #052e16; color: #86efac; }
}
:root[data-theme="dark"] .sem-btn.selected-red    { background: #450a0a; color: #fca5a5; }
:root[data-theme="dark"] .sem-btn.selected-yellow { background: #451a03; color: #fde68a; }
:root[data-theme="dark"] .sem-btn.selected-green  { background: #052e16; color: #86efac; }
/* ── KPI one-page review row ── */
.kpi-review-row { border: 1px solid var(--border); border-radius: 8px; padding: 14px 16px; margin-bottom: 10px; }
.kpi-row-name { font-weight: 700; font-size: 14px; margin-bottom: 3px; }
.kpi-row-meta { font-size: 11px; color: var(--text-muted); margin-bottom: 10px; display: flex; gap: 12px; flex-wrap: wrap; }


@media (max-width: 768px) {
  :root { --sidebar-w: 60px; }
  .sidebar-logo-text, .sidebar-user-info, .nav-item span:not(.material-icons-round):not(.nav-badge) { display: none; }
  .nav-item { justify-content: center; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .vacation-balance { grid-template-columns: repeat(2,1fr); }
  .form-row { grid-template-columns: 1fr; }
  .header-search { display: none; }
}
