@font-face { font-family: 'Pretendard'; src: url('../fonts/Pretendard-Regular.otf') format('opentype'); font-weight: 400; font-style: normal; }
@font-face { font-family: 'Pretendard'; src: url('../fonts/Pretendard-Medium.otf') format('opentype'); font-weight: 500; font-style: normal; }
@font-face { font-family: 'Pretendard'; src: url('../fonts/Pretendard-SemiBold.otf') format('opentype'); font-weight: 600; font-style: normal; }
@font-face { font-family: 'Pretendard'; src: url('../fonts/Pretendard-Bold.otf') format('opentype'); font-weight: 700; font-style: normal; }

:root {
  --font-family: 'Pretendard', 'Noto Sans CJK KR', 'Noto Sans KR', system-ui, sans-serif;

  --bg-page: #f0eee9;
  --bg-surface: #ffffff;
  --bg-subtle: oklch(97.5% 0.003 90);
  --bg-input: oklch(98% 0.002 90);

  --border-default: oklch(91% 0.005 90);
  --border-strong: oklch(88% 0.006 90);
  --border-dashed: oklch(82% 0.008 90);

  --text-primary: oklch(20% 0.02 250);
  --text-secondary: oklch(45% 0.02 90);
  --text-tertiary: oklch(60% 0.01 90);

  --accent-navy: oklch(45% 0.09 250);
  --sidebar-navy: oklch(20% 0.02 250);
  --sidebar-navy-active: oklch(30% 0.05 250);

  --status-wait-bg: oklch(96% 0.004 90);
  --status-wait-text: oklch(42% 0.01 90);

  --status-assigned-bg: #ffffff;
  --status-assigned-text: oklch(28% 0.02 250);
  --status-assigned-border: oklch(80% 0.01 250);

  --status-working-bg: oklch(93% 0.05 220);
  --status-working-text: oklch(38% 0.09 220);

  --status-done-bg: oklch(38% 0.015 250);
  --status-done-text: #ffffff;

  --status-cancelled-bg: oklch(16% 0.01 250);
  --status-cancelled-text: #ffffff;

  --pill-paid-bg: oklch(94% 0.06 150);
  --pill-paid-text: oklch(36% 0.09 150);

  --danger: oklch(50% 0.15 25);

  --radius-lg: 14px;
  --radius-md: 10px;
  --radius-sm: 7px;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  background: var(--bg-page);
  color: var(--text-primary);
  font-family: var(--font-family);
  font-size: 14px;
  line-height: 1.6;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
}

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

