/* ===== TASKFLOW - ENTERPRISE TASK MANAGEMENT ===== */
@import url('https://fonts.googleapis.com/css2?family=Be+Vietnam+Pro:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;600&display=swap');

/* CSS variables in themes.css */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-hover); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: var(--mono); font-size: 12px; background: var(--bg-surface2); padding: 2px 6px; border-radius: 4px; color: var(--accent-hover); }

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ===== APP SHELL ===== */
.app-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ===== SIDEBAR ===== */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: transform 0.25s ease;
  z-index: 100;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-icon {
  font-size: 22px;
  background: var(--accent);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
}

.logo-text {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: var(--logo-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.sidebar-close { display: none; background: none; border: none; color: var(--text-secondary); cursor: pointer; font-size: 20px; }

.sidebar-nav {
  flex: 1;
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-weight: 500;
  transition: all 0.15s ease;
  text-decoration: none;
}

.nav-item:hover { background: var(--bg-hover); color: var(--text-primary); text-decoration: none; }
.nav-item.active { background: var(--accent-subtle); color: var(--accent-hover); }
.nav-item.active .nav-icon { filter: none; }
.nav-icon { font-size: 16px; width: 20px; text-align: center; }

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.user-avatar {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--purple) 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 15px;
  flex-shrink: 0;
  text-transform: uppercase;
}

.user-name { font-weight: 600; font-size: 13px; }
.user-role { font-size: 11px; color: var(--text-secondary); }

.btn-logout {
  width: 100%;
  padding: 8px;
  background: var(--red-subtle);
  border: 1px solid var(--red);
  color: var(--red-light);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.15s;
}
.btn-logout:hover { background: var(--red); color: #fff; }

/* ===== MAIN AREA ===== */
.main-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.topbar {
  height: var(--topbar-height);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  flex-shrink: 0;
}

.menu-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius);
  display: none;
}

.topbar-user {
  font-size: 13px;
  color: var(--text-secondary);
}

.page-content {
  flex: 1;
  overflow-y: auto;
  padding: 28px;
}

/* ===== PAGE HEADER ===== */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 28px;
  gap: 16px;
}

.page-title {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--text-primary);
}

.page-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* ===== BUTTONS ===== */
.btn-primary {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 9px 18px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font);
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); transform: translateY(-1px); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-secondary {
  background: var(--bg-surface2);
  color: var(--text-primary);
  border: 1px solid var(--border);
  padding: 9px 18px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font);
  transition: all 0.15s;
}
.btn-secondary:hover { background: var(--bg-hover); border-color: var(--text-muted); }

.btn-success {
  background: var(--green);
  color: #fff;
  border: none;
  padding: 9px 18px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font);
  transition: all 0.15s;
}
.btn-success:hover:not(:disabled) { background: var(--green-light); }
.btn-success:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-back {
  background: none;
  border: none;
  color: var(--accent-hover);
  cursor: pointer;
  font-size: 13px;
  font-family: var(--font);
  padding: 4px 0;
}
.btn-back:hover { color: var(--text-primary); }

.btn-icon {
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: var(--radius);
  font-size: 14px;
  transition: background 0.15s;
}
.btn-icon:hover { background: var(--bg-hover); }
.btn-icon-danger:hover { background: var(--red-subtle); }

/* ===== FORMS ===== */
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-size: 12px; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.5px; }
.required { color: var(--red-light); }

.form-input, .form-select {
  background: var(--bg-surface2);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 9px 12px;
  border-radius: var(--radius);
  font-size: 14px;
  font-family: var(--font);
  width: 100%;
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
}
.form-input:focus, .form-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-subtle);
}
.form-input::placeholder { color: var(--text-muted); }
textarea.form-input { resize: vertical; min-height: 80px; }
.form-select option { background: var(--bg-surface2); }

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.form-grid .full-width { grid-column: 1 / -1; }

/* ===== FILTER BAR ===== */
.filter-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.search-input { flex: 1; min-width: 200px; }
.filter-bar .form-select { width: auto; min-width: 150px; }

/* ===== STATS ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}
.stats-grid.mini { grid-template-columns: repeat(4, 1fr); }

.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: transform 0.15s, box-shadow 0.15s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.stat-icon { font-size: 24px; }
.stat-value { font-size: 28px; font-weight: 800; letter-spacing: -1px; }
.stat-label { font-size: 12px; color: var(--text-secondary); font-weight: 500; }

.stat-total { border-left: 3px solid var(--accent); }
.stat-progress { border-left: 3px solid var(--accent); }
.stat-review { border-left: 3px solid var(--yellow-light); }
.stat-done { border-left: 3px solid var(--green-light); }
.stat-overdue { border-left: 3px solid var(--red-light); }

/* ===== DASHBOARD ===== */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 24px;
}
.dashboard-section {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.section-header h2 { font-size: 15px; font-weight: 700; }
.link-more { font-size: 12px; color: var(--accent-hover); }

.task-list-mini { display: flex; flex-direction: column; gap: 8px; }

.task-mini-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: var(--bg-surface2);
  border-radius: var(--radius);
  border: 1px solid var(--border-light);
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s;
  gap: 12px;
}
.task-mini-item:hover { background: var(--bg-hover); border-color: var(--border); text-decoration: none; }
.task-mini-left { display: flex; align-items: flex-start; gap: 10px; min-width: 0; }
.task-mini-title { font-size: 13px; font-weight: 500; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 250px; }
.task-mini-meta { display: flex; gap: 10px; font-size: 11px; color: var(--text-secondary); margin-top: 2px; }
.task-mini-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.progress-mini { width: 60px; height: 4px; background: var(--bg-hover); border-radius: 2px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--accent); border-radius: 2px; }
.progress-text { font-size: 11px; color: var(--text-secondary); min-width: 28px; }

.priority-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; margin-top: 5px;
}
.priority-dot.priority-critical { background: var(--red-light); box-shadow: 0 0 6px var(--red-light); }
.priority-dot.priority-high { background: var(--orange-light); }
.priority-dot.priority-medium { background: var(--yellow-light); }
.priority-dot.priority-low { background: var(--green-light); }

/* ===== STATUS CHART ===== */
.status-chart { display: flex; flex-direction: column; gap: 12px; }
.chart-row { display: grid; grid-template-columns: 120px 1fr 32px; align-items: center; gap: 10px; }
.chart-label { font-size: 12px; color: var(--text-secondary); }
.chart-bar-wrap { height: 8px; background: var(--bg-hover); border-radius: 4px; overflow: hidden; }
.chart-bar { height: 100%; border-radius: 4px; transition: width 0.5s ease; }
.chart-value { font-size: 12px; font-weight: 600; text-align: right; }

