:root {
  --color-primary: #3b6cf6;
  --color-primary-dark: #2952c8;
  --color-danger: #e5484d;
  --color-success: #2fa96b;
  --color-bg: #f4f6fb;
  --color-surface: #ffffff;
  --color-border: #e1e5ee;
  --color-text: #1f2430;
  --color-text-muted: #6b7280;
  --radius: 8px;
  --shadow: 0 2px 8px rgba(20, 30, 60, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, "Hiragino Kaku Gothic ProN", "Yu Gothic", "Segoe UI", sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
}

a {
  color: var(--color-primary);
  text-decoration: none;
}

/* ---------- Navbar ---------- */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  padding: 12px 24px;
  box-shadow: var(--shadow);
}

.navbar-brand {
  font-weight: 700;
  font-size: 18px;
  margin-right: 32px;
}

.navbar-links {
  display: flex;
  gap: 20px;
  flex: 1;
}

.navbar-links a {
  color: var(--color-text-muted);
  font-weight: 500;
  padding: 6px 4px;
  border-bottom: 2px solid transparent;
}

.navbar-links a.active,
.navbar-links a:hover {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
}

.navbar-user {
  display: flex;
  align-items: center;
  gap: 12px;
}

.navbar-username {
  font-weight: 600;
}

.logout-form {
  margin: 0;
}

/* ---------- Layout ---------- */
.page-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.page-header h1 {
  font-size: 22px;
  margin: 0;
}

.toolbar {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.filter-group label {
  font-size: 12px;
  color: var(--color-text-muted);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 8px 14px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 14px;
  transition: background 0.15s, border-color 0.15s;
}

.btn:hover {
  background: #f0f2f8;
}

.btn-primary {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--color-primary-dark);
}

.btn-danger {
  color: var(--color-danger);
  border-color: #f3c6c7;
}

.btn-danger:hover {
  background: #fdecec;
}

.btn-success {
  color: var(--color-success);
  border-color: #bfe6cf;
}

.btn-success:hover {
  background: #eafaf1;
}

.btn-link {
  background: none;
  border: none;
  color: var(--color-text-muted);
  text-decoration: underline;
  padding: 0;
}

.btn-sm {
  padding: 5px 10px;
  font-size: 13px;
}

.btn-xs {
  padding: 3px 8px;
  font-size: 12px;
}

.btn-block {
  width: 100%;
  justify-content: center;
}

select,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 14px;
  font-family: inherit;
  background: var(--color-surface);
  color: var(--color-text);
}

.filter-group select {
  width: 200px;
}

/* ---------- Forms ---------- */
.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  margin-bottom: 4px;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-muted);
}

.field-error {
  color: var(--color-danger);
  font-size: 12px;
  margin-top: 4px;
}

.alert {
  padding: 10px 14px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  font-size: 14px;
}

.alert-error {
  background: #fdecec;
  color: var(--color-danger);
  border: 1px solid #f3c6c7;
}

/* ---------- Login ---------- */
.login-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 48px);
}

.login-box {
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 36px;
  width: 100%;
  max-width: 380px;
}

.login-title {
  margin: 0 0 4px;
  font-size: 24px;
  text-align: center;
}

.login-subtitle {
  text-align: center;
  color: var(--color-text-muted);
  margin-bottom: 24px;
}

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 20, 35, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
}

.modal-box {
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
}

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

.modal-header h3 {
  margin: 0;
  font-size: 16px;
}

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

.modal-body {
  padding: 20px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
}

.impact-list {
  background: #fdecec;
  border: 1px solid #f3c6c7;
  border-radius: var(--radius);
  padding: 10px 20px;
  margin: 10px 0;
}

.warning-text {
  color: var(--color-danger);
  font-size: 13px;
}

/* ---------- Table ---------- */
.data-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--color-surface);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.data-table th,
.data-table td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--color-border);
  font-size: 14px;
}

.data-table th {
  background: #f7f8fc;
  font-weight: 600;
  color: var(--color-text-muted);
}

.data-table .actions {
  display: flex;
  gap: 6px;
}

.row-disabled {
  opacity: 0.55;
}

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