/* ---------- Sidebar ---------- */
.sidebar {
  width: 232px; flex-shrink: 0; background: var(--sidebar-navy);
  display: flex; flex-direction: column; padding: 22px 14px;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 9px; color: #fff; font-weight: 700;
  font-size: 15px; letter-spacing: -0.01em; padding: 6px 10px 22px; text-decoration: none;
}
.sidebar-mark { width: 22px; height: 22px; border-radius: 6px; background: var(--accent-navy); flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.sidebar-mark svg { width: 13px; height: 13px; }
.sidebar-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.sidebar-link {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--radius-sm);
  color: oklch(78% 0.01 250); text-decoration: none; font-size: 13.5px; font-weight: 500;
}
.sidebar-link .dot { width: 5px; height: 5px; border-radius: 999px; background: currentColor; opacity: .7; }
.sidebar-link.active { background: var(--sidebar-navy-active); color: #fff; font-weight: 600; }
.sidebar-link.disabled { color: oklch(45% 0.01 250); cursor: default; }
.sidebar-link.disabled .tag { margin-left: auto; font-size: 10px; background: oklch(30% 0.02 250); color: oklch(65% 0.01 250); padding: 2px 6px; border-radius: 999px; }
.sidebar-foot { border-top: 1px solid oklch(30% 0.02 250); padding-top: 14px; margin-top: 10px; display: flex; align-items: center; gap: 10px; padding-left: 10px; }
.sidebar-avatar { width: 30px; height: 30px; border-radius: 999px; background: var(--accent-navy); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 12.5px; font-weight: 700; flex-shrink: 0; }
.sidebar-user-name { color: #fff; font-size: 13px; font-weight: 600; }
.sidebar-user-role { color: oklch(65% 0.01 250); font-size: 11.5px; }
.sidebar-logout { margin-left: auto; color: oklch(60% 0.01 250); font-size: 11.5px; text-decoration: none; }

/* ---------- Mobile top bar (hidden on desktop) ---------- */
.mobile-topbar { display: none; }
.mobile-nav { display: none; }

/* ---------- Main content ---------- */
.main { flex: 1; min-width: 0; }
.content { max-width: 1200px; margin: 0 auto; padding: 34px 40px 80px; }
.breadcrumb { color: var(--text-tertiary); font-size: 12.5px; font-weight: 500; margin-bottom: 6px; }
.breadcrumb b { color: var(--text-secondary); }
.page-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 22px; gap: 16px; flex-wrap: wrap; }
h1 { font-size: 21px; font-weight: 700; letter-spacing: -0.015em; margin: 0; color: var(--text-primary); }
.page-sub { color: var(--text-secondary); font-size: 13px; margin-top: 5px; }
h2 { font-size: 14.5px; font-weight: 700; margin: 0 0 15px; color: var(--text-primary); }
h3 { font-size: 12.5px; font-weight: 700; color: var(--text-secondary); margin: 18px 0 8px; }
.muted { color: var(--text-secondary); }
.small { font-size: 12.5px; }
.center { text-align: center; }

/* ---------- Stat cards ---------- */
.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 22px; }
.stat-card { background: var(--bg-surface); border: 1px solid var(--border-default); border-radius: var(--radius-lg); padding: 18px 20px; }
.stat-label { display: flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--text-secondary); margin-bottom: 8px; }
.stat-label .dot { width: 6px; height: 6px; border-radius: 999px; flex-shrink: 0; }
.stat-value { font-size: 26px; font-weight: 700; color: var(--text-primary); letter-spacing: -0.02em; }
.stat-value.small-value { font-size: 19px; }

/* ---------- Mini bar chart (dashboard 월별 처리 건수) ---------- */
.bar-chart { display: flex; align-items: flex-end; gap: 14px; height: 100px; padding-top: 6px; }
.bar-chart-col { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; flex: 1; height: 100%; }
.bar-chart-bar { width: 100%; max-width: 34px; min-height: 3px; background: var(--accent-navy); border-radius: 4px 4px 0 0; }
.bar-chart-value { font-size: 11.5px; font-weight: 700; color: var(--text-primary); margin-top: 6px; }
.bar-chart-label { font-size: 11px; color: var(--text-tertiary); margin-top: 2px; }

/* ---------- Card ---------- */
.card { background: var(--bg-surface); border: 1px solid var(--border-default); border-radius: var(--radius-lg); padding: 24px 26px; }
.form-card { background: var(--bg-surface); border: 1px solid var(--border-default); border-radius: var(--radius-lg); padding: 24px 26px; }

