:root {
  --bg-primary: #0a0a0a;
  --bg-secondary: rgba(255, 255, 255, 0.04);
  --bg-card: rgba(255, 255, 255, 0.06);
  --bg-hover: rgba(255, 255, 255, 0.09);
  --border: rgba(255, 255, 255, 0.1);
  --border-light: rgba(255, 255, 255, 0.16);
  --glass-blur: 20px;
  --text-primary: #e8e8f0;
  --text-secondary: #9898b0;
  --text-muted: #686880;
  --accent: #c8a45c;
  --accent-hover: #d4b46e;
  --accent-dim: rgba(200, 164, 92, 0.15);
  --danger: #e05555;
  --danger-dim: rgba(224, 85, 85, 0.15);
  --success: #4caf82;
  --success-dim: rgba(76, 175, 130, 0.15);
  --radius: 8px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
  --font: 'Segoe UI', 'Microsoft YaHei', system-ui, sans-serif;
}

.glass-surface {
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  color-scheme: dark;
}

body:has(.app-layout) {
  height: 100vh;
  overflow: hidden;
}

a {
  color: var(--accent);
  text-decoration: none;
}

/* Login */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0a0a0a 0%, #111111 50%, #0a0a0a 100%);
  position: relative;
  z-index: 0;
}

.login-page::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 30% 20%, rgba(200, 164, 92, 0.06) 0%, transparent 60%),
              radial-gradient(ellipse at 70% 80%, rgba(200, 164, 92, 0.04) 0%, transparent 50%);
  pointer-events: none;
}

.login-card {
  width: 420px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 48px 40px;
  box-shadow: var(--shadow);
  position: relative;
  z-index: 1;
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
}

.login-logo {
  text-align: center;
  margin-bottom: 24px;
}

.login-brand-logo {
  display: block;
  width: 220px;
  max-width: 85%;
  height: auto;
  margin: 0 auto 14px;
}

.login-tagline {
  font-size: 13px;
  color: var(--text-secondary);
  letter-spacing: 1px;
  line-height: 1.6;
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.login-tagline-main {
  font-size: 15px;
  color: var(--text-primary);
  letter-spacing: 2px;
}

.login-tagline-sub {
  font-size: 12px;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

.login-logo .accent-line {
  width: 48px;
  height: 2px;
  background: var(--accent);
  margin: 12px auto 0;
}

/* Forms */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 8px;
  letter-spacing: 0.5px;
}

.form-control {
  width: 100%;
  padding: 11px 14px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 14px;
  font-family: var(--font);
  transition: border-color 0.2s, box-shadow 0.2s;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-sizing: border-box;
}

.form-control:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.form-control::placeholder {
  color: var(--text-muted);
}

input.form-control,
select.form-control {
  height: 36px;
  padding: 0 12px;
  font-size: 13px;
  line-height: 34px;
}

select.form-control {
  cursor: pointer;
  appearance: none;
  color-scheme: dark;
  background-color: #141414;
  color: var(--text-primary);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%239898b0' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
}

select.form-control option {
  background-color: #1a1a1a;
  color: #e8e8f0;
}

textarea.form-control {
  resize: vertical;
  min-height: 80px;
  height: auto;
  padding: 11px 14px;
  font-size: 14px;
  line-height: 1.5;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 24px;
}

.form-check input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}

.form-check label {
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-family: var(--font);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: 0.3px;
}