/* ===== TASK CARDS ===== */
.tasks-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.task-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.task-card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: 0 4px 20px rgba(31,111,235,0.2); }
.task-card.overdue { border-left: 3px solid var(--red-light); }

.task-card-header { display: flex; justify-content: space-between; align-items: center; }
.task-card-title { font-size: 14px; font-weight: 600; color: var(--text-primary); line-height: 1.4; }
.task-card-desc { font-size: 12px; color: var(--text-secondary); line-height: 1.5; }

.task-progress-bar {
  height: 4px;
  background: var(--bg-hover);
  border-radius: 2px;
  overflow: hidden;
}
.task-progress-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.5s ease;
}
.progress-green { background: var(--green-light); }
.progress-blue { background: var(--accent); }
.progress-yellow { background: var(--yellow-light); }
.progress-red { background: var(--red-light); }

.task-card-footer { display: flex; justify-content: space-between; align-items: center; }
.task-card-meta { display: flex; gap: 10px; align-items: center; font-size: 11px; color: var(--text-secondary); }
.task-card-right { display: flex; align-items: center; gap: 8px; }
.progress-label { font-size: 11px; font-weight: 600; color: var(--text-secondary); }
.attach-count { font-size: 11px; color: var(--text-secondary); }

.avatar-xs {
  width: 20px; height: 20px; background: var(--accent); border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700; text-transform: uppercase; flex-shrink: 0;
}
.avatar-sm {
  width: 32px; height: 32px; background: linear-gradient(135deg, var(--accent), var(--purple));
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; text-transform: uppercase; flex-shrink: 0;
}

/* ===== BADGES ===== */
.status-badge, .priority-badge, .role-badge, .rating-badge {
  display: inline-flex; align-items: center;
  padding: 3px 9px; border-radius: 20px;
  font-size: 11px; font-weight: 600; white-space: nowrap;
}

.status-todo { background: var(--bg-hover); color: var(--text-secondary); border: 1px solid var(--border); }
.status-inprogress { background: var(--accent-subtle); color: var(--accent-hover); border: 1px solid var(--accent); }
.status-review { background: var(--yellow-subtle); color: var(--yellow-light); border: 1px solid var(--yellow); }
.status-done { background: var(--green-subtle); color: var(--green-light); border: 1px solid var(--green); }
.status-cancelled { background: var(--bg-hover); color: var(--text-muted); border: 1px solid var(--border); }

.priority-critical { background: var(--red-subtle); color: var(--red-light); border: 1px solid var(--red); }
.priority-high { background: var(--orange-subtle); color: var(--orange-light); border: 1px solid var(--orange); }
.priority-medium { background: var(--yellow-subtle); color: var(--yellow-light); border: 1px solid var(--yellow); }
.priority-low { background: var(--green-subtle); color: var(--green-light); border: 1px solid var(--green); }

.role-admin { background: var(--purple-subtle); color: #a371f7; border: 1px solid var(--purple); }
.role-manager { background: var(--accent-subtle); color: var(--accent-hover); border: 1px solid var(--accent); }
.role-staff { background: var(--bg-hover); color: var(--text-secondary); border: 1px solid var(--border); }

.rating-excellent { background: var(--green-subtle); color: var(--green-light); border: 1px solid var(--green); }
.rating-good { background: var(--accent-subtle); color: var(--accent-hover); border: 1px solid var(--accent); }
.rating-average { background: var(--yellow-subtle); color: var(--yellow-light); border: 1px solid var(--yellow); }
.rating-poor { background: var(--red-subtle); color: var(--red-light); border: 1px solid var(--red); }

.tag {
  display: inline-flex;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  background: var(--bg-surface2);
  border: 1px solid var(--border);
  color: var(--text-secondary);
}
.tag-list { display: flex; flex-wrap: wrap; gap: 6px; }

/* ===== TASK DETAIL ===== */
.task-detail-page { max-width: 1200px; }

.detail-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}
.detail-actions { display: flex; gap: 8px; }

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 20px;
  align-items: start;
}
.detail-main { display: flex; flex-direction: column; gap: 20px; }
.detail-sidebar { display: flex; flex-direction: column; gap: 16px; }

.detail-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}
.detail-card h3 { font-size: 14px; font-weight: 700; margin-bottom: 14px; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.5px; }

.detail-title-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}
.detail-title { font-size: 20px; font-weight: 800; letter-spacing: -0.3px; }
.badge-group { display: flex; gap: 8px; flex-shrink: 0; }
.detail-description { color: var(--text-secondary); font-size: 14px; line-height: 1.7; margin-bottom: 12px; white-space: pre-wrap; }

/* Progress Section */
.progress-section { border-top: 1px solid var(--border-light); padding-top: 16px; margin-top: 4px; }
.progress-header { display: flex; justify-content: space-between; margin-bottom: 8px; font-size: 13px; }
.progress-header strong { font-size: 15px; font-weight: 700; color: var(--accent-hover); }
.progress-bar-lg { height: 10px; background: var(--bg-hover); border-radius: 5px; overflow: hidden; margin-bottom: 12px; }
.progress-bar-fill { height: 100%; background: linear-gradient(90deg, var(--accent) 0%, var(--accent-hover) 100%); border-radius: 5px; transition: width 0.5s ease; }
.progress-controls { display: flex; gap: 10px; align-items: center; }
.range-input { flex: 1; accent-color: var(--accent); cursor: pointer; }

