:root {
  --bg: #f3f5f8;
  --panel: #ffffff;
  --panel-soft: #f8fafc;
  --line: #dbe2ea;
  --primary: #0071ce;
  --primary-soft: #eaf3fd;
  --primary-deep: #0050a0;
  --srac-blue: #0071ce;
  --srac-dark: #1b263b;
  --srac-gray: #4a5568;
  --success: #1aa77a;
  --success-soft: #eafaf4;
  --warning: #ef8e17;
  --warning-soft: #fff4df;
  --danger: #e25a5a;
  --danger-soft: #ffe9ea;
  --text: #2d3748;
  --muted: #64748b;
  --shadow: 0 8px 20px rgba(27, 38, 59, 0.05);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  font-family: "Malgun Gothic", "Segoe UI", -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
}

button, input, select, textarea {
  font: inherit;
}

.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 260px;
  background: #1e293b;
  color: #f8fafc;
  padding: 24px 16px;
  border-right: 1px solid #334155;
  box-shadow: 4px 0 16px rgba(0, 0, 0, 0.08);
}

.brand-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 10px 8px 20px;
  border-bottom: 1px solid #334155;
  text-align: center;
}

.brand-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  background: #ffffff;
  text-decoration: none;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.brand-logo {
  width: 100%;
  max-width: 190px;
  height: auto;
  max-height: 58px;
  object-fit: contain;
  display: block;
}

.brand-name {
  display: none;
}

.brand-sub {
  color: #38bdf8;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-top: 4px;
}

.sidebar-nav {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.nav-item {
  background: transparent;
  color: #cbd5e1;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 12px 16px;
  text-align: left;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 600;
  transition: all 0.2s ease;
}

.nav-item:hover {
  background: #334155;
  color: #ffffff;
}

.nav-item.active {
  background: #0071ce;
  color: #ffffff !important;
  font-weight: 700;
  box-shadow: 0 4px 14px rgba(0, 113, 206, 0.4);
}
}

.sidebar-nav {
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nav-item {
  background: transparent;
  color: #dce8ff;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 12px 14px;
  text-align: left;
  cursor: pointer;
  transition: 0.2s ease;
}

.nav-item:hover,
.nav-item.active {
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.12);
}

.main-panel {
  flex: 1;
  padding: 20px 24px 32px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
  gap: 12px;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  width: min(480px, 100%);
  box-shadow: var(--shadow);
}

.search-box input {
  width: 100%;
  border: none;
  background: transparent;
  outline: none;
}

.topbar-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.status-pill {
  padding: 8px 12px;
  background: var(--success-soft);
  color: var(--success);
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
}

#userSelect {
  min-width: 180px;
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 12px;
  padding: 10px 12px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

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

.page-header h2 {
  margin: 0;
  font-size: 1.7rem;
}

.page-subtitle {
  color: var(--muted);
  font-size: 0.9rem;
}

.guide-copy {
  padding: 4px 8px 0;
  color: var(--text);
}

.guide-copy ul {
  margin: 0;
  padding-left: 20px;
  line-height: 1.8;
}

/* Mode Switch Group */
.mode-switch-group {
  display: inline-flex;
  background: var(--panel-soft);
  padding: 4px;
  border-radius: 12px;
  border: 1px solid var(--line);
  margin-right: 8px;
}

.mode-btn {
  border: none;
  background: transparent;
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  transition: 0.2s ease;
}

.mode-btn.active {
  background: white;
  color: var(--primary);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

/* ERP Toolbar and Controls */
.erp-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  margin-bottom: 14px;
  background: #f8fafc;
  border: 1px solid var(--line);
}

.btn-group-left, .btn-group-right {
  display: flex;
  gap: 6px;
  align-items: center;
}

.erp-btn {
  background: white;
  border: 1px solid #cbd5e1;
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 0.82rem;
  cursor: pointer;
  color: #334155;
  transition: 0.15s ease;
  user-select: none;
}

.erp-btn:hover {
  background: #0071ce;
  color: #ffffff;
  border-color: #0050a0;
  box-shadow: 0 2px 6px rgba(0, 113, 206, 0.25);
}

.erp-btn:active {
  transform: translateY(1px);
}