.btn-primary {
  background: var(--accent);
  color: #1a1a10;
  width: 100%;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-secondary {
  background: var(--bg-hover);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  border-color: var(--border-light);
  background: var(--bg-hover);
}

.btn-danger {
  background: var(--danger-dim);
  color: var(--danger);
  border: 1px solid rgba(224, 85, 85, 0.3);
}

.btn-danger:hover {
  background: rgba(224, 85, 85, 0.25);
}

.btn-sm {
  height: 36px;
  padding: 0 14px;
  font-size: 13px;
  box-sizing: border-box;
  line-height: 1;
}

.btn-icon {
  padding: 0 10px;
  min-width: 36px;
}

/* Layout */
.app-layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

.sidebar {
  width: 240px;
  height: 100%;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow: hidden;
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  transition: width 0.2s ease;
}

.sidebar.collapsed {
  width: 64px;
}

.sidebar-header {
  position: relative;
  padding: 24px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.sidebar.collapsed .sidebar-header {
  padding: 12px 8px;
  border-bottom: 1px solid var(--border);
}

.sidebar-logo {
  display: block;
  width: 100%;
  max-width: 168px;
  height: auto;
  margin: 0 auto 10px;
}

.sidebar.collapsed .sidebar-logo,
.sidebar.collapsed .sidebar-tagline,
.sidebar.collapsed .sidebar-header .accent-line {
  display: none;
}

.sidebar-tagline {
  margin: 0 0 12px;
  text-align: center;
  font-size: 11px;
  line-height: 1.5;
  color: var(--text-secondary);
  letter-spacing: 0.5px;
}

.sidebar-header .accent-line {
  width: 32px;
  height: 2px;
  background: var(--accent);
  margin: 0 auto;
}

.sidebar.collapsed .nav-section-label:not(.hidden),
.sidebar.collapsed .nav-label,
.sidebar.collapsed .user-info,
.sidebar.collapsed .sidebar-footer > .btn,
.sidebar.collapsed .app-copyright {
  display: none;
}

.sidebar-nav {
  flex: 1;
  min-height: 0;
  padding: 16px 12px;
  overflow-x: hidden;
  overflow-y: auto;
}

.sidebar.collapsed .sidebar-nav {
  padding: 12px 8px;
}

.nav-section-label {
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 1px;
  padding: 10px 16px 6px;
  text-transform: uppercase;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 16px;
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: 4px;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: var(--font);
}

.sidebar.collapsed .nav-item {
  justify-content: center;
  padding: 11px 0;
  gap: 0;
}

.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.nav-item.active {
  background: var(--accent-dim);
  color: var(--accent);
}

.nav-item.active .icon i {
  color: var(--accent);
}

.nav-item .icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  flex-shrink: 0;
}

.nav-item .icon i {
  font-size: 18px;
  line-height: 1;
}

.nav-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.sidebar.collapsed .sidebar-footer {
  padding: 10px 8px;
}

.sidebar-toggle {
  position: absolute;
  top: 24px;
  right: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.sidebar-toggle:hover {
  background: var(--bg-hover);
  color: var(--accent);
}

.sidebar-toggle i {
  font-size: 18px;
  line-height: 1;
}

.sidebar.collapsed .sidebar-toggle {
  position: static;
  display: flex;
  margin: 0 auto;
}

.user-info {
  padding: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 12px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.user-info .name {
  font-size: 14px;
  font-weight: 500;
}

.user-info .meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.app-copyright {
  margin: 12px 0 0;
  text-align: center;
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.3px;
  line-height: 1.4;
  opacity: 0.85;
}

.login-copyright {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 24px;
  margin: 0;
  z-index: 1;
}

.main-content {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.topbar {
  padding: 16px 32px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-secondary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
}

.topbar h3 {
  font-size: 16px;
  font-weight: 500;
  flex-shrink: 0;
}

.topbar-brand {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  text-align: right;
  min-width: 0;
}

.topbar-brand-main {
  font-size: 13px;
  color: var(--accent);
  letter-spacing: 1.5px;
  white-space: nowrap;
}

.topbar-brand-sub {
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: min(420px, 55vw);
}

.page-content {
  flex: 1;
  min-height: 0;
  padding: 28px 32px;
  overflow-x: hidden;
  overflow-y: auto;
}

/* Cards & Tables */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
}

.table-wrap .col-export {
  width: 44px;
  text-align: center;
  vertical-align: middle;
}

.table-wrap .col-export input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
  vertical-align: middle;
}

.table-wrap .col-export input[type="checkbox"]:disabled {
  cursor: not-allowed;
  opacity: 0.35;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.card-header h4 {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-primary);
}

.card-header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.toolbar .btn {
  width: auto;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  padding: 8px 12px;
  text-align: left;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
}

th {
  color: var(--text-secondary);
  font-weight: 500;
  background: var(--bg-secondary);
  white-space: nowrap;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

td {
  color: var(--text-primary);
}

tr:hover td {
  background: var(--bg-hover);
}

.tag {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 4px;
  font-size: 12px;
  background: var(--accent-dim);
  color: var(--accent);
}

.tag-admin { background: rgba(200, 164, 92, 0.2); color: var(--accent); }
.tag-dept { background: rgba(100, 149, 237, 0.15); color: #7eb8f0; }
.tag-pm { background: rgba(76, 175, 130, 0.15); color: var(--success); }
.tag-pl { background: rgba(200, 164, 92, 0.18); color: var(--accent); }
.tag-staff { background: rgba(152, 152, 176, 0.15); color: var(--text-secondary); }

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.25s;
}

.modal-overlay.show {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  width: 90%;
  max-width: 640px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow);
  transform: translateY(20px);
  transition: transform 0.25s;
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
}

.modal-overlay.show .modal {
  transform: translateY(0);
}

.modal-lg {
  max-width: 860px;
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 {
  font-size: 16px;
  font-weight: 500;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
}

.modal-close:hover {
  color: var(--text-primary);
}

.modal-body {
  padding: 24px;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.modal-footer .btn {
  width: auto;
  height: 36px;
  padding: 0 16px;
  font-size: 13px;
  box-sizing: border-box;
  line-height: 1;
}

/* Toast */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 12px 20px;
  border-radius: var(--radius);
  font-size: 13px;
  box-shadow: var(--shadow);
  animation: slideIn 0.3s ease;
  max-width: 360px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.toast-success {
  background: var(--success-dim);
  border: 1px solid rgba(76, 175, 130, 0.3);
  color: var(--success);
}

.toast-error {
  background: var(--danger-dim);
  border: 1px solid rgba(224, 85, 85, 0.3);
  color: var(--danger);
}

.toast-info {
  background: var(--accent-dim);
  border: 1px solid rgba(200, 164, 92, 0.3);
  color: var(--accent);
}

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* Filter bar */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.filter-bar-tools {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.filter-bar-export {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.export-format-group {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-secondary);
}

.export-format-option {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}

.export-format-option input[type="radio"] {
  margin: 0;
  accent-color: var(--accent);
}

.filter-bar .form-control {
  width: auto;
  min-width: 100px;
}

.filter-bar .export-format-group {
  height: 36px;
  padding: 0 10px;
  box-sizing: border-box;
}

.period-lock-badge {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: #e8a0a0;
  background: var(--danger-dim);
  border: 1px solid rgba(224, 85, 85, 0.35);
}

.period-lock-badge.hidden {
  display: none;
}

.card-header .period-lock-badge {
  margin-left: 8px;
  vertical-align: middle;
}

/* Project assignment */
.project-month-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-top: 16px;
}

.month-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  cursor: pointer;
  transition: all 0.2s;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.month-card:hover {
  border-color: var(--border-light);
}

.month-card.has-data {
  border-color: rgba(200, 164, 92, 0.4);
}

.month-card.is-half-year {
  border-style: dashed;
  background: rgba(200, 164, 92, 0.06);
}

.month-card.is-half-year .month-label {
  color: var(--accent);
}

.month-card .month-label {
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 4px;
}

.month-card .project-name {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.month-card .project-members {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.project-copy-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.project-copy-row .form-control {
  flex: 1;
  min-width: 0;
}

.member-list-head,
.member-item {
  display: grid;
  grid-template-columns: 88px 1fr 1fr 72px 72px 36px;
  gap: 8px;
  align-items: center;
}

.member-list-head {
  margin-top: 8px;
  padding: 0 0 6px;
  font-size: 12px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

.member-list {
  margin-top: 0;
}

.member-item {
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
}

.member-item:last-child {
  border-bottom: none;
}

.member-item .member-duty,
.member-item .member-coef {
  padding-left: 8px;
  padding-right: 8px;
}

/* Eval table */
.eval-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.eval-table th,
.eval-table td {
  border: 1px solid var(--border);
  padding: 10px 12px;
  vertical-align: top;
}

.eval-table th {
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-weight: 500;
  white-space: nowrap;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.eval-table .col-category { width: 90px; }
.eval-table .col-category-ratio { width: 60px; text-align: center; }
.eval-table .col-indicator { width: 110px; }
.eval-table .col-weight { width: 60px; text-align: center; }
.eval-table .col-benchmark { min-width: 200px; }
.eval-table .col-rating { width: 80px; }
.eval-table .col-points { width: 90px; text-align: center; }

.eval-table .benchmark-text {
  font-size: inherit;
  color: var(--text-secondary);
  line-height: 1.7;
  white-space: pre-wrap;
}

.eval-table .rating-input {
  width: 70px;
  padding: 6px 8px;
  text-align: center;
}

input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.eval-table .points-cell {
  color: var(--accent);
  font-weight: 600;
}

.eval-table .formula-hint {
  font-size: 11px;
  color: var(--text-muted);
  display: block;
  margin-top: 2px;
}

.eval-table tbody tr:hover td {
  background: var(--bg-hover);
}

/* Eval items editor */
.eval-item-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.eval-item-card .card-top {
  display: grid;
  grid-template-columns: 1fr 80px 1fr 80px 40px;
  gap: 10px;
  align-items: start;
  margin-bottom: 10px;
}

.eval-item-card .form-control {
  padding: 8px 10px;
  font-size: 13px;
}

.eval-item-card .field-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

/* Yearly summary */
.year-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.summary-month {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.summary-month:hover {
  border-color: var(--accent);
}

.summary-month.has-data {
  border-color: rgba(200, 164, 92, 0.4);
}

.summary-month .score {
  font-size: 24px;
  font-weight: 600;
  color: var(--accent);
  margin: 8px 0;
}

.summary-month .month-name {
  font-size: 13px;
  color: var(--text-secondary);
}

.summary-month .no-data {
  font-size: 13px;
  color: var(--text-muted);
  padding: 12px 0;
}

.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-muted);
}

.empty-state .icon {
  font-size: 40px;
  margin-bottom: 12px;
  opacity: 0.5;
}

.score-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  background: var(--accent-dim);
  color: var(--accent);
}

.action-link {
  color: var(--accent);
  cursor: pointer;
  font-size: 13px;
  border: none;
  background: none;
  font-family: var(--font);
}

.action-link:hover {
  text-decoration: underline;
}

.action-link-danger {
  color: var(--danger);
}

.action-link-danger:hover {
  color: #ff6b6b;
}

.eval-name-cell .eval-name-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.eval-name-cell .eval-name-wrap.is-member {
  padding-left: 8px;
}

.eval-tree-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: 36px;
  height: 22px;
  padding: 0 6px;
  border: 1px solid rgba(200, 164, 92, 0.35);
  border-radius: 6px;
  background: var(--accent-dim);
  color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
}

.eval-tree-toggle:hover {
  background: rgba(200, 164, 92, 0.28);
  border-color: var(--accent);
}

.eval-tree-toggle i {
  font-size: 15px;
  line-height: 1;
}

.eval-tree-count {
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  min-width: 10px;
  text-align: center;
}

.eval-tree-spacer {
  display: inline-block;
  width: 36px;
  flex-shrink: 0;
}

.eval-tree-branch {
  position: relative;
  display: inline-block;
  width: 18px;
  height: 16px;
  flex-shrink: 0;
  margin-left: 10px;
}

.eval-tree-branch::before {
  content: '';
  position: absolute;
  left: 6px;
  top: -8px;
  bottom: 50%;
  width: 0;
  border-left: 1px solid rgba(200, 164, 92, 0.45);
}

.eval-tree-branch::after {
  content: '';
  position: absolute;
  left: 6px;
  top: 50%;
  width: 10px;
  height: 0;
  border-top: 1px solid rgba(200, 164, 92, 0.45);
}

.eval-member-mark {
  display: inline-flex;
  align-items: center;
  height: 18px;
  padding: 0 6px;
  border-radius: 4px;
  font-size: 10px;
  letter-spacing: 0.5px;
  color: var(--accent);
  background: var(--accent-dim);
  border: 1px solid rgba(200, 164, 92, 0.25);
  flex-shrink: 0;
}

.eval-member-row td {
  background: rgba(200, 164, 92, 0.04);
}

.eval-member-row td:first-child {
  box-shadow: inset 3px 0 0 var(--accent);
}

.eval-member-row .eval-name-text {
  color: var(--text-secondary);
}

.eval-member-row.is-collapsed {
  display: none;
}

.eval-pm-row .eval-name-text {
  font-weight: 600;
}

.divider {
  height: 1px;
  background: var(--border);
  margin: 20px 0;
}

.section-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 12px;
  letter-spacing: 0.5px;
}

.json-input-area {
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 12px;
  min-height: 160px;
}

.weight-total {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 8px;
}

.weight-total.warn {
  color: var(--danger);
}

/* Anti-screenshot watermark */
.page-watermark {
  position: fixed;
  inset: 0;
  z-index: 1500;
  pointer-events: none;
  user-select: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='320' height='240'%3E%3Ctext x='160' y='120' fill='rgba(255,255,255,0.028)' font-size='20' font-family='Segoe UI,Microsoft YaHei,sans-serif' text-anchor='middle' dominant-baseline='middle' transform='rotate(-45 160 120)'%3ENewtouch%3C/text%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 320px 240px;
}

.hidden {
  display: none !important;
}

/* Home dashboard */
.home-page {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.home-welcome {
  background: linear-gradient(135deg, rgba(200, 164, 92, 0.12) 0%, var(--bg-card) 55%);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 22px 24px;
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
}

.home-welcome-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.home-welcome-greet {
  font-size: 18px;
  font-weight: 500;
  letter-spacing: 0.5px;
}

.home-welcome-quote {
  margin-top: 10px;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
  max-width: 640px;
}

.home-welcome-quote::before {
  content: '「';
  color: var(--accent);
  margin-right: 2px;
}

.home-welcome-quote::after {
  content: '」';
  color: var(--accent);
  margin-left: 2px;
}

.home-welcome-date {
  margin-top: 8px;
  font-size: 13px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.home-day-status {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  border: 1px solid var(--border);
  background: var(--bg-secondary);
}

.home-day-status.is-rest {
  color: #e88888;
  border-color: rgba(224, 85, 85, 0.35);
  background: rgba(224, 85, 85, 0.12);
}

.home-day-status.is-work {
  color: var(--accent);
  border-color: rgba(200, 164, 92, 0.4);
  background: var(--accent-dim);
}

.home-welcome-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.home-welcome-notify {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.home-welcome-notify-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.home-welcome-notify-title {
  font-size: 14px;
  font-weight: 500;
  margin: 0;
}

.home-welcome-notify-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.home-notify-filter {
  width: auto;
  min-width: 88px;
}

.home-welcome-notify-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.home-welcome-notify-list.is-collapsed {
  max-height: none;
}

.notify-item {
  padding: 10px 12px;
  background: var(--bg-secondary);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.notify-item.is-urgent {
  border-color: rgba(224, 85, 85, 0.4);
  background: rgba(224, 85, 85, 0.08);
}

.notify-item.is-important {
  border-color: rgba(200, 164, 92, 0.4);
  background: rgba(200, 164, 92, 0.08);
}

.notify-item-top {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.notify-title {
  flex: 1;
  font-size: 13px;
  font-weight: 500;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.notify-level {
  flex-shrink: 0;
  font-size: 11px;
  padding: 1px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.notify-level.is-urgent {
  color: #e88888;
  border-color: rgba(224, 85, 85, 0.4);
  background: rgba(224, 85, 85, 0.12);
}

.notify-level.is-important {
  color: var(--accent);
  border-color: rgba(200, 164, 92, 0.4);
  background: var(--accent-dim);
}

.notify-time {
  flex-shrink: 0;
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}

.notify-item-top .notify-del {
  flex-shrink: 0;
}

.notify-body {
  margin-top: 6px;
  font-size: 13px;
  color: var(--text-secondary);
  white-space: pre-wrap;
  word-break: break-word;
}

.home-grid {
  display: grid;
  grid-template-columns: 1.45fr 1fr;
  gap: 20px;
  align-items: start;
}

.home-side {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
}

.home-calendar-panel { min-width: 0; }
.home-todo-panel,
.home-eval-panel { min-width: 0; }

.home-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px 22px;
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
}

.home-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.home-panel-header-stack {
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
}

.home-panel-header-stack .btn {
  align-self: flex-start;
}

.home-panel-header h4 {
  font-size: 15px;
  font-weight: 500;
  margin: 0;
}

.home-subhead {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 16px 0 10px;
  font-weight: 500;
}

.home-eval-period {
  font-size: 13px;
  color: var(--text-secondary);
  margin: -6px 0 14px;
}

.home-eval-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.home-stat {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 10px;
  text-align: center;
}

.home-stat-num {
  font-size: 22px;
  font-weight: 600;
  line-height: 1.2;
  color: var(--text-primary);
}

.home-stat.is-warn .home-stat-num {
  color: var(--accent);
}

.home-stat-label {
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-muted);
}

.home-eval-meta {
  margin-top: 14px;
  font-size: 13px;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.home-eval-hint {
  color: var(--text-muted);
  font-size: 12px;
}

.home-month-holidays {
  border-top: 1px solid var(--border);
  margin-top: 8px;
  padding-top: 4px;
}

.month-holiday-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.month-holiday-item {
  display: grid;
  grid-template-columns: 28px 72px 1fr;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  border-radius: var(--radius);
  background: var(--bg-secondary);
  font-size: 13px;
}

.month-holiday-item.is-holiday {
  border-left: 2px solid rgba(224, 85, 85, 0.55);
}

.month-holiday-item.is-workday {
  border-left: 2px solid rgba(200, 164, 92, 0.55);
}

.mh-badge {
  font-size: 11px;
  text-align: center;
  padding: 2px 0;
  border-radius: 3px;
}

.month-holiday-item.is-holiday .mh-badge {
  background: var(--danger-dim);
  color: #e88888;
}

.month-holiday-item.is-workday .mh-badge {
  background: var(--accent-dim);
  color: var(--accent);
}

.mh-date {
  color: var(--text-secondary);
}

.mh-name {
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.home-cal-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.home-cal-year,
.home-cal-month {
  width: auto;
  min-width: 88px;
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}

.cal-weekday {
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  padding: 4px 0 8px;
}

.cal-cell {
  min-height: 84px;
  padding: 8px;
  border-radius: var(--radius);
  background: var(--bg-secondary);
  border: 1px solid transparent;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 2px;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.cal-cell.cal-empty {
  background: transparent;
  min-height: 0;
  cursor: default;
}

.cal-cell.is-rest {
  background: rgba(224, 85, 85, 0.08);
}

.cal-cell.is-holiday {
  background: rgba(224, 85, 85, 0.16);
  border-color: rgba(224, 85, 85, 0.35);
}

.cal-cell.is-workday {
  background: var(--accent-dim);
  border-color: rgba(200, 164, 92, 0.4);
}

.cal-cell.is-today {
  box-shadow: inset 0 0 0 1px var(--accent);
}

.cal-cell.is-selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.cal-cell.has-todo .cal-day-num::after {
  content: '';
  display: inline-block;
  width: 5px;
  height: 5px;
  margin-left: 4px;
  border-radius: 50%;
  background: #6ea8ff;
  vertical-align: middle;
}

.cal-day-num {
  font-size: 13px;
  font-weight: 500;
}

.cal-cell.is-rest .cal-day-num {
  color: #e88888;
}

.cal-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  font-size: 10px;
  line-height: 1;
  padding: 2px 4px;
  border-radius: 3px;
  background: var(--danger-dim);
  color: #e88888;
}

.cal-cell.is-workday .cal-badge {
  background: var(--accent-dim);
  color: var(--accent);
}

.cal-day-name {
  font-size: 10px;
  color: var(--text-muted);
  line-height: 1.3;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  margin-top: auto;
}

.cal-todos {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
  align-items: flex-start;
}

.cal-todo-count {
  font-size: 10px;
  line-height: 1.2;
  border-radius: 3px;
  padding: 1px 5px;
  white-space: nowrap;
}

.cal-todo-count.is-pending {
  color: #9ec1ff;
  background: rgba(110, 168, 255, 0.14);
}

.cal-todo-count.is-done {
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.06);
}

.todo-date-hint {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 400;
}

.home-cal-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 14px;
  font-size: 12px;
  color: var(--text-secondary);
}

.home-cal-legend .leg {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 3px;
  margin-right: 6px;
  vertical-align: -2px;
}

.leg-rest { background: rgba(224, 85, 85, 0.08); border: 1px solid rgba(224, 85, 85, 0.25); }
.leg-holiday { background: rgba(224, 85, 85, 0.16); border: 1px solid rgba(224, 85, 85, 0.35); }
.leg-work { background: var(--accent-dim); border: 1px solid rgba(200, 164, 92, 0.4); }
.leg-todo { background: rgba(110, 168, 255, 0.35); border: 1px solid rgba(110, 168, 255, 0.55); }
.leg-today { background: transparent; box-shadow: inset 0 0 0 1px var(--accent); }

.todo-add-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.todo-add-row .form-control {
  width: 100%;
}

.todo-add-row .btn {
  align-self: flex-end;
  width: auto;
}

.todo-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 280px;
  overflow-y: auto;
}

.todo-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: var(--bg-secondary);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.todo-check {
  flex: 1;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  font-size: 13px;
  min-width: 0;
}

.todo-check input {
  margin-top: 3px;
  flex-shrink: 0;
}

.todo-check span {
  word-break: break-word;
}

.todo-item.is-done .todo-check span {
  color: var(--text-muted);
  text-decoration: line-through;
}

.home-empty {
  padding: 24px 12px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

.home-empty-sm {
  padding: 10px 4px;
}

/* Holiday management */
.holiday-day-head,
.holiday-day-row {
  display: grid;
  grid-template-columns: 160px 110px 1fr 36px;
  gap: 8px;
  align-items: center;
}

.holiday-day-head {
  font-size: 12px;
  color: var(--text-muted);
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}

.holiday-day-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 360px;
  overflow-y: auto;
}

.holiday-day-row {
  padding: 4px 0;
}

/* Monthly reports */
.mr-settings-summary {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
}

.mr-stats-modal {
  max-width: 980px;
}

.mr-stats-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.mr-stats-toolbar label {
  font-size: 13px;
  color: var(--text-secondary);
}

.mr-stats-toolbar .form-control {
  width: auto;
  min-width: 110px;
}

.mr-stats-hint {
  font-size: 12px;
  color: var(--text-muted);
}

.mr-stats-section {
  margin-bottom: 22px;
}

.mr-stats-section-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.mr-stats-section-desc {
  font-size: 12px;
  color: var(--text-muted);
  margin: 0 0 12px;
}

.mr-stats-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
}

.mr-stats-card {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-secondary);
}

.mr-stats-card-label {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.mr-stats-card-value {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.2;
}

.mr-stats-card-value span {
  font-size: 12px;
  font-weight: 400;
  color: var(--text-muted);
  margin-left: 4px;
}

.mr-stats-warn,
.mr-stats-card-value.mr-stats-warn {
  color: var(--accent);
  font-weight: 600;
}

.mr-stats-card-value.mr-stats-warn span {
  color: var(--accent);
  opacity: 0.75;
}

.mr-stats-table td.mr-stats-warn {
  color: var(--accent);
  font-weight: 600;
}

.mr-stats-warn-diff,
.mr-stats-card-value.mr-stats-warn-diff {
  color: var(--danger);
  font-weight: 600;
}

.mr-stats-card-value.mr-stats-warn-diff span {
  color: var(--danger);
  opacity: 0.75;
}

.mr-stats-table td.mr-stats-warn-diff {
  color: var(--danger);
  font-weight: 600;
}

.mr-stats-card-tip {
  margin-top: 6px;
  font-size: 11px;
  color: var(--text-muted);
}

.mr-stats-customer {
  margin-bottom: 18px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.mr-stats-customer:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

.mr-stats-customer-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
  margin: 0 0 12px;
  padding-left: 4px;
}

.mr-stats-project {
  margin: 0 0 16px 28px;
}

.mr-stats-project-title {
  font-size: 13px;
  color: var(--text-primary);
  margin-bottom: 8px;
  font-weight: 500;
  padding-left: 4px;
}

.mr-stats-table {
  width: 100%;
  font-size: 13px;
  border-collapse: collapse;
}

.mr-stats-table th,
.mr-stats-table td {
  padding: 8px 12px;
  border: 1px solid var(--border);
  white-space: nowrap;
  text-align: right;
}

.mr-stats-table th:first-child,
.mr-stats-table td:first-child {
  text-align: left;
}

.mr-stats-table thead th {
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-weight: 500;
}

.mr-stats-subtotal td {
  background: rgba(200, 164, 92, 0.08);
  font-weight: 600;
  color: var(--text-primary);
}

.mr-card .table-wrap {
  max-height: calc(100vh - 220px);
}

.mr-table {
  border-collapse: collapse;
  font-size: 13px;
  min-width: 100%;
}

.mr-table th,
.mr-table td {
  border: 1px solid var(--border);
  padding: 8px 12px;
  white-space: nowrap;
  vertical-align: middle;
  background: transparent;
}

.mr-table thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: var(--bg-secondary);
  font-weight: 500;
  color: var(--text-secondary);
}

.mr-table thead tr:nth-child(2) th {
  top: 37px;
}

.mr-sum-group,
.mr-sum-col {
  background: rgba(200, 164, 92, 0.08) !important;
}

.mr-day-group.is-rest-day,
.mr-day-col.is-rest-day,
td.mr-day-col.is-rest-day {
  background: rgba(224, 85, 85, 0.1) !important;
}

.mr-input {
  width: 52px;
  padding: 6px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-primary);
  font-size: 12px;
  font-family: var(--font);
  text-align: left;
}

.mr-input:focus {
  outline: none;
  border-color: var(--accent);
}

.mr-owner-row .eval-name-text {
  font-weight: 600;
}

.mr-member-row .eval-name-text {
  color: var(--text-secondary);
  font-weight: 400;
}

.mr-member-row.is-collapsed {
  display: none;
}

.mr-name-cell .eval-name-wrap {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.mr-name-cell .eval-name-wrap.is-member {
  padding-left: 8px;
}

@media (max-width: 768px) {
  .sidebar { width: 200px; }
  .sidebar.collapsed { width: 64px; }
  .form-row { grid-template-columns: 1fr; }
  .project-month-grid { grid-template-columns: repeat(3, 1fr); }
  .year-summary-grid { grid-template-columns: repeat(3, 1fr); }
  .eval-item-card .card-top { grid-template-columns: 1fr; }
  .home-grid {
    grid-template-columns: 1fr;
  }
  .topbar-brand-sub {
    max-width: 42vw;
  }
  .holiday-day-head,
  .holiday-day-row {
    grid-template-columns: 1fr 1fr;
  }
  .holiday-day-head span:nth-child(3),
  .holiday-day-head span:nth-child(4) {
    display: none;
  }
}
