:root {
  --navy: #0f2540;
  --navy-dark: #0a1a2e;
  --navy-light: #17335a;
  --accent: #c8933d;
  --accent-dark: #a9762b;
  --bg: #f4f6f9;
  --card-bg: #ffffff;
  --border: #e2e6ec;
  --text: #1c2733;
  --text-muted: #6b7684;
  --success: #1e8e5a;
  --warning: #b3781c;
  --danger: #c0362c;
  --info: #2864b0;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(15, 37, 64, 0.08), 0 1px 2px rgba(15, 37, 64, 0.06);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}
.hidden { display: none !important; }
a { color: var(--info); text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

/* Login */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--navy-dark), var(--navy));
  padding: 20px;
}
.login-card {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 40px 36px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.35);
}
.login-brand { text-align: center; margin-bottom: 28px; }
.brand-logo {
  width: 56px; height: 56px; border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 22px; margin: 0 auto 14px;
  letter-spacing: 0.5px;
}
.brand-logo.small { width: 38px; height: 38px; font-size: 15px; border-radius: 9px; margin: 0; }
.brand-logo.has-logo { background: none; box-shadow: none; }
.brand-logo.has-logo img { border-radius: 0 !important; }
#login-logo.has-logo { width: 88px; height: 88px; }
#sidebar-logo.has-logo { width: 46px; height: 46px; }
.login-brand h1 { margin: 0; font-size: 22px; letter-spacing: 1px; color: var(--navy); }
.tagline { color: var(--text-muted); font-size: 12.5px; margin-top: 4px; }
#login-form label { display: block; font-size: 12.5px; font-weight: 600; margin: 14px 0 6px; color: var(--text-muted); }
#login-form input[type=text], #login-form input[type=password] {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius); font-size: 14px;
}
#login-form input:focus { outline: none; border-color: var(--accent); }
.login-row { display: flex; justify-content: space-between; align-items: center; margin: 14px 0; font-size: 12.5px; }
.checkbox { display: flex; gap: 6px; align-items: center; color: var(--text-muted); font-weight: 400; }
.link-muted { color: var(--text-muted); }
.btn-primary {
  background: var(--navy); color: #fff; border: none; padding: 11px 18px; border-radius: var(--radius);
  font-weight: 600; font-size: 14px;
}
.btn-primary:hover { background: var(--navy-light); }
.btn-block { width: 100%; margin-top: 6px; }
.btn-secondary {
  background: #fff; color: var(--navy); border: 1px solid var(--border); padding: 9px 14px; border-radius: var(--radius); font-weight: 600;
}
.btn-secondary:hover { background: var(--bg); }
.btn-link { background: none; border: none; color: var(--text-muted); font-size: 13px; }
.error-msg { background: #fdecea; color: var(--danger); padding: 8px 12px; border-radius: 6px; font-size: 13px; margin-top: 12px; }
.demo-hint { margin-top: 22px; font-size: 11.5px; color: var(--text-muted); background: var(--bg); padding: 10px 12px; border-radius: 6px; line-height: 1.5; }

/* App Shell */
.app-shell { display: flex; height: 100vh; }
.sidebar {
  width: 240px; background: var(--navy-dark); color: #cfd9e6; display: flex; flex-direction: column; flex-shrink: 0;
}
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 18px 16px; border-bottom: 1px solid rgba(255,255,255,0.08); }
.brand-name { color: #fff; font-weight: 700; font-size: 14px; letter-spacing: 0.5px; }
.brand-sub { color: #8fa1b8; font-size: 11px; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 10px 0; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 18px; color: #b7c3d4; font-size: 13.5px;
  cursor: pointer; border-left: 3px solid transparent;
}
.nav-item:hover { background: rgba(255,255,255,0.05); color: #fff; }
.nav-item.active { background: rgba(200,147,61,0.12); border-left-color: var(--accent); color: #fff; font-weight: 600; }
.sidebar-footer { padding: 14px 18px; border-top: 1px solid rgba(255,255,255,0.08); }
.sidebar-footer .btn-link { color: #b7c3d4; }

.main-area { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: 60px; background: #fff; border-bottom: 1px solid var(--border); display: flex; align-items: center;
  justify-content: space-between; padding: 0 24px; flex-shrink: 0;
}
.topbar-title { font-size: 17px; font-weight: 700; color: var(--navy); }
.topbar-actions { display: flex; align-items: center; gap: 18px; }
.icon-btn { background: none; border: none; font-size: 18px; position: relative; }
.badge {
  position: absolute; top: -4px; right: -6px; background: var(--danger); color: #fff; border-radius: 20px;
  font-size: 10px; padding: 1px 5px; font-weight: 700;
}
.user-chip { display: flex; align-items: center; gap: 8px; }
.user-avatar {
  width: 32px; height: 32px; border-radius: 50%; background: var(--navy); color: #fff; display: flex;
  align-items: center; justify-content: center; font-weight: 700; font-size: 13px;
}
.user-name { font-weight: 600; font-size: 13px; }
.user-role { font-size: 11px; color: var(--text-muted); }
.notif-wrap { position: relative; }
.notif-panel {
  position: absolute; right: 0; top: 34px; width: 320px; max-height: 400px; overflow-y: auto; background: #fff;
  border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); z-index: 50;
}
.notif-item { padding: 10px 14px; border-bottom: 1px solid var(--border); font-size: 12.5px; }
.notif-item:last-child { border-bottom: none; }
.notif-item .n-type { font-weight: 700; color: var(--navy); }
.notif-item .n-time { color: var(--text-muted); font-size: 11px; margin-top: 2px; }
.notif-empty { padding: 20px; text-align: center; color: var(--text-muted); font-size: 12.5px; }

.content { flex: 1; overflow-y: auto; padding: 22px 26px; }

/* Cards / KPIs */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; margin-bottom: 24px; }
.kpi-card { background: var(--card-bg); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); border-top: 3px solid var(--accent); }
.kpi-value { font-size: 26px; font-weight: 700; color: var(--navy); }
.kpi-label { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

.section-title { font-size: 15px; font-weight: 700; color: var(--navy); margin: 26px 0 12px; }
.card { background: var(--card-bg); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }

.attention-list { display: flex; flex-direction: column; gap: 8px; }
.attention-item {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 6px; background: #fff;
  border-left: 4px solid var(--info); box-shadow: var(--shadow); cursor: pointer; font-size: 13px;
}
.attention-item.severity-danger { border-left-color: var(--danger); }
.attention-item.severity-warning { border-left-color: var(--warning); }
.attention-item .att-type { font-weight: 700; font-size: 11.5px; text-transform: uppercase; color: var(--text-muted); min-width: 130px; }

/* Tables */
table.data-table { width: 100%; border-collapse: collapse; background: #fff; border-radius: var(--radius); overflow: hidden; }
table.data-table th, table.data-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); font-size: 13px; }
table.data-table th { background: var(--bg); color: var(--text-muted); font-weight: 700; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.3px; }
table.data-table tr:hover td { background: #fafbfc; }
.table-wrap { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); overflow-x: auto; }

.badge-status { display: inline-block; padding: 3px 9px; border-radius: 20px; font-size: 11px; font-weight: 700; }
.st-notsubmitted, .st-todo { background: #f1f2f4; color: #565f6b; }
.st-draft, .st-waiting { background: #fdf1dc; color: var(--warning); }
.st-submitted, .st-inprogress { background: #e3ecfb; color: var(--info); }
.st-reviewed, .st-completed, .st-approved { background: #e2f4ea; color: var(--success); }
.st-overdue, .st-rejected, .st-cancelled { background: #fbe4e2; color: var(--danger); }
.st-pending, .st-pendingapproval, .st-partiallypaid { background: #fdf1dc; color: var(--warning); }
.st-paid { background: #e2f4ea; color: var(--success); }
.st-unpaid { background: #fbe4e2; color: var(--danger); }
.st-present { background: #e2f4ea; color: var(--success); }
.st-absent { background: #fbe4e2; color: var(--danger); }
.st-late, .st-halfday { background: #fdf1dc; color: var(--warning); }
.st-onleave { background: #e3ecfb; color: var(--info); }
.st-holiday, .st-weekend, .st-notmarked { background: #f1f2f4; color: #565f6b; }
.pr-low { color: var(--text-muted); }
.pr-medium { color: var(--info); }
.pr-high { color: var(--warning); }
.pr-urgent { color: var(--danger); font-weight: 700; }

.toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; flex-wrap: wrap; gap: 10px; }
.toolbar-left { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.filter-input, select.filter-input {
  padding: 8px 10px; border: 1px solid var(--border); border-radius: 6px; font-size: 13px; background: #fff;
}

/* Kanban */
.kanban-board { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.kanban-col { background: #eef1f5; border-radius: var(--radius); padding: 10px; min-height: 200px; }
.kanban-col-title { font-size: 12px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; margin-bottom: 10px; padding: 0 4px; display: flex; justify-content: space-between; }
.kanban-card {
  background: #fff; border-radius: 6px; padding: 10px 12px; margin-bottom: 8px; box-shadow: var(--shadow); cursor: grab;
  border-left: 3px solid var(--info);
}
.kanban-card.pr-urgent { border-left-color: var(--danger); }
.kanban-card.pr-high { border-left-color: var(--warning); }
.kanban-card-title { font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.kanban-card-meta { font-size: 11px; color: var(--text-muted); display: flex; justify-content: space-between; }
.kanban-col.dragover { background: #dde5f0; }

/* Modal */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(15,37,64,0.5); display: flex; align-items: center; justify-content: center;
  z-index: 100; padding: 20px;
}
.modal {
  background: #fff; border-radius: 10px; width: 100%; max-width: 560px; max-height: 90vh; overflow-y: auto;
  padding: 24px;
}
.modal h2 { margin-top: 0; font-size: 17px; color: var(--navy); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid.full, .form-field.full { grid-column: 1 / -1; }
.form-field label { display: block; font-size: 12px; font-weight: 600; color: var(--text-muted); margin-bottom: 5px; }
.form-field input, .form-field select, .form-field textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: 6px; font-size: 13px; font-family: inherit;
}
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

.empty-state { text-align: center; padding: 40px 20px; color: var(--text-muted); }

.progress-bar { background: var(--border); border-radius: 10px; height: 6px; overflow: hidden; width: 100%; }
.progress-bar-fill { background: var(--accent); height: 100%; }

.comment-list { display: flex; flex-direction: column; gap: 10px; margin: 14px 0; max-height: 220px; overflow-y: auto; }
.comment-item { background: var(--bg); border-radius: 6px; padding: 8px 10px; font-size: 12.5px; }
.comment-item .c-author { font-weight: 700; color: var(--navy); }
.comment-item .c-time { color: var(--text-muted); font-size: 10.5px; }

.settings-form { max-width: 560px; }

@media (max-width: 900px) {
  .kanban-board { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 60; height: 100%; transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: translateX(0); }
  .content { padding: 16px; }
}