/* Status Controls */
.status-controls { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; border-top: 1px solid var(--border-light); padding-top: 14px; margin-top: 4px; }
.status-controls .label { font-size: 12px; color: var(--text-secondary); font-weight: 600; }
.status-buttons { display: flex; gap: 6px; flex-wrap: wrap; }
.btn-status {
  padding: 5px 12px; border-radius: 20px; border: 1px solid; cursor: pointer;
  font-size: 11px; font-weight: 600; font-family: var(--font); transition: all 0.15s;
}
.btn-status-todo { background: var(--bg-hover); color: var(--text-secondary); border-color: var(--border); }
.btn-status-todo:hover { background: var(--bg-surface2); border-color: var(--text-muted); }
.btn-status-inprogress { background: var(--accent-subtle); color: var(--accent-hover); border-color: var(--accent); }
.btn-status-inprogress:hover { background: var(--accent); color: #fff; }
.btn-status-review { background: var(--yellow-subtle); color: var(--yellow-light); border-color: var(--yellow); }
.btn-status-review:hover { background: var(--yellow); color: #fff; }
.btn-status-done { background: var(--green-subtle); color: var(--green-light); border-color: var(--green); }
.btn-status-done:hover { background: var(--green); color: #fff; }
.btn-status-cancelled { background: var(--red-subtle); color: var(--red-light); border-color: var(--red); }
.btn-status-cancelled:hover { background: var(--red); color: #fff; }

/* Evaluation Card */
.eval-card { border: 1px solid var(--green); background: var(--green-subtle); }
.eval-rating { font-size: 16px; font-weight: 700; margin-bottom: 8px; }
.eval-note { color: var(--text-secondary); font-size: 13px; margin-bottom: 8px; }
.eval-meta { font-size: 11px; color: var(--text-muted); }

/* Comments */
.comments-list { display: flex; flex-direction: column; gap: 12px; margin-bottom: 14px; max-height: 400px; overflow-y: auto; }
.comment-item { display: flex; gap: 10px; }
.comment-item.comment-eval { background: var(--yellow-subtle); border-radius: var(--radius); padding: 10px; border: 1px solid var(--yellow); }
.comment-avatar {
  width: 32px; height: 32px; background: linear-gradient(135deg, var(--accent), var(--purple));
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; flex-shrink: 0; text-transform: uppercase;
}
.comment-body { flex: 1; }
.comment-meta { display: flex; gap: 8px; align-items: baseline; margin-bottom: 4px; }
.comment-meta strong { font-size: 13px; }
.comment-meta span { font-size: 11px; color: var(--text-muted); }
.comment-content { font-size: 13px; color: var(--text-secondary); line-height: 1.5; }
.comment-input-row { display: flex; gap: 8px; }
.comment-input-row .form-input { flex: 1; }

/* Info List */
.info-list { display: flex; flex-direction: column; gap: 10px; }
.info-row { display: flex; justify-content: space-between; align-items: flex-start; font-size: 13px; gap: 8px; }
.info-label { color: var(--text-secondary); font-weight: 500; flex-shrink: 0; }

/* Attachments */
.attachment-list { display: flex; flex-direction: column; gap: 6px; }
.attachment-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px;
  background: var(--bg-surface2); border: 1px solid var(--border-light);
  border-radius: var(--radius); transition: background 0.15s;
}
.attachment-item:hover { background: var(--bg-hover); }
.att-icon { font-size: 18px; flex-shrink: 0; }
.att-info { flex: 1; min-width: 0; }
.att-name { font-size: 12px; font-weight: 500; color: var(--accent-hover); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.att-meta { font-size: 10px; color: var(--text-muted); margin-top: 1px; }
.att-preview-btn, .att-delete {
  background: none; border: none; cursor: pointer; padding: 4px;
  border-radius: 4px; font-size: 13px; transition: background 0.15s; flex-shrink: 0;
}
.att-preview-btn:hover { background: var(--accent-subtle); }
.att-delete:hover { background: var(--red-subtle); }

.btn-upload {
  background: var(--accent-subtle); color: var(--accent-hover);
  border: 1px dashed var(--accent); border-radius: var(--radius);
  padding: 4px 10px; font-size: 11px; font-weight: 600;
  cursor: pointer; transition: all 0.15s; font-family: var(--font);
}
.btn-upload:hover { background: var(--accent); color: #fff; }
.upload-progress { font-size: 12px; color: var(--yellow-light); padding: 8px 0; }
.empty-text { font-size: 12px; color: var(--text-muted); padding: 8px 0; }

/* History */
.history-list { display: flex; flex-direction: column; gap: 10px; }
.history-item { display: flex; gap: 10px; align-items: flex-start; }
.history-dot {
  width: 8px; height: 8px; background: var(--border); border-radius: 50%;
  flex-shrink: 0; margin-top: 5px;
}
.history-action { font-size: 12px; font-weight: 500; }
.history-meta { font-size: 11px; color: var(--text-muted); }

/* ===== MODAL ===== */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(4px);
  animation: fadeIn 0.15s ease;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  width: 90%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.2s ease;
}
.modal.modal-lg { max-width: 680px; }
.modal.modal-sm { max-width: 380px; }

@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.modal-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 18px 20px; border-bottom: 1px solid var(--border);
}
.modal-header h2 { font-size: 16px; font-weight: 700; }
.modal-close {
  background: none; border: none; color: var(--text-secondary);
  font-size: 22px; cursor: pointer; line-height: 1; padding: 2px 6px;
  border-radius: 4px; transition: background 0.15s;
}
.modal-close:hover { background: var(--bg-hover); color: var(--text-primary); }
.modal-body { padding: 20px; }
.modal-footer {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 16px 20px; border-top: 1px solid var(--border);
}

/* ===== TABLE ===== */
.table-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.data-table {
  width: 100%;
  border-collapse: collapse;
}
.data-table th {
  background: var(--bg-surface2);
  padding: 11px 14px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
}
.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-light);
  font-size: 13px;
  vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--bg-hover); }
.user-cell { display: flex; align-items: center; gap: 8px; }
.action-btns { display: flex; gap: 4px; }
.status-active { color: var(--green-light); font-size: 12px; }
.status-inactive { color: var(--text-muted); font-size: 12px; }

/* ===== ALERTS ===== */
.alert-error {
  background: var(--red-subtle); border: 1px solid var(--red);
  color: var(--red-light); padding: 10px 14px; border-radius: var(--radius);
  font-size: 13px; margin-bottom: 14px;
}
.alert-success {
  background: var(--green-subtle); border: 1px solid var(--green);
  color: var(--green-light); padding: 10px 14px; border-radius: var(--radius);
  font-size: 13px; margin-bottom: 14px;
}

/* ===== STATES ===== */
.loading-state, .empty-state {
  text-align: center; padding: 60px 20px;
  color: var(--text-muted); font-size: 14px;
}
.empty-state { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.empty-icon { font-size: 48px; }

/* ===== TEXT UTILS ===== */
.text-danger { color: var(--red-light); }
.text-success { color: var(--green-light); }
.text-info { color: var(--accent-hover); }
.mb-2 { margin-bottom: 8px; }
.mt-2 { margin-top: 16px; }
.link { color: var(--accent-hover); text-decoration: none; }
.link:hover { text-decoration: underline; }

/* ===== LOGIN PAGE ===== */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-base);
  position: relative;
  overflow: hidden;
}

.login-bg { position: absolute; inset: 0; pointer-events: none; }
.login-shape {
  position: absolute; border-radius: 50%;
  filter: blur(80px); opacity: 0.12;
}
.login-shape.s1 { width: 500px; height: 500px; background: var(--accent); top: -150px; right: -100px; animation: float1 8s ease-in-out infinite; }
.login-shape.s2 { width: 400px; height: 400px; background: var(--purple); bottom: -100px; left: -100px; animation: float2 10s ease-in-out infinite; }
.login-shape.s3 { width: 300px; height: 300px; background: var(--green); top: 50%; left: 50%; transform: translate(-50%, -50%); animation: float1 12s ease-in-out infinite reverse; }