/* ---------- Flash ---------- */
.flash { padding: 11px 15px; border-radius: var(--radius-md); margin-bottom: 16px; font-size: 13px; font-weight: 500; }
.flash-success { background: var(--status-assigned-bg); color: var(--status-assigned-text); }
.flash-error { background: oklch(93% 0.04 25); color: var(--danger); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 9px 16px; border-radius: var(--radius-md);
  background: var(--bg-surface); border: 1px solid var(--border-strong); color: var(--text-primary);
  font-size: 13px; font-weight: 600; text-decoration: none; cursor: pointer; font-family: inherit;
}
.btn:hover { background: var(--bg-subtle); }
.btn-primary { background: var(--accent-navy); color: #fff; border-color: var(--accent-navy); }
.btn-primary:hover { opacity: .92; }
.btn-dark { background: var(--sidebar-navy); color: #fff; border-color: var(--sidebar-navy); }
.btn-sm { padding: 7px 13px; font-size: 12.5px; }
.btn-block { width: 100%; justify-content: center; padding: 11px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.link-btn { color: var(--accent-navy); background: none; border: none; font-size: 12.5px; font-weight: 600; cursor: pointer; padding: 0; text-decoration: none; font-family: inherit; }
.link-btn.danger { color: var(--danger); }
.back-link { color: var(--text-secondary); text-decoration: none; font-size: 12.5px; font-weight: 600; display: inline-flex; align-items: center; gap: 4px; margin-bottom: 14px; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 22px; border-bottom: 1px solid var(--border-default); margin-bottom: 18px; }
.tab { padding: 0 0 11px; text-decoration: none; color: var(--text-tertiary); font-size: 13.5px; font-weight: 600; border-bottom: 2px solid transparent; }
.tab.active { color: var(--text-primary); border-bottom-color: var(--accent-navy); }

/* ---------- Toolbar ---------- */
.toolbar { display: flex; gap: 9px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar input[type=text], .toolbar input[type=date] { width: auto; padding: 9px 13px; border: 1px solid var(--border-default); border-radius: var(--radius-md); min-width: 150px; font-size: 13px; background: var(--bg-input); font-family: inherit; }
.toolbar input[type=text] { min-width: 240px; }
.toolbar select { width: auto; padding: 9px 13px; border: 1px solid var(--border-default); border-radius: var(--radius-md); font-size: 13px; background: var(--bg-input); color: var(--text-secondary); font-family: inherit; }
.toolbar label { display: inline; margin: 0; font-weight: 600; }
.toolbar label.muted { font-size: 12.5px; font-weight: 500; }

/* ---------- Table ---------- */
.table-wrap { background: var(--bg-surface); border-radius: var(--radius-lg); overflow: hidden; border: 1px solid var(--border-default); overflow-x: auto; }
table.job-table { width: 100%; border-collapse: collapse; }
.job-table thead th { background: var(--bg-subtle); color: var(--text-secondary); text-align: left; padding: 12px 16px; font-size: 11.5px; font-weight: 700; border-bottom: 1px solid var(--border-default); white-space: nowrap; }
.job-table td { padding: 13px 16px; border-top: 1px solid var(--border-default); font-size: 13px; color: var(--text-primary); white-space: nowrap; }
.job-table tbody tr:hover { background: var(--bg-subtle); }
.job-table tbody tr.row-mine { background: oklch(97% 0.02 250 / 0.5); }
.job-table tbody tr td:first-child { font-weight: 600; }
.job-table tbody tr { cursor: pointer; }

/* ---------- Status badge ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 4px 11px; border-radius: 999px; font-size: 11.5px; font-weight: 700; white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 999px; background: currentColor; flex-shrink: 0; }
.badge-WAITING { background: var(--status-wait-bg); color: var(--status-wait-text); }
.badge-ASSIGNED { background: var(--status-assigned-bg); color: var(--status-assigned-text); border: 1px solid var(--status-assigned-border); }
.badge-IN_PROGRESS { background: var(--status-working-bg); color: var(--status-working-text); }
.badge-COMPLETED { background: var(--status-done-bg); color: var(--status-done-text); }
.badge-CANCELLED { background: var(--status-cancelled-bg); color: var(--status-cancelled-text); }

/* ---------- Auth ---------- */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg-page); padding: 20px; }
.auth-box { width: 400px; max-width: 100%; background: var(--bg-surface); padding: 40px 36px; border-radius: 18px; border: 1px solid var(--border-default); }
.auth-box h1 { font-size: 18px; text-align: center; margin-bottom: 6px; }
.auth-sub { color: var(--text-secondary); font-size: 12.5px; text-align: center; margin-bottom: 26px; line-height: 1.6; }
.ms-btn { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; padding: 11px; border-radius: var(--radius-md); border: 1px solid var(--border-strong); background: var(--bg-surface); color: var(--text-primary); font-size: 13.5px; font-weight: 600; font-family: inherit; cursor: pointer; }
.ms-icon { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5px; width: 15px; height: 15px; }
.ms-icon span:nth-child(1) { background: #F25022; } .ms-icon span:nth-child(2) { background: #7FBA00; }
.ms-icon span:nth-child(3) { background: #00A4EF; } .ms-icon span:nth-child(4) { background: #FFB900; }
.divider { display: flex; align-items: center; gap: 12px; margin: 22px 0; color: var(--text-tertiary); font-size: 12px; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border-default); }
.auth-note { margin-top: 20px; padding: 11px 14px; background: var(--bg-subtle); border: 1px solid var(--border-default); border-radius: var(--radius-md); font-size: 11.5px; color: var(--text-secondary); line-height: 1.6; }

form label { display: block; margin: 14px 0 6px; font-size: 12px; font-weight: 600; color: var(--text-secondary); }
form label:first-of-type { margin-top: 0; }
form input[type=text], form input[type=email], form input[type=password], form input[type=date], form input[type=number], form select, form textarea {
  width: 100%; padding: 10px 13px; border: 1px solid var(--border-default); border-radius: var(--radius-sm);
  font-size: 13px; font-family: inherit; background: var(--bg-input); color: var(--text-primary);
}
form input:focus, form select:focus, form textarea:focus { outline: none; border-color: var(--accent-navy); }
form input[type=file] { font-size: 12.5px; }

/* ---------- Segmented control (radio-based) ---------- */
.segmented { display: inline-flex; border: 1px solid var(--border-default); border-radius: var(--radius-md); padding: 3px; background: var(--bg-input); }
.segmented input { position: absolute; opacity: 0; width: 0; height: 0; }
.segmented label { display: inline-block; margin: 0; border: none; padding: 7px 18px; border-radius: 7px; font-size: 13px; font-weight: 600; color: var(--text-tertiary); cursor: pointer; }
.segmented input:checked + label { background: var(--sidebar-navy); color: #fff; }

/* ---------- Toggle switch (checkbox-based) ---------- */
.toggle-row { display: flex; align-items: center; gap: 9px; margin-top: 10px; }
.toggle-row input[type=checkbox] { position: absolute; opacity: 0; width: 0; height: 0; }
.toggle-track { width: 34px; height: 20px; border-radius: 999px; background: var(--border-strong); position: relative; flex-shrink: 0; cursor: pointer; transition: background .15s; }
.toggle-track::after { content: ""; position: absolute; width: 16px; height: 16px; border-radius: 999px; background: #fff; top: 2px; left: 2px; transition: left .15s; }
.toggle-row input:checked + .toggle-track { background: var(--accent-navy); }
.toggle-row input:checked + .toggle-track::after { left: 16px; }
.toggle-text { font-size: 12.5px; font-weight: 600; color: var(--text-secondary); cursor: pointer; }

.checkbox-label { display: flex; align-items: center; gap: 7px; margin-top: 28px; font-size: 13px; color: var(--text-secondary); }
.checkbox-label input { width: auto; }

/* ---------- Dropzone ---------- */
.dropzone { border: 1.5px dashed var(--border-dashed); border-radius: var(--radius-md); background: var(--bg-input); padding: 22px; text-align: center; }
.dropzone-text { font-size: 13px; color: var(--text-secondary); }
.dropzone input[type=file] { margin-top: 10px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ---------- Detail page ---------- */
.detail-layout { display: grid; grid-template-columns: 1.5fr 1fr; gap: 18px; align-items: start; }
.detail-left { display: flex; flex-direction: column; gap: 16px; }
.detail-grid { margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.detail-grid dt { font-size: 11px; font-weight: 700; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.03em; margin-top: 14px; }
.detail-grid > div:nth-child(-n+2) dt { margin-top: 0; }
.detail-grid dd { margin: 3px 0 0; font-size: 13.5px; color: var(--text-primary); }

.file-row { display: flex; justify-content: space-between; align-items: center; padding: 11px 0; border-bottom: 1px solid var(--border-default); font-size: 13px; flex-wrap: wrap; gap: 6px; }
.file-row:last-of-type { border-bottom: none; }
.file-kind { display: inline-block; font-size: 10.5px; font-weight: 700; color: var(--accent-navy); background: oklch(94% 0.03 250); padding: 2px 8px; border-radius: 999px; margin-right: 8px; }
.file-actions { display: flex; gap: 12px; }
.upload-form { margin-top: 12px; display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Comments panel ---------- */
.comments-panel { background: var(--bg-surface); border: 1px solid var(--border-default); border-radius: var(--radius-lg); display: flex; flex-direction: column; }
.comments-head { padding: 20px 22px 14px; border-bottom: 1px solid var(--border-default); }
.comments-list { padding: 4px 22px; flex: 1; }
.comment-item { padding: 14px 0; border-bottom: 1px solid var(--border-default); }
.comment-item:last-child { border-bottom: none; }
.comment-meta { display: flex; align-items: center; gap: 7px; margin-bottom: 5px; flex-wrap: wrap; }
.comment-author { font-weight: 700; font-size: 13px; }
.role-chip { font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 999px; background: var(--bg-subtle); color: var(--text-secondary); }
.comment-time { color: var(--text-tertiary); font-size: 11px; margin-left: auto; }
.comment-body { font-size: 13px; color: var(--text-primary); line-height: 1.6; white-space: pre-wrap; }
.comments-input { padding: 16px 22px 22px; border-top: 1px solid var(--border-default); }
.comments-input textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--border-default); border-radius: var(--radius-sm); font-size: 12.5px; font-family: inherit; background: var(--bg-input); resize: vertical; margin-bottom: 10px; }

/* ---------- Notification bell ---------- */
.notif-wrap { position: relative; }
.notif-btn { position: relative; display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: var(--radius-sm); color: oklch(78% 0.01 250); background: none; border: none; font-family: inherit; font-size: 13.5px; font-weight: 500; cursor: pointer; width: 100%; text-align: left; }
.notif-dot { position: absolute; top: 8px; left: 24px; width: 7px; height: 7px; border-radius: 999px; background: oklch(62% 0.19 25); border: 1.5px solid var(--sidebar-navy); }
.notif-panel { background: var(--bg-surface); border: 1px solid var(--border-default); border-radius: var(--radius-lg); padding: 6px 0; margin-top: 4px; max-height: 340px; overflow-y: auto; }
.notif-item { display: block; padding: 11px 16px; text-decoration: none; color: var(--text-primary); border-bottom: 1px solid var(--border-default); }
.notif-item:last-child { border-bottom: none; }
.notif-item .notif-title { font-size: 12.5px; font-weight: 600; margin-bottom: 2px; }
.notif-item .notif-time { font-size: 11px; color: var(--text-tertiary); }

/* ---------- Settlement table extras ---------- */
.total-row td { font-weight: 700; background: var(--bg-subtle); }
.pill-paid { background: var(--pill-paid-bg); color: var(--pill-paid-text); padding: 3px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 700; }
.pill-unpaid { background: var(--status-wait-bg); color: var(--status-wait-text); padding: 3px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 700; }

/* ---------- Responsive (Phase 4: 모바일 대응) ---------- */
@media (max-width: 860px) {
  .app { flex-direction: column; }
  .sidebar { display: none; }
  .mobile-topbar {
    display: flex; align-items: center; justify-content: space-between;
    background: var(--sidebar-navy); padding: 12px 16px; position: sticky; top: 0; z-index: 10;
  }
  .mobile-topbar .sidebar-brand { padding: 0; }
  .mobile-topbar-actions { display: flex; align-items: center; gap: 14px; }
  .mobile-topbar-actions a, .mobile-topbar-actions button { color: oklch(80% 0.01 250); font-size: 12.5px; text-decoration: none; background: none; border: none; font-family: inherit; }
  .mobile-nav { display: flex; gap: 6px; overflow-x: auto; background: var(--sidebar-navy); padding: 0 16px 12px; }
  .mobile-nav a { flex-shrink: 0; color: oklch(78% 0.01 250); text-decoration: none; font-size: 12.5px; font-weight: 600; padding: 6px 12px; border-radius: 999px; background: var(--sidebar-navy-active); }
  .mobile-nav a.active { background: var(--accent-navy); color: #fff; }
  .content { padding: 20px 16px 60px; }
  .stat-row { grid-template-columns: 1fr 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .detail-layout { grid-template-columns: 1fr; }
  .table-wrap { overflow-x: auto; }
  .job-table { min-width: 720px; }
  .page-header { flex-direction: column; align-items: stretch; }
}