.erp-btn.primary-erp {
  background: #0071ce;
  color: white;
  border-color: #0050a0;
  font-weight: 700;
}

.erp-btn.primary-erp:hover {
  background: #0050a0;
  border-color: #003870;
}

.erp-btn.danger-erp {
  background: #ef4444;
  color: white;
  border-color: #dc2626;
  padding: 3px 8px;
  font-size: 0.78rem;
}

.erp-btn.danger-erp:hover {
  background: #dc2626;
  color: white;
}

.excel-upload-btn {
  background: #f0fdf4;
  border-color: #bbf7d0;
  color: #166534;
  font-weight: 600;
}

.erp-select {
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 5px 8px;
  background: white;
  font-size: 0.84rem;
}

/* ERP Split Container */
.erp-split-container {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 16px;
  align-items: start;
}

.erp-left-card, .erp-right-card {
  padding: 14px;
  background: white;
  border-radius: 12px;
}

.erp-table-scroll {
  max-height: 560px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.erp-daily-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.erp-daily-table th, .erp-daily-table td {
  padding: 6px 8px;
  border: 1px solid #e2e8f0;
  text-align: center;
}

.erp-daily-table th {
  background: #f1f5f9;
  color: #475569;
  position: sticky;
  top: 0;
  z-index: 2;
}

.erp-daily-table tr {
  cursor: pointer;
  transition: background 0.1s ease;
}

.erp-daily-table tr:hover {
  background: #f8fafc;
}

.sat-row {
  background-color: #f0fdf4;
  color: #166534;
}

.sun-row {
  background-color: #fef2f2;
  color: #991b1b;
}

.selected-row {
  background-color: #fef08a !important;
  font-weight: 700;
}

.day-cell {
  font-weight: 600;
}

.holiday-cell {
  color: #dc2626;
  font-size: 0.78rem;
}

.num-cell {
  text-align: right !important;
  padding-right: 10px !important;
}

.bold-cell {
  font-weight: 700;
  color: #1e3a8a;
}

/* Right Detail Card */
.detail-box-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid #e2e8f0;
  padding-bottom: 10px;
  margin-bottom: 12px;
  font-size: 0.95rem;
}

.time-spec-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

.spec-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.spec-row label {
  width: 70px;
  font-size: 0.85rem;
  font-weight: 600;
  color: #475569;
}

.date-picker-inputs {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.82rem;
}

.mini-input {
  width: 44px;
  padding: 4px 6px;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  text-align: center;
  font-size: 0.82rem;
}

.work-time-display {
  background: #e2e8f0;
  padding: 4px 12px;
  border-radius: 4px;
  font-weight: 700;
  font-size: 0.85rem;
  color: #1e293b;
}

.project-breakdown-section {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 12px;
}

.breakdown-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 700;
  font-size: 0.9rem;
  margin-bottom: 10px;
  color: #1e293b;
}

.breakdown-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.breakdown-table th, .breakdown-table td {
  padding: 6px 8px;
  border: 1px solid #e2e8f0;
}

.breakdown-table th {
  background: #f1f5f9;
  color: #475569;
}

.erp-project-select {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  padding: 4px 6px;
  font-size: 0.8rem;
}

.erp-hours-input {
  width: 50px;
  padding: 4px;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  text-align: right;
  font-weight: 600;
}

.text-center {
  text-align: center !alignment;
  text-align: center;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(170px, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.kpi-card {
  padding: 18px;
}

.kpi-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 10px;
}

.kpi-value {
  font-size: 2rem;
  font-weight: 800;
}

.kpi-meta {
  color: var(--success);
  font-size: 0.85rem;
  margin-top: 8px;
}

.warning { color: var(--warning) !important; }

.danger { color: var(--danger) !important; }

.section-grid {
  display: grid;
  grid-template-columns: 1.6fr 0.95fr;
  gap: 18px;
}

.panel {
  padding: 18px;
}

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

.panel-header h3 {
  margin: 0;
  font-size: 1.1rem;
}

.budget-row {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.bar {
  height: 10px;
  background: #edf2f7;
  border-radius: 999px;
  overflow: hidden;
}

.bar > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), #7fa8ff);
}

.metric-list {
  display: grid;
  gap: 12px;
}

.metric-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 5px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
}