@keyframes float1 { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-30px); } }
@keyframes float2 { 0%,100% { transform: translateY(0); } 50% { transform: translateY(20px); } }

.login-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 40px;
  width: 100%;
  max-width: 420px;
  position: relative;
  z-index: 1;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.4s ease;
}

.login-header { text-align: center; margin-bottom: 32px; }
.login-logo {
  font-size: 40px;
  background: var(--accent);
  width: 64px; height: 64px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--radius-lg);
  margin-bottom: 16px;
  box-shadow: 0 8px 24px rgba(31,111,235,0.4);
}
.login-header h1 { font-size: 26px; font-weight: 800; letter-spacing: -0.5px; margin-bottom: 6px; }
.login-header p { font-size: 13px; color: var(--text-secondary); }

.login-form { display: flex; flex-direction: column; gap: 16px; }

.btn-login {
  width: 100%; padding: 12px;
  background: var(--accent); color: #fff;
  border: none; border-radius: var(--radius);
  font-size: 15px; font-weight: 700; font-family: var(--font);
  cursor: pointer; transition: all 0.2s;
  margin-top: 4px;
}
.btn-login:hover:not(:disabled) {
  background: var(--accent-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(31,111,235,0.4);
}
.btn-login:disabled, .btn-login.loading { opacity: 0.7; cursor: not-allowed; transform: none; }

.login-footer { text-align: center; margin-top: 20px; color: var(--text-muted); font-size: 11px; }

/* ===== EVALUATE MODAL ===== */
.eval-task-title { font-size: 14px; font-weight: 600; color: var(--text-primary); margin-bottom: 18px; padding: 10px 12px; background: var(--bg-surface2); border-radius: var(--radius); border-left: 3px solid var(--accent); }
.rating-options { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.rating-option {
  padding: 14px; background: var(--bg-surface2); border: 2px solid var(--border);
  border-radius: var(--radius); cursor: pointer; text-align: center; transition: all 0.15s;
}
.rating-option:hover { border-color: var(--accent); background: var(--accent-subtle); }
.rating-option.selected { border-color: var(--accent); background: var(--accent-subtle); }
.rating-stars { font-size: 16px; margin-bottom: 4px; }
.rating-label { font-size: 12px; font-weight: 600; color: var(--text-secondary); }
.rating-option.selected .rating-label { color: var(--accent-hover); }

/* ===== REPORTS ===== */
.report-filters { display: flex; gap: 12px; margin-bottom: 24px; }
.report-filters .form-select { width: auto; min-width: 180px; }
.report-grid { display: flex; flex-direction: column; gap: 24px; }
.report-section { background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px; }
.report-section h2 { font-size: 15px; font-weight: 700; margin-bottom: 16px; }

.inline-progress { display: flex; align-items: center; gap: 6px; }
.inline-progress-fill { height: 6px; background: var(--green-light); border-radius: 3px; max-width: 80px; min-width: 4px; transition: width 0.5s; }
.inline-progress span { font-size: 11px; font-weight: 600; }

.eval-summary { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.eval-row { display: grid; grid-template-columns: 130px 1fr 32px; align-items: center; gap: 10px; }
.eval-row-label { font-size: 12px; color: var(--text-secondary); }
.eval-bar-wrap { height: 8px; background: var(--bg-hover); border-radius: 4px; overflow: hidden; }
.eval-bar { height: 100%; border-radius: 4px; transition: width 0.5s ease; }
.eval-bar.rating-excellent { background: var(--green-light); }
.eval-bar.rating-good { background: var(--accent-hover); }
.eval-bar.rating-average { background: var(--yellow-light); }
.eval-bar.rating-poor { background: var(--red-light); }
.eval-count { font-size: 12px; font-weight: 600; text-align: right; }

/* ===== SIDEBAR OVERLAY (mobile) ===== */
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 99;
}

/* ===== BLAZOR ERROR ===== */
#blazor-error-ui {
  background: var(--red-subtle);
  border-top: 1px solid var(--red);
  bottom: 0; left: 0; right: 0;
  box-shadow: 0 -1px 0 rgba(0,0,0,.2);
  display: none;
  padding: 0.6rem 1.25rem 0.7rem 1.25rem;
  position: fixed;
  z-index: 1000;
  color: var(--red-light);
  font-size: 13px;
}
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: 0.75rem; top: 0.5rem; }
#blazor-error-ui .reload { color: var(--accent-hover); }

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
  .stats-grid { grid-template-columns: repeat(3, 1fr); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  .detail-sidebar { order: -1; }
}