.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.badge-active {
  background: #eafaf1;
  color: var(--color-success);
}

.badge-inactive {
  background: #f1f2f5;
  color: var(--color-text-muted);
}

.badge-admin {
  background: #eef1ff;
  color: var(--color-primary);
  margin-left: 6px;
}

/* ---------- Task board ---------- */
.task-board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.task-column {
  background: #eceff5;
  border-radius: var(--radius);
  padding: 12px;
  min-height: 320px;
  display: flex;
  flex-direction: column;
}

.task-column-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 700;
  margin-bottom: 10px;
  padding: 0 4px;
}

.task-count {
  background: #dfe3ee;
  color: var(--color-text-muted);
  border-radius: 999px;
  font-size: 12px;
  padding: 1px 8px;
}

.task-column-body {
  flex: 1;
  min-height: 60px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.task-card {
  background: var(--color-surface);
  border-radius: var(--radius);
  padding: 12px;
  box-shadow: var(--shadow);
  cursor: pointer;
  border: 1px solid transparent;
  position: relative;
}

.task-card:hover {
  border-color: var(--color-primary);
}

.task-card-ghost {
  opacity: 0.4;
}

.task-card-overdue {
  border-color: #f3c6c7;
  background: #fdf1f1;
}

.overdue-label {
  display: inline-block;
  background: var(--color-danger);
  color: #fff;
  font-size: 11px;
  border-radius: 999px;
  padding: 1px 8px;
  margin-bottom: 6px;
}

.task-card-title {
  font-weight: 600;
  margin-bottom: 6px;
}

.task-card-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 12px;
  color: var(--color-text-muted);
}

.task-card-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 8px;
}

.status-badge {
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.status-todo {
  background: #eef0f6;
  color: var(--color-text-muted);
}

.status-in_progress {
  background: #e6edff;
  color: var(--color-primary);
}

.status-done {
  background: #eafaf1;
  color: var(--color-success);
}

/* ---------- Goals ---------- */
.goal-card {
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 20px;
}

.goal-card-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
}

.goal-card-title {
  font-size: 17px;
  font-weight: 700;
}

.goal-fiscal-year {
  color: var(--color-text-muted);
  font-weight: 500;
  font-size: 13px;
  margin-right: 6px;
}

.goal-card-progress-label {
  font-weight: 700;
  color: var(--color-primary);
}

.goal-description {
  color: var(--color-text-muted);
  font-size: 13px;
  margin: 8px 0 14px;
}

.progress-bar {
  height: 10px;
  background: #eceff5;
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 6px;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--color-primary), #6f9bff);
  border-radius: 999px;
}

.sub-goal-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
}

.sub-goal-row {
  display: grid;
  grid-template-columns: 50px 1fr 120px 50px auto;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius);
  background: #f7f8fc;
  cursor: pointer;
}

.sub-goal-row:hover {
  background: #eef1fa;
}

.sub-goal-quarter {
  font-weight: 700;
  color: var(--color-primary);
  font-size: 12px;
}

.sub-goal-title {
  font-size: 14px;
}

.sub-goal-progress-bar {
  height: 8px;
  background: #e1e5ee;
  border-radius: 999px;
  overflow: hidden;
}

.sub-goal-progress-label {
  font-size: 12px;
  text-align: right;
  color: var(--color-text-muted);
}

.sub-goal-actions {
  display: flex;
  gap: 4px;
}

.goal-card-actions {
  display: flex;
  gap: 8px;
  border-top: 1px solid var(--color-border);
  padding-top: 12px;
}

/* ---------- Toast ---------- */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 2000;
}

.toast {
  background: #1f2430;
  color: #fff;
  padding: 10px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s, transform 0.2s;
  box-shadow: var(--shadow);
}

.toast-visible {
  opacity: 1;
  transform: translateY(0);
}

.toast-error {
  background: var(--color-danger);
}

.toast-success {
  background: var(--color-success);
}

@media (max-width: 900px) {
  .task-board {
    grid-template-columns: 1fr;
  }

  .sub-goal-row {
    grid-template-columns: 1fr;
    row-gap: 4px;
  }
}