.tag.active { background: var(--success-soft); color: var(--success); }
.tag.pending { background: var(--warning-soft); color: var(--warning); }
.tag.review { background: var(--primary-soft); color: var(--primary); }
.tag.danger { background: var(--danger-soft); color: var(--danger); }

.table-wrap {
  overflow: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 700px;
}

.data-table th,
.data-table td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.data-table thead th {
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 0.8rem;
  letter-spacing: 0.02em;
}

.data-table td strong {
  display: block;
  font-size: 0.94rem;
}

.action-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

button.primary,
button.secondary,
button.ghost {
  border: none;
  border-radius: 10px;
  padding: 9px 14px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s ease;
  user-select: none;
}

button.primary {
  background: var(--primary);
  color: white;
  box-shadow: 0 4px 10px rgba(0, 113, 206, 0.2);
}

button.primary:hover {
  background: var(--primary-deep);
  box-shadow: 0 6px 14px rgba(0, 113, 206, 0.3);
  transform: translateY(-1px);
}

button.primary:active {
  transform: translateY(0);
}

button.secondary {
  background: var(--primary-soft);
  color: var(--primary-deep);
  border: 1px solid rgba(0, 113, 206, 0.2);
}

button.secondary:hover {
  background: var(--primary);
  color: white;
  transform: translateY(-1px);
}

button.ghost {
  background: #eef2f7;
  color: var(--text);
  border: 1px solid var(--line);
}

button.ghost:hover {
  background: #dfe7f2;
  color: var(--primary-deep);
  transform: translateY(-1px);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(120px, 1fr));
  gap: 12px;
  margin-top: 10px;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-field input,
.form-field select,
.form-field textarea {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  background: white;
}

.form-field textarea {
  min-height: 90px;
  resize: vertical;
}

.summary-box {
  background: linear-gradient(135deg, #eef5ff, #f8fafc);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 12px;
  margin-top: 10px;
}

.week-grid {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 16px;
  margin-top: 16px;
}

.week-list {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
}

.week-option {
  width: 100%;
  text-align: left;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 8px;
  cursor: pointer;
}

.week-option.active {
  background: var(--primary-soft);
  border-color: rgba(30,94,255,0.25);
  color: var(--primary-deep);
  font-weight: 700;
}

.time-table {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}

.day-sub-date {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--muted);
  display: inline-block;
  margin-top: 2px;
}

.time-table table {
  width: 100%;
  border-collapse: collapse;
}

.time-table th,
.time-table td {
  border-bottom: 1px solid var(--line);
  padding: 10px 8px;
  text-align: center;
}

.time-table th:first-child,
.time-table td:first-child {
  text-align: left;
  padding-left: 16px;
}

.time-input {
  width: 56px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 8px;
  text-align: center;
}

.inline-note {
  color: var(--muted);
  font-size: 0.8rem;
}

.mini-card-list {
  display: grid;
  gap: 12px;
}

.mini-card {
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--panel-soft);
  border: 1px solid var(--line);
}

.mini-card strong {
  display: block;
  margin-bottom: 4px;
}

.empty-state {
  padding: 18px;
  text-align: center;
  color: var(--muted);
  background: var(--panel-soft);
  border: 1px dashed var(--line);
  border-radius: 12px;
}

@media (max-width: 980px) {
  .app-shell { flex-direction: column; }
  .sidebar { width: 100%; }
  .section-grid, .week-grid { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(160px, 1fr)); }
}

@media (max-width: 560px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .topbar { flex-direction: column; align-items: stretch; }
  .topbar-group.right { justify-content: space-between; }
}

/* 연간집계표 인쇄/PDF 저장: 사이드바·검색창·버튼 등 화면 UI는 감추고 집계표만 가로방향으로 인쇄한다 */
@media print {
  @page {
    size: landscape;
    margin: 12mm;
  }

  body * {
    visibility: hidden;
  }

  #printableAnnualArea,
  #printableAnnualArea * {
    visibility: visible;
  }

  #printableAnnualArea {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    box-shadow: none;
    border: none;
    padding: 0;
  }

  .sidebar,
  .topbar,
  #view-annual-report .page-header,
  #view-annual-report .action-row {
    display: none !important;
  }
}