@media (max-width: 768px) {
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0;
    transform: translateX(-100%);
  }
  .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-lg); }
  .sidebar-close { display: block; }
  .sidebar-overlay { display: block; }
  .menu-btn { display: block; }

  .page-content { padding: 16px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .stats-grid.mini { grid-template-columns: repeat(2, 1fr); }
  .tasks-grid { grid-template-columns: 1fr; }
  .page-header { flex-direction: column; align-items: flex-start; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .full-width { grid-column: 1; }
  .rating-options { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .login-card { padding: 28px 20px; }
  .detail-title { font-size: 16px; }
}

/* ===== ASSIGNEE PANEL ===== */
.assignee-panel { display: flex; flex-direction: column; gap: 14px; }

.assignee-list { display: flex; flex-direction: column; gap: 8px; }

.assignee-item {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 10px;
    background: var(--bg-surface2);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    transition: background 0.15s;
}
.assignee-item:hover { background: var(--bg-hover); }

.assignee-avatar {
    width: 32px; height: 32px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 700; color: #fff;
    text-transform: uppercase; flex-shrink: 0;
}
.assignee-info { flex: 1; min-width: 0; }
.assignee-name { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.assignee-meta { display: flex; align-items: center; gap: 6px; margin-top: 2px; }
.assignee-actions { display: flex; gap: 4px; flex-shrink: 0; }

.role-tag {
    display: inline-flex; padding: 1px 7px; border-radius: 10px;
    font-size: 10px; font-weight: 700;
}
.role-lead     { background: var(--accent-subtle);  color: var(--accent-hover);  border: 1px solid var(--accent); }
.role-reviewer { background: var(--purple-subtle);  color: #a371f7;              border: 1px solid var(--purple); }
.role-support  { background: var(--green-subtle);   color: var(--green-light);   border: 1px solid var(--green); }
.role-member   { background: var(--bg-hover);       color: var(--text-secondary); border: 1px solid var(--border); }

.assignee-add-section {
    padding: 12px;
    background: var(--bg-surface2);
    border: 1px dashed var(--border);
    border-radius: var(--radius);
}

.transfer-section { border-top: 1px solid var(--border-light); padding-top: 12px; }

.transfer-toggle {
    background: var(--orange-subtle);
    border: 1px solid var(--orange);
    color: var(--orange-light);
    padding: 6px 14px;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 12px; font-weight: 600;
    font-family: var(--font);
    transition: all 0.15s;
}
.transfer-toggle:hover { background: var(--orange); color: #fff; }

.transfer-form {
    margin-top: 12px;
    padding: 12px;
    background: var(--orange-subtle);
    border: 1px solid var(--orange);
    border-radius: var(--radius);
    display: flex; flex-direction: column; gap: 10px;
}
.transfer-form label {
    font-size: 11px; font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase; letter-spacing: .5px;
}

/* ===== CHARTS / REPORTS ===== */
.charts-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.chart-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 20px;
}

.chart-card-wide {
    margin-bottom: 20px;
}

.chart-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-light);
}

/* ApexCharts dark mode overrides */
.apexcharts-canvas {
    background: transparent !important;
}
.apexcharts-text, .apexcharts-legend-text {
    fill: var(--text-secondary) !important;
    color: var(--text-secondary) !important;
}
.apexcharts-gridline {
    stroke: var(--border) !important;
}
.apexcharts-tooltip {
    background: var(--bg-surface) !important;
    border: 1px solid var(--border) !important;
    color: var(--text-primary) !important;
}
.apexcharts-tooltip-title {
    background: var(--bg-surface2) !important;
    border-bottom: 1px solid var(--border) !important;
}
.apexcharts-xaxistooltip, .apexcharts-yaxistooltip {
    background: var(--bg-surface2) !important;
    border: 1px solid var(--border) !important;
    color: var(--text-primary) !important;
}

@media (max-width: 768px) {
    .charts-row { grid-template-columns: 1fr; }
}

/* Nav group label */
.nav-group-label {
    font-size: 10px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    padding: 10px 12px 4px;
}

/* ===== LICENSE PAGE ===== */
.license-page {
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    background: var(--bg-base);
    position: relative; overflow: hidden;
}
.license-bg { position: absolute; inset: 0; pointer-events: none; }
.license-shape {
    position: absolute; border-radius: 50%;
    filter: blur(80px); opacity: 0.1;
}
.license-shape.s1 { width: 500px; height: 500px; background: var(--accent); top: -150px; right: -100px; }
.license-shape.s2 { width: 400px; height: 400px; background: var(--red); bottom: -100px; left: -100px; }

.license-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 36px;
    width: 100%; max-width: 480px;
    position: relative; z-index: 1;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.4s ease;
}

.license-header { text-align: center; margin-bottom: 24px; }
.license-logo {
    font-size: 36px; background: var(--accent);
    width: 60px; height: 60px; border-radius: var(--radius-lg);
    display: inline-flex; align-items: center; justify-content: center;
    margin-bottom: 12px; box-shadow: 0 6px 20px rgba(31,111,235,0.4);
}
.license-header h1 { font-size: 22px; font-weight: 800; margin-bottom: 4px; }
.license-header p  { font-size: 13px; color: var(--text-secondary); }

.license-status {
    display: flex; gap: 12px; align-items: flex-start;
    padding: 14px; border-radius: var(--radius);
    margin-bottom: 20px; border: 1px solid;
}
.status-valid   { background: var(--green-subtle);  border-color: var(--green);  }
.status-warning { background: var(--yellow-subtle); border-color: var(--yellow); }
.status-error   { background: var(--red-subtle);    border-color: var(--red);    }

.license-status-icon { font-size: 24px; flex-shrink: 0; }
.license-status-title { font-size: 14px; font-weight: 700; margin-bottom: 3px; }
.license-status-msg   { font-size: 12px; color: var(--text-secondary); line-height: 1.5; }

.license-info {
    background: var(--bg-surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden; margin-bottom: 20px;
}
.license-info-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 9px 14px; border-bottom: 1px solid var(--border-light);
    font-size: 13px;
}
.license-info-row:last-child { border-bottom: none; }
.license-info-label { color: var(--text-secondary); font-weight: 500; }

.license-guide {
    background: var(--bg-surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px; margin-bottom: 20px;
}
.guide-title { font-size: 13px; font-weight: 700; margin-bottom: 10px; }
.guide-steps { padding-left: 18px; font-size: 13px; color: var(--text-secondary); }
.guide-steps li { margin-bottom: 6px; line-height: 1.6; }

.hostname-badge {
    display: inline-block;
    background: var(--accent-subtle); color: var(--accent-hover);
    border: 1px solid var(--accent);
    padding: 4px 12px; border-radius: 6px;
    font-family: var(--mono); font-size: 13px; font-weight: 700;
}
.hostname-badge.large { font-size: 16px; padding: 8px 18px; margin-top: 6px; }

.renew-section {
    background: var(--yellow-subtle);
    border: 1px solid var(--yellow);
    border-radius: var(--radius);
    padding: 16px; margin-bottom: 20px;
}
.renew-title {
    font-size: 13px; font-weight: 700;
    color: var(--yellow-light); margin-bottom: 12px;
}
.btn-renew {
    width: 100%; margin-top: 10px; padding: 10px;
    background: var(--yellow-light); color: #000;
    border: none; border-radius: var(--radius);
    font-size: 14px; font-weight: 700; font-family: var(--font);
    cursor: pointer; transition: all 0.15s;
}
.btn-renew:hover:not(:disabled) { filter: brightness(1.1); }
.btn-renew:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-continue {
    width: 100%; padding: 12px;
    background: var(--accent); color: #fff;
    border: none; border-radius: var(--radius);
    font-size: 15px; font-weight: 700; font-family: var(--font);
    cursor: pointer; transition: all 0.15s; margin-bottom: 16px;
}
.btn-continue:hover { background: var(--accent-hover); }

.license-footer { text-align: center; color: var(--text-muted); font-size: 11px; }

/* ── License Warning Banner ── */
.license-warning-banner {
    background: var(--yellow-subtle);
    border-bottom: 2px solid var(--yellow-light);
    padding: 8px 20px;
    display: flex; align-items: center; justify-content: center;
    gap: 16px; font-size: 13px; color: var(--yellow-light);
    font-weight: 500;
}
.license-warning-link {
    background: var(--yellow-light); color: #000;
    padding: 3px 12px; border-radius: 12px;
    font-weight: 700; font-size: 12px;
    text-decoration: none; flex-shrink: 0;
}
.license-warning-link:hover { filter: brightness(1.1); text-decoration: none; }

/* ===== SHARE ITEMS ===== */
.share-item {
    padding: 10px 12px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    margin-bottom: 8px;
    background: var(--bg-surface2);
}
.share-item.share-pending  { border-color: var(--yellow); background: var(--yellow-subtle); }
.share-item.share-approved { border-color: var(--green);  background: var(--green-subtle); }
.share-item.share-rejected { border-color: var(--red);    background: var(--red-subtle); }
.share-info {
    display: flex; justify-content: space-between; align-items: center;
    font-size: 13px; font-weight: 600;
}
.share-status-badge {
    font-size: 11px; font-weight: 700;
    padding: 2px 8px; border-radius: 10px;
    background: var(--bg-hover);
}
.share-note { font-size: 12px; color: var(--text-secondary); margin-top:5px; }
.share-actions { display: flex; gap: 6px; margin-top: 8px; }
.btn-warning {
    background: var(--orange-subtle); border: 1px solid var(--orange);
    color: var(--orange-light); padding: 7px 14px;
    border-radius: var(--radius); cursor: pointer;
    font-size: 13px; font-weight: 600; font-family: var(--font);
    transition: all 0.15s;
}
.btn-warning:hover { background: var(--orange); color: #fff; }
.btn-danger {
    background: var(--red-subtle); border: 1px solid var(--red);
    color: var(--red-light); padding: 7px 14px;
    border-radius: var(--radius); cursor: pointer;
    font-size: 13px; font-weight: 600; font-family: var(--font);
    transition: all 0.15s;
}
.btn-danger:hover { background: var(--red); color: #fff; }
.btn-danger:disabled { opacity: 0.5; cursor: not-allowed; }

/* Badge trong task-card không chặn click */
.task-card .priority-badge,
.task-card .status-badge {
    pointer-events: none;
}

/* ===== RESPONSIVE BỔ SUNG ===== */
@media (max-width: 768px) {
  /* Topbar */
  .topbar-user { display: none; }
  .topbar { padding: 0 12px; }

  /* Filter bar */
  .filter-bar { flex-direction: column; gap: 8px; }
  .filter-bar .form-select,
  .filter-bar .form-input { width: 100%; }

  /* Task card */
  .task-card { padding: 12px; }
  .task-card-title { font-size: 14px; }

  /* Detail page */
  .detail-header { flex-wrap: wrap; gap: 8px; }
  .detail-actions { flex-wrap: wrap; gap: 6px; }
  .detail-actions button { font-size: 12px; padding: 6px 10px; }

  /* Modal */
  .modal { margin: 12px; width: calc(100% - 24px); max-width: 100%; }
  .modal-lg { width: calc(100% - 24px); }

  /* Charts */
  .charts-row { grid-template-columns: 1fr; }
  .chart-card { padding: 14px; }

  /* Filter panel */
  .filter-grid { grid-template-columns: 1fr; }
  .filter-panel { padding: 14px; }

  /* Report filters */
  .report-filters,
  .page-header > div:last-child { flex-direction: column; width: 100%; }
  .page-header > div:last-child .form-select { width: 100%; }

  /* Assignee panel */
  .assignee-add-section .filter-grid { grid-template-columns: 1fr; }

  /* License page */
  .license-card { padding: 24px 16px; margin: 12px; }

  /* Dept grid */
  .dept-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  /* Stats nhỏ hơn */
  .stat-value { font-size: 22px; }
  .stat-card { padding: 12px; }

  /* Nút action */
  .btn-primary, .btn-secondary { font-size: 13px; padding: 8px 12px; }

  /* Theme picker panel */
  .theme-panel { width: 220px; right: 8px; }
  .theme-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ===== SYS REPORTS ===== */
.sys-dashboard {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 12px;
    margin-bottom: 8px;
}
@media (max-width: 1024px) { .sys-dashboard { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 600px)  { .sys-dashboard { grid-template-columns: repeat(2, 1fr); } }

.sys-dash-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px 12px;
    text-align: center;
    transition: all 0.15s;
}
.sys-dash-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.dash-ok     { border-color: var(--green);  background: var(--green-subtle); }
.dash-warn   { border-color: var(--yellow); background: var(--yellow-subtle); }
.dash-danger { border-color: var(--red);    background: var(--red-subtle); }
.dash-icon   { font-size: 22px; margin-bottom: 6px; }
.dash-value  { font-size: 24px; font-weight: 800; color: var(--text-primary); }
.dash-label  { font-size: 11px; color: var(--text-secondary); font-weight: 600;
               text-transform: uppercase; letter-spacing: .5px; margin-top: 4px; }

.type-badge {
    display: inline-block; padding: 2px 10px; border-radius: 12px;
    font-size: 11px; font-weight: 700;
}
.type-daily   { background: var(--accent-subtle);  color: var(--accent-hover); }
.type-weekly  { background: var(--purple-subtle);  color: #a371f7; }
.type-monthly { background: var(--orange-subtle);  color: var(--orange-light); }

.report-view { display: flex; flex-direction: column; gap: 0; }
.report-status {
    padding: 12px 16px; border-radius: var(--radius); margin-bottom: 16px;
    font-weight: 700; font-size: 15px;
}
.status-ok  { background: var(--green-subtle);  color: var(--green-light);  border: 1px solid var(--green); }
.status-bad { background: var(--red-subtle);    color: var(--red-light);    border: 1px solid var(--red); }
.report-section-title {
    font-size: 13px; font-weight: 700; color: var(--accent-hover);
    margin: 14px 0 8px; padding-bottom: 6px;
    border-bottom: 1px solid var(--border-light);
}
.report-grid2 {
    display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 4px;
}
@media (max-width: 600px) { .report-grid2 { grid-template-columns: 1fr; } }
.report-item {
    display: flex; flex-direction: column; gap: 2px;
    background: var(--bg-surface2); border-radius: var(--radius);
    padding: 8px 12px; font-size: 13px;
}
.ri-label { font-size: 11px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; }
.ri-ok    { color: var(--green-light); font-weight: 600; }
.ri-fail  { color: var(--red-light);   font-weight: 600; }
.ri-warn  { color: var(--yellow-light);font-weight: 600; }
.report-summary-text {
    background: var(--bg-surface2); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 12px 14px;
    font-size: 13px; line-height: 1.7; color: var(--text-secondary);
    white-space: pre-wrap;
}
.form-section { margin-bottom: 20px; }
.form-section-title {
    font-size: 13px; font-weight: 700; color: var(--accent-hover);
    margin-bottom: 12px; padding-bottom: 6px;
    border-bottom: 1px solid var(--border-light);
}

/* ── SysReport Attachments ── */
.sys-att-list { display: flex; flex-direction: column; gap: 8px; }
.sys-att-item {
    display: flex; align-items: center; gap: 10px;
    background: var(--bg-surface2); border: 1px solid var(--border-light);
    border-radius: var(--radius); padding: 8px 12px;
}
.sys-att-icon { font-size: 20px; flex-shrink: 0; }
.sys-att-info { flex: 1; min-width: 0; }
.sys-att-name {
    font-size: 13px; font-weight: 600; color: var(--accent-hover);
    text-decoration: none; display: block;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sys-att-name:hover { text-decoration: underline; }
.sys-att-caption { font-size: 12px; color: var(--text-secondary); margin-top: 2px; font-style: italic; }
.sys-att-meta    { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* Checkbox label */
.checkbox-label {
    display: flex; align-items: center; gap: 8px;
    cursor: pointer; font-size: 13px; color: var(--text-primary);
}
.checkbox-label input[type="checkbox"] {
    width: 16px; height: 16px; cursor: pointer; accent-color: var(--accent);
}

/* ===== SYS IT REPORTS ===== */
.server-snap-card {
    background: var(--bg-surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 14px; margin-bottom: 12px;
}
.server-snap-card.server-warn   { border-color: var(--yellow); background: var(--yellow-subtle); }
.server-snap-card.server-offline { border-color: var(--red); opacity: 0.7; }

.server-snap-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 12px;
}
.server-code {
    background: var(--accent-subtle); color: var(--accent-hover);
    border: 1px solid var(--accent); padding: 2px 8px;
    border-radius: 4px; font-size: 11px; font-weight: 700;
}
.badge-online  { font-size: 12px; font-weight: 700; color: var(--green-light); }
.badge-offline { font-size: 12px; font-weight: 700; color: var(--red-light); }

.server-metrics { display: flex; flex-direction: column; gap: 6px; }
.metric-item { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.metric-label { width: 50px; font-weight: 700; color: var(--text-secondary); flex-shrink: 0; }
.metric-bar {
    flex: 1; height: 8px; background: var(--bg-hover);
    border-radius: 4px; overflow: hidden;
}
.metric-fill { height: 100%; border-radius: 4px; transition: width 0.3s; }
.metric-val  { width: 180px; flex-shrink: 0; color: var(--text-secondary); }
.metric-item.metric-warn .metric-label { color: var(--yellow-light); }

.upgrade-hint {
    margin-top: 8px; font-size: 12px; font-weight: 600;
    color: var(--yellow-light); padding: 6px 10px;
    background: var(--yellow-subtle); border-radius: var(--radius);
}
.upgrade-note {
    margin-top: 4px; font-size: 12px; color: var(--accent-hover);
    font-style: italic;
}

.server-input-card {
    background: var(--bg-surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 14px; margin-bottom: 12px;
}
.server-input-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 12px; padding-bottom: 8px;
    border-bottom: 1px solid var(--border-light);
}
.server-input-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}
@media (max-width: 600px) { .server-input-grid { grid-template-columns: 1fr 1fr; } }
.server-input-grid .full-width { grid-column: 1 / -1; }

.btn-link {
    background: none; border: none; color: var(--accent-hover);
    cursor: pointer; font-size: 13px; text-decoration: underline;
    padding: 0; font-family: var(--font);
}

/* ── Tab bar ── */
.tab-bar {
    display: flex; gap: 4px; margin-bottom: 20px;
    border-bottom: 2px solid var(--border);
    padding-bottom: 0;
}
.tab-btn {
    background: none; border: none; border-bottom: 2px solid transparent;
    margin-bottom: -2px; padding: 10px 18px;
    font-size: 13px; font-weight: 600; color: var(--text-secondary);
    cursor: pointer; font-family: var(--font);
    transition: all 0.15s;
}
.tab-btn:hover { color: var(--text-primary); }
.tab-btn.active { color: var(--accent-hover); border-bottom-color: var(--accent); }

.report-toolbar {
    display: flex; justify-content: space-between; align-items: center;
    flex-wrap: wrap; gap: 10px; margin-bottom: 16px;
    padding: 12px 16px; background: var(--bg-surface2);
    border: 1px solid var(--border); border-radius: var(--radius-lg);
}
.auto-calc {
    font-size: 11px; font-weight: 700; color: var(--accent-hover);
    margin-left: 6px; background: var(--accent-subtle);
    padding: 1px 6px; border-radius: 8px;
}
.row-offline { opacity: 0.6; }

/* Server mini badge selector */
.server-mini-badge {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 4px 10px; border-radius: 20px;
    font-size: 11px; font-weight: 700; font-family: var(--mono);
    background: var(--bg-surface2); border: 1px solid var(--border);
    color: var(--text-secondary); cursor: pointer;
    transition: all 0.15s;
}
.server-mini-badge:hover { border-color: var(--accent); color: var(--accent-hover); }
.server-mini-badge.active { background: var(--accent-subtle); border-color: var(--accent); color: var(--accent-hover); }
.server-mini-badge.warn { border-color: var(--yellow); color: var(--yellow-light); }
.server-mini-badge.warn.active { background: var(--yellow-subtle); }

/* ===== API CONFIG PAGE ===== */
.api-group { margin-bottom: 28px; }
.api-group-label {
    display: flex; align-items: center; gap: 8px;
    font-size: 13px; font-weight: 700; color: var(--text-secondary);
    text-transform: uppercase; letter-spacing: 0.6px;
    margin-bottom: 12px; padding-bottom: 8px;
    border-bottom: 1px solid var(--border-light);
}
.api-group-icon { font-size: 16px; }
.api-group-count {
    margin-left: auto; font-size: 11px; font-weight: 600;
    background: var(--bg-surface2); border: 1px solid var(--border);
    padding: 2px 8px; border-radius: 10px; color: var(--text-muted);
    text-transform: none; letter-spacing: 0;
}

.api-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 16px;
}

.api-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px;
    display: flex; flex-direction: column; gap: 12px;
    transition: box-shadow 0.15s, border-color 0.15s;
}
.api-card:hover { box-shadow: var(--shadow); border-color: var(--accent); }
.api-card-inactive { opacity: 0.55; }
.api-card-inactive:hover { opacity: 0.75; }

.api-card-top {
    display: flex; justify-content: space-between; align-items: flex-start; gap: 10px;
}
.api-card-name { font-size: 14px; font-weight: 700; color: var(--text-primary); }
.api-card-desc { font-size: 12px; color: var(--text-muted); line-height: 1.5; }

.api-key-badge {
    font-family: var(--mono); font-size: 10px; font-weight: 700;
    background: var(--accent-subtle); color: var(--accent-hover);
    border: 1px solid var(--accent); padding: 2px 7px; border-radius: 6px;
    white-space: nowrap;
}

/* ON/OFF Toggle */
.api-toggle {
    font-size: 10px; font-weight: 800; padding: 3px 9px;
    border-radius: 10px; cursor: pointer; border: 1px solid var(--border);
    background: var(--bg-surface2); color: var(--text-muted);
    transition: all 0.15s; letter-spacing: 0.5px;
}
.api-toggle-on {
    background: var(--green-subtle); color: var(--green-light);
    border-color: var(--green);
}
.api-toggle:hover { filter: brightness(1.1); }

/* Fields preview */
.api-fields-preview {
    background: var(--bg-surface2);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: 10px 12px;
    display: flex; flex-direction: column; gap: 6px;
}
.api-field-row {
    display: flex; justify-content: space-between; align-items: center;
    gap: 8px; font-size: 12px;
}
.api-field-label {
    color: var(--text-secondary); font-weight: 600; flex-shrink: 0;
    min-width: 110px;
}
.api-field-value {
    color: var(--text-primary); font-family: var(--mono); font-size: 11px;
    text-align: right; display: flex; align-items: center; gap: 4px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.api-secret { color: var(--text-muted); }
.api-reveal-val { color: var(--accent-hover); }
.api-reveal-btn {
    background: none; border: none; cursor: pointer; padding: 0 2px;
    font-size: 12px; opacity: 0.7; flex-shrink: 0;
}
.api-reveal-btn:hover { opacity: 1; }
.api-field-more { font-size: 11px; color: var(--text-muted); text-align: center; padding-top: 2px; }

/* Card footer */
.api-card-footer {
    display: flex; justify-content: space-between; align-items: center;
    padding-top: 8px; border-top: 1px solid var(--border-light);
}
.api-updated { font-size: 11px; color: var(--text-muted); }

/* ── Fields Editor (trong modal) ── */
.api-fields-editor {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}
.api-fields-editor-header {
    display: grid;
    grid-template-columns: 130px 1fr 1fr 90px 48px 36px;
    gap: 8px; padding: 8px 10px;
    background: var(--bg-surface2);
    font-size: 11px; font-weight: 700; color: var(--text-secondary);
    text-transform: uppercase; letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
}
.api-fields-editor-row {
    display: grid;
    grid-template-columns: 130px 1fr 1fr 90px 48px 36px;
    gap: 8px; padding: 8px 10px;
    border-bottom: 1px solid var(--border-light);
    align-items: center;
}
.api-fields-editor-row:last-child { border-bottom: none; }
.api-fields-editor-row .form-input,
.api-fields-editor-row .form-select { padding: 6px 8px; font-size: 12px; }

@media (max-width: 768px) {
    .api-cards-grid { grid-template-columns: 1fr; }
    .api-fields-editor-header { display: none; }
    .api-fields-editor-row {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: auto auto auto;
        gap: 6px;
    }
}

/* ══ SIGNER LIST (Sign PDF page) ══════════════════════════════ */
.signer-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.signer-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: border-color .15s;
}
.signer-item:hover { border-color: var(--accent); }
.signer-item.signer-done {
    border-color: var(--green);
    background: var(--green-subtle);
}
.signer-item.signer-failed {
    border-color: var(--red);
    background: var(--red-subtle);
}
.signer-order {
    flex-shrink: 0;
    width: 28px; height: 28px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    font-size: 13px; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
}
.signer-info {
    flex: 1;
    min-width: 0;
}
.signer-name {
    font-size: 14px; font-weight: 600;
    color: var(--text-primary);
    display: flex; align-items: center; flex-wrap: wrap; gap: 4px;
}
.signer-meta {
    margin-top: 4px;
    display: flex; flex-wrap: wrap; gap: 10px;
    font-size: 12px; color: var(--text-secondary);
}
.signer-actions {
    display: flex; align-items: center; gap: 4px;
    flex-shrink: 0;
}
.btn-icon {
    width: 28px; height: 28px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg-surface2);
    color: var(--text-secondary);
    font-size: 13px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    transition: background .15s, color .15s;
}
.btn-icon:hover { background: var(--bg-hover); color: var(--text-primary); }
.btn-icon-danger:hover { background: var(--red-subtle); color: var(--red-light); border-color: var(--red); }

@media (max-width: 600px) {
    .signer-item { flex-wrap: wrap; }
    .signer-actions { width: 100%; justify-content: flex-end; }
}

/* ══ SIGN CONFIG PAGE ═════════════════════════════════════ */
.sign-provider-card { border-left: 3px solid var(--accent); }
.sign-provider-inactive { border-left-color: var(--border); opacity: .75; }

.sign-provider-header {
    display: flex; align-items: flex-start; gap: 12px;
    padding-bottom: 14px; margin-bottom: 14px;
    border-bottom: 1px solid var(--border-light);
}
.sign-provider-info { flex: 1; min-width: 0; }
.sign-provider-name {
    font-size: 15px; font-weight: 700; color: var(--text-primary);
    display: flex; align-items: center; gap: 8px; margin-bottom: 4px;
}
.sign-provider-meta {
    display: flex; flex-wrap: wrap; gap: 8px;
    font-size: 12px; color: var(--text-secondary); align-items: center;
}
.sign-provider-actions {
    display: flex; align-items: center; gap: 6px; flex-shrink: 0;
}
.sign-provider-dot {
    width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}
.dot-active  { background: var(--green); }
.dot-inactive{ background: var(--text-muted); }

.sign-accounts-section { padding-top: 4px; }
.sign-accounts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 10px;
}
.sign-account-card {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px;
    background: var(--bg-surface2);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    transition: border-color .15s;
}
.sign-account-card:hover { border-color: var(--accent); }
.sign-account-inactive { opacity: .6; }

.sign-account-img {
    width: 60px; height: 30px; flex-shrink: 0;
    background: #fff; border: 1px solid var(--border-light);
    border-radius: 4px; overflow: hidden;
    display: flex; align-items: center; justify-content: center;
}
.sign-account-img img { width: 100%; height: 100%; object-fit: contain; }
.sign-account-img-placeholder { font-size: 16px; }

.sign-account-info { flex: 1; min-width: 0; }
.sign-account-name {
    font-size: 13px; font-weight: 600; color: var(--text-primary);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sign-account-title {
    font-size: 11px; color: var(--text-secondary); margin-top: 1px;
}
.sign-account-meta {
    display: flex; gap: 8px; flex-wrap: wrap;
    font-size: 11px; color: var(--text-muted); margin-top: 3px;
}
.sign-account-actions {
    display: flex; align-items: center; gap: 4px; flex-shrink: 0;
}

/* toggle nhỏ hơn cho account */
.api-toggle-sm .api-toggle-track { width: 32px; height: 18px; }
.api-toggle-sm .api-toggle-track::after { width: 14px; height: 14px; }
.api-toggle-sm input:checked + .api-toggle-track::after { transform: translateX(14px); }

@media (max-width: 600px) {
    .sign-accounts-grid { grid-template-columns: 1fr; }
    .sign-provider-header { flex-wrap: wrap; }
}
