:root {
    --bg: #f5f7fb;
    --panel: #ffffff;
    --text: #162033;
    --muted: #7a8699;
    --line: #e6eaf0;
    --primary: #2563eb;
    --primary-dark: #1e40af;
    --sidebar: #101827;
    --sidebar-muted: #93a4b8;
    --success: #16a34a;
    --danger: #dc2626;
    --radius: 18px;
  }
  
  body {
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans KR", sans-serif;
  }
  
  .app-shell {
    min-height: 100vh;
    display: flex;
  }
  
  .sidebar {
    width: 264px;
    background: linear-gradient(180deg, #0e1626, #16213a);
    color: white;
    padding: 22px 16px 24px;
    position: fixed;
    inset: 0 auto 0 0;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.16) transparent;
  }

  .sidebar::-webkit-scrollbar {
    width: 5px;
  }

  .sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.16);
    border-radius: 99px;
  }

  .brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 56px;
    padding: 0 6px 18px;
    margin-bottom: 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  }
  
  .brand-mark {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: linear-gradient(135deg, #3b82f6, #06b6d4);
    display: grid;
    place-items: center;
    font-weight: 800;
    font-size: 19px;
    box-shadow: 0 6px 14px rgba(37, 99, 235, 0.35);
    flex-shrink: 0;
  }
  
  .brand-title {
    font-weight: 800;
    letter-spacing: -0.02em;
    font-size: 15.5px;
  }
  
  .brand-subtitle {
    color: var(--sidebar-muted);
    font-size: 11.5px;
    margin-top: 1px;
  }
  
  .side-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
  }
  
  .side-nav a {
    display: flex;
    align-items: center;
    gap: 11px;
    color: #9aa8bd;
    text-decoration: none;
    padding: 9px 12px;
    border-radius: 10px;
    font-weight: 500;
    font-size: 13.5px;
    letter-spacing: -0.01em;
    line-height: 1.4;
    transition: background-color 0.13s ease, color 0.13s ease;
  }

  .side-nav .nav-ico {
    display: inline-flex;
    flex-shrink: 0;
    opacity: 0.8;
  }

  .side-nav .nav-label {
    flex: 1;
    min-width: 0;
  }
  
  .side-nav a:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #e8edf5;
  }

  .side-nav a:hover .nav-ico {
    opacity: 1;
  }
  
  .side-nav a.active {
    background: linear-gradient(135deg, var(--primary, #2563eb), var(--primary-dark, #1e40af));
    color: #fff;
    font-weight: 700;
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.35);
  }

  .side-nav a.active .nav-ico {
    opacity: 1;
  }
  
  .side-section {
    margin: 20px 12px 6px;
    color: #5d6b81;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
  }
  
  .main-panel {
    margin-left: 264px;
    flex: 1;
    min-width: 0;
  }
  
  .topbar {
    height: 84px;
    background: rgba(255,255,255,0.88);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 34px;
    position: sticky;
    top: 0;
    z-index: 20;
  }
  
  .topbar-title {
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.03em;
  }
  
  .topbar-desc {
    color: var(--muted);
    font-size: 13px;
    margin-top: 3px;
  }
  
  .user-chip {
    display: flex;
    align-items: center;
    gap: 10px;
  }

  .topbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
  }

  .topbar-actions:empty {
    display: none;
  }

  .notification-bell-btn {
    position: relative;
    min-width: 72px;
    font-weight: 700;
  }

  .notification-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    margin-left: 6px;
    padding: 0 6px;
    border-radius: 999px;
    background: #ef4444;
    color: #fff;
    font-size: 0.72rem;
    font-weight: 800;
  }

  .notification-panel {
    width: min(360px, calc(100vw - 24px));
    padding: 0;
    border: 1px solid #e2e8f0;
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.12);
  }

  .notification-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 14px;
    border-bottom: 1px solid #e2e8f0;
  }

  .notification-list {
    max-height: 360px;
    overflow-y: auto;
  }

  .notification-item {
    display: block;
    padding: 12px 14px;
    text-decoration: none;
    color: inherit;
    border-bottom: 1px solid #f1f5f9;
  }

  .notification-item:hover {
    background: #f8fafc;
  }

  .notification-item.is-unread {
    background: #eff6ff;
  }

  .notification-item-title {
    font-weight: 700;
    font-size: 0.88rem;
    margin-bottom: 2px;
  }

  .notification-item-msg {
    font-size: 0.82rem;
    color: #475569;
    line-height: 1.4;
  }

  .notification-item-time {
    font-size: 0.72rem;
    color: #94a3b8;
    margin-top: 4px;
  }

  .leave-manage-table .leave-adjust-form {
    min-width: 280px;
  }

  .leave-my-status-btn {
    border-width: 1.5px;
    font-weight: 600;
    padding: 0.35rem 0.85rem;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
  }

  .leave-doc-filter .form-label {
    display: block;
  }

  .leave-doc-table tbody tr.doc-row {
    cursor: pointer;
  }

  .leave-doc-table tbody tr.doc-row:hover {
    background: #f8fafc;
  }

  .leave-history-table td {
    vertical-align: top;
  }

  .leave-history-summary .metric-card {
    margin-bottom: 0;
  }
  
  .user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 999px;
    background: #eef4ff;
    color: var(--primary);
    display: grid;
    place-items: center;
    font-weight: 800;
  }
  
  .user-name {
    font-weight: 700;
    font-size: 14px;
  }
  
  .user-role {
    color: var(--muted);
    font-size: 12px;
  }

  .user-chip-trigger {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 10px 4px 4px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    text-align: left;
    cursor: pointer;
    transition: background 0.14s ease;
  }

  .user-chip-trigger:hover {
    background: #eef2f8;
  }

  .profile-modal-header {
    background: linear-gradient(135deg, #101827 0%, #1e2f54 55%, #2563eb 130%);
    color: #fff;
    border-bottom: 0;
  }

  .profile-modal-avatar {
    width: 46px;
    height: 46px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.22);
    color: #fff;
    display: grid;
    place-items: center;
    font-weight: 800;
    font-size: 1.1rem;
  }

  .profile-modal-role {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.75);
  }

  .profile-section-title {
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted, #7a8699);
    margin-bottom: 12px;
  }

  .profile-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 16px;
  }

  .profile-info-item {
    background: #f8fafd;
    border: 1px solid var(--line, #e6eaf0);
    border-radius: 10px;
    padding: 9px 12px;
  }

  .profile-info-item .label {
    display: block;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--muted, #7a8699);
    margin-bottom: 2px;
  }

  .profile-info-item .value {
    font-size: 0.9rem;
    font-weight: 600;
    color: #1f2937;
    word-break: break-all;
  }

  .profile-info-item.is-full {
    grid-column: 1 / -1;
  }

  @media (max-width: 480px) {
    .profile-info-grid {
      grid-template-columns: 1fr;
    }
  }
  
  .content {
    padding: 32px 34px 60px;
  }
  
  .flash-stack {
    margin-bottom: 20px;
  }
  
  .card-modern {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.05);
    padding: 24px;
  }
  
  .card-modern-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
  }
  
  .card-modern-header h5 {
    margin: 0;
    font-weight: 800;
  }
  
  .metric-card {
    background: white;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.04);
  }
  
  .metric-label {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
  }
  
  .metric-value {
    font-size: 34px;
    font-weight: 900;
    margin-top: 8px;
  }
  
  .admin-notice {
    background: linear-gradient(135deg, #2563eb, #06b6d4);
    color: white;
    border-radius: var(--radius);
    padding: 18px 22px;
    display: flex;
    align-items: center;
    gap: 16px;
  }
  
  .page-actions {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 16px;
  }

  .page-actions form {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
  }

  .page-actions form .form-label,
  .page-actions form .btn {
    white-space: nowrap;
    flex-shrink: 0;
  }

  .page-actions form .form-control[type="date"] {
    min-width: 10.5rem;
    flex-shrink: 0;
  }
  
  .form-card {
    max-width: 100%;
  }

  .form-fields-grid .form-label {
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
  }

  .form-fields-grid .form-control,
  .form-fields-grid .form-select {
    font-size: 0.9375rem;
  }

  .form-fields-grid .form-control.bg-light,
  .form-fields-grid .form-control[readonly] {
    background-color: #f8fafc !important;
    cursor: default;
  }

  .form-fields-grid textarea.form-control {
    min-height: 4.5rem;
  }
  
  .required {
    color: var(--danger);
  }
  
  .link-strong {
    color: var(--text);
    font-weight: 700;
    text-decoration: none;
  }
  
  .link-strong:hover {
    color: var(--primary);
  }
  
  /* ---- 기안 작성: 양식 선택 페이지 ---- */

  .tpl-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 26px 30px;
    margin-bottom: 18px;
    border-radius: var(--radius);
    background: linear-gradient(135deg, #101827 0%, #1e2f54 58%, #2563eb 135%);
    color: #fff;
    box-shadow: 0 14px 34px rgba(16, 24, 39, 0.18);
  }

  .tpl-hero-copy h4 {
    font-weight: 800;
    letter-spacing: -0.01em;
    margin-bottom: 5px;
  }

  .tpl-hero-copy p {
    margin: 0;
    font-size: 0.86rem;
    color: rgba(255, 255, 255, 0.72);
  }

  .tpl-hero-ai {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 11px;
    padding: 10px 20px;
    font-size: 0.88rem;
    font-weight: 700;
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(4px);
    transition: all 0.15s ease;
  }

  .tpl-hero-ai:hover {
    background: #fff;
    color: var(--primary-dark);
    border-color: #fff;
    transform: translateY(-1px);
  }

  .tpl-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 16px;
  }

  .tpl-search {
    position: relative;
    flex: 1 1 auto;
    max-width: 520px;
  }

  .tpl-search-icon {
    position: absolute;
    top: 50%;
    left: 15px;
    transform: translateY(-50%);
    color: var(--muted);
    pointer-events: none;
  }

  .tpl-search-input {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    padding: 11px 16px 11px 42px;
    font-size: 0.9rem;
    color: var(--text);
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.04);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
  }

  .tpl-search-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
  }

  .tpl-count {
    flex: 0 0 auto;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
  }

  .tpl-category-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: -4px 0 18px;
  }

  .tpl-cat-btn {
    border: 1px solid var(--line);
    background: #fff;
    color: #475569;
    border-radius: 999px;
    padding: 7px 14px;
    font-size: 0.82rem;
    font-weight: 650;
    line-height: 1.3;
    transition: all 0.14s ease;
  }

  .tpl-cat-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: #eff6ff;
  }

  .tpl-cat-btn.is-active {
    border-color: var(--primary);
    background: var(--primary);
    color: #fff;
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.22);
  }

  .template-results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(225px, 1fr));
    gap: 14px;
  }

  .template-empty {
    grid-column: 1 / -1;
  }

  .template-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: white;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 16px 16px 14px;
    text-decoration: none;
    color: var(--text);
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.04);
    transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
  }

  .template-card:hover {
    color: var(--text);
    transform: translateY(-3px);
    border-color: rgba(37, 99, 235, 0.45);
    box-shadow: 0 14px 30px rgba(15, 23, 42, 0.1);
  }

  .template-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
  }

  .template-icon {
    width: 38px;
    height: 38px;
    border-radius: 11px;
    display: grid;
    place-items: center;
    background: #eff6ff;
    color: var(--primary);
  }

  .template-version {
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--muted);
    background: #f1f4f9;
    border-radius: 999px;
    padding: 2px 9px;
  }

  /* 양식 성격별 아이콘 색상 */
  .tpl-cat-finance .template-icon { background: #fef6e7; color: #b45309; }
  .tpl-cat-trip .template-icon    { background: #f3efff; color: #6d28d9; }
  .tpl-cat-health .template-icon  { background: #fdeff2; color: #be123c; }
  .tpl-cat-leave .template-icon   { background: #e9f9ef; color: #15803d; }
  .tpl-cat-work .template-icon    { background: #e8f4fd; color: #0369a1; }

  .template-card .template-name {
    font-weight: 800;
    font-size: 0.98rem;
    letter-spacing: -0.01em;
    margin-bottom: 5px;
    line-height: 1.35;
  }

  .template-card .template-desc {
    color: var(--muted);
    font-size: 0.79rem;
    line-height: 1.5;
    margin-bottom: 14px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .template-card-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: auto;
    padding-top: 11px;
    border-top: 1px solid #f0f3f8;
  }

  .template-fields {
    font-size: 0.73rem;
    font-weight: 600;
    color: var(--muted);
  }

  .template-cta {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--primary);
    transition: gap 0.15s ease;
  }

  .template-card:hover .template-cta {
    gap: 9px;
  }

  @media (max-width: 640px) {
    .tpl-hero {
      flex-direction: column;
      align-items: flex-start;
      padding: 22px 20px;
    }

    .tpl-toolbar {
      flex-direction: column;
      align-items: stretch;
    }

    .tpl-search {
      max-width: none;
    }

    .tpl-count {
      text-align: right;
    }
  }
  
  .empty-state {
    background: white;
    border: 1px dashed #cbd5e1;
    border-radius: var(--radius);
    padding: 60px 20px;
    text-align: center;
    color: var(--muted);
  }
  
  .sticky-panel {
    position: sticky;
    top: 110px;
  }

  .ai-panel-col-collapsed {
    position: sticky;
    top: 110px;
    align-self: flex-start;
    width: auto !important;
    flex: 0 0 auto;
    max-width: none;
  }

  .ai-panel-col-collapsed .ai-verify-panel {
    padding: 10px 12px;
    min-width: 0;
  }

  .ai-panel-expand {
    position: sticky;
    top: 110px;
    white-space: nowrap;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    min-height: 120px;
    letter-spacing: 0.08em;
  }

  #draftFormLayout.ai-panel-collapsed #draftFormMain {
    max-width: 100%;
  }

  .vendor-lookup-table thead th {
    background: #1e3a5f;
    color: #fff;
    font-size: 13px;
  }

  .vendor-lookup-table tbody tr.vendor-row {
    cursor: pointer;
  }

  .vendor-lookup-group {
    min-width: 140px;
  }
  
  .ai-summary {
    display: flex;
    gap: 14px;
    background: #f8fafc;
    border-radius: 14px;
    padding: 16px;
  }
  
  .ai-score {
    width: 54px;
    height: 54px;
    border-radius: 16px;
    background: #111827;
    color: white;
    display: grid;
    place-items: center;
    font-size: 22px;
    font-weight: 900;
  }
  
  .ai-summary p {
    color: var(--muted);
    margin: 4px 0 0;
    font-size: 13px;
  }
  
  .issue-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }
  
  .issue-item {
    border: 1px solid var(--line);
    border-left-width: 5px;
    border-radius: 12px;
    padding: 12px;
    font-size: 13px;
  }
  
  .issue-critical {
    border-left-color: var(--danger);
    background: #fff7f7;
  }
  
  .issue-warning {
    border-left-color: #f59e0b;
    background: #fffbeb;
  }
  
  .issue-info {
    border-left-color: #3b82f6;
    background: #eff6ff;
  }
  
  .issue-title {
    font-weight: 800;
    margin-bottom: 4px;
  }
  
  .issue-suggestion {
    margin-top: 6px;
    color: var(--muted);
  }
  
  .dynamic-table th {
    background: #f8fafc;
    font-size: 13px;
  }
  
  .auth-body {
    min-height: 100vh;
    background:
      radial-gradient(circle at top left, rgba(37, 99, 235, 0.20), transparent 35%),
      linear-gradient(135deg, #f8fafc, #eef2ff);
  }
  
  .auth-layout {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
  }
  
  .auth-card {
    width: 100%;
    max-width: 440px;
    background: white;
    border: 1px solid var(--line);
    border-radius: 28px;
    padding: 38px;
    box-shadow: 0 24px 80px rgba(15, 23, 42, 0.12);
  }
  
  .auth-logo {
    display: inline-flex;
    padding: 10px 14px;
    border-radius: 14px;
    background: #111827;
    color: white;
    font-weight: 900;
    margin-bottom: 20px;
  }
  
  .auth-card h1 {
    font-weight: 900;
    letter-spacing: -0.04em;
  }
  
  .auth-flashes {
    position: fixed;
    top: 20px;
    width: min(440px, calc(100% - 32px));
  }

.brand-logo {
  height: 56px;
  width: auto;
  max-width: 140px;
  object-fit: contain;
  border-radius: 8px;
  flex-shrink: 0;
}

.checks-grid {
  display: grid;
  gap: 6px;
}

.check-item {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
  padding: 6px 8px;
  border-radius: 8px;
  background: #f8fafc;
}

.check-item.check-ok { background: #ecfdf5; color: #065f46; }
.check-item.check-fail { background: #fef2f2; color: #991b1b; }

.approval-timeline {
  padding-left: 1.2rem;
}

.approval-step-times {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 2px;
}

.approval-step-time {
  font-size: 0.75rem;
  color: #64748b;
  font-weight: 400;
}

.org-tree-card {
  padding: 24px;
}

.org-chart-page {
  padding: 24px;
  overflow-x: auto;
}

.org-chart-board {
  min-width: 960px;
}

.org-chart-level-root {
  display: flex;
  justify-content: center;
  margin-bottom: 8px;
}

.org-chart-level-depts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  align-items: start;
}

.org-chart-branch {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.org-chart-connector-v {
  width: 2px;
  height: 20px;
  background: #cbd5e1;
}

.org-chart-node {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 12px 14px;
  text-align: center;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.org-chart-node-root {
  min-width: 220px;
  background: linear-gradient(180deg, #eff6ff 0%, #fff 100%);
  border-color: #93c5fd;
}

.org-chart-node-dept {
  width: 100%;
  background: #f8fafc;
  border-color: #cbd5e1;
  margin-bottom: 12px;
}

.org-chart-node-team {
  background: #fff;
  border-color: #e2e8f0;
  margin-bottom: 10px;
}

.org-chart-node-member {
  text-align: left;
  padding: 10px 12px;
  background: #f8fafc;
}

.org-chart-node-icon {
  font-size: 1.1rem;
  margin-bottom: 4px;
}

.org-chart-node-title {
  font-weight: 800;
  color: #0f172a;
  line-height: 1.3;
}

.org-chart-node-meta {
  font-size: 0.78rem;
  color: #64748b;
  margin-top: 4px;
}

.org-chart-teams-grid {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.org-chart-team-block {
  width: 100%;
}

.org-chart-members {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-left: 12px;
  border-left: 2px solid #e2e8f0;
  margin-left: 10px;
}

.org-chart-member-head {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.org-chart-member-name {
  font-weight: 700;
}

.org-chart-member-meta {
  font-size: 0.78rem;
  color: #64748b;
}

.org-level-badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  color: #1d4ed8;
  background: #eff6ff;
  border: 1px solid #dbeafe;
  border-radius: 999px;
  padding: 1px 8px;
  margin-left: 4px;
  vertical-align: middle;
  font-variant-numeric: tabular-nums;
}

.side-nav .nav-count {
  flex-shrink: 0;
  font-size: 0.69rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #93a4b8;
  background: rgba(255, 255, 255, 0.07);
  border-radius: 999px;
  padding: 1px 8px;
  line-height: 1.6;
}

.side-nav a.active .nav-count {
  color: #fff;
  background: rgba(255, 255, 255, 0.2);
}

.side-nav .nav-count-alert {
  color: #fde68a;
  opacity: 1;
  font-weight: 700;
}

/* 마지막 확인 이후 새로 추가·변경된 건수(+N) 배지 */
.side-nav .nav-count-new {
  color: #fff;
  background: #ef4444;
  font-weight: 800;
  margin-right: 4px;
  animation: nav-count-new-pulse 2s ease-in-out infinite;
}

.side-nav a.active .nav-count-new {
  background: #ef4444;
  color: #fff;
}

@keyframes nav-count-new-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.45); }
  50% { box-shadow: 0 0 0 5px rgba(239, 68, 68, 0); }
}

.org-dept {
  margin-bottom: 28px;
}

.org-dept-title {
  font-size: 1.1rem;
  font-weight: 800;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.org-team {
  margin-left: 20px;
  margin-bottom: 16px;
}

.org-team-title {
  font-weight: 700;
  color: #334155;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.org-members {
  list-style: none;
  margin: 0;
  padding: 0 0 0 24px;
  border-left: 2px solid #e2e8f0;
}

.org-member {
  position: relative;
  padding: 8px 0 8px 20px;
}

.org-member-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 12px 14px;
}

.org-member-name {
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.org-member-meta {
  font-size: 0.82rem;
  color: #64748b;
}

.draft-file-picker {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.draft-file-pending-list,
.draft-file-saved-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.draft-file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fafc;
}

.draft-file-name {
  font-size: 0.92rem;
  word-break: break-all;
}

.draft-file-name a {
  color: inherit;
  text-decoration: none;
}

.draft-file-name a:hover {
  color: var(--primary, #2563eb);
  text-decoration: underline;
}

.doc-row { cursor: pointer; }
.doc-row:hover { background: #f8fafc; }
.doc-tabs .nav-link { color: #475569; }
.doc-tabs .nav-link.active { background: var(--primary, #2563eb); }

.doc-row-actions {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
  align-items: center;
}

.doc-mobile-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.doc-mobile-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 14px;
}

.doc-mobile-card:hover {
  background: #f8fafc;
}

.doc-mobile-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.doc-mobile-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 6px;
  word-break: break-word;
}

.doc-mobile-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  font-size: 0.82rem;
  color: #64748b;
  margin-bottom: 10px;
}

.doc-mobile-card .doc-row-actions {
  justify-content: stretch;
  width: 100%;
}

.doc-mobile-card .doc-row-actions .btn,
.doc-mobile-card .doc-row-actions form {
  flex: 1 1 auto;
}

.doc-mobile-card .doc-row-actions form .btn {
  width: 100%;
}
.approval-chain-text { font-family: monospace; font-size: 0.9rem; }

.attendance-today-card {
  padding: 24px;
}

.attendance-date {
  font-size: 0.9rem;
  color: #64748b;
  margin-bottom: 4px;
}

.attendance-status-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.attendance-status-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 16px;
}

.attendance-status-label {
  font-size: 0.85rem;
  color: #64748b;
  margin-bottom: 6px;
}

.attendance-status-time {
  font-size: 1.15rem;
  font-weight: 800;
  color: #0f172a;
}

.doc-chat-layout .doc-chat-panel {
  min-height: 520px;
  display: flex;
  flex-direction: column;
}

.doc-chat-index-bar {
  padding: 20px 22px;
}

.doc-chat-search-bar {
  padding: 20px 22px;
}

.doc-chat-search-form .input-group {
  max-width: 720px;
}

.doc-chat-result-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 360px;
  overflow-y: auto;
}

.doc-chat-result-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 12px 14px;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.doc-chat-result-item:hover {
  border-color: #cbd5e1;
}

.doc-chat-result-item.is-selected {
  background: #eff6ff;
  border-color: #93c5fd;
}

.doc-chat-result-item .form-check-input {
  margin-top: 0.2rem;
  flex-shrink: 0;
}

.doc-chat-result-body {
  min-width: 0;
}

.doc-chat-result-title {
  font-weight: 700;
  color: #0f172a;
  line-height: 1.35;
  margin-bottom: 4px;
}

.doc-chat-result-meta {
  font-size: 0.78rem;
  color: #64748b;
}

.doc-chat-selected-summary {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 12px 14px;
}

.doc-chat-selected-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.doc-chat-chip {
  display: inline-block;
  background: #fff;
  border: 1px solid #dbeafe;
  color: #1d4ed8;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.8rem;
  line-height: 1.3;
}

.doc-chat-index-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.doc-chat-index-item {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 12px 14px;
}

.doc-chat-index-title {
  font-weight: 700;
  color: #0f172a;
  line-height: 1.35;
  margin-bottom: 4px;
}

.doc-chat-index-meta {
  font-size: 0.78rem;
  color: #64748b;
}

.doc-chat-sources {
  white-space: normal;
  line-height: 1.4;
}

.doc-chat-messages {
  flex: 1;
  min-height: 360px;
  max-height: 480px;
  overflow-y: auto;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 16px;
}

.doc-chat-msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 12px;
  margin-bottom: 10px;
  white-space: pre-wrap;
  line-height: 1.5;
  font-size: 0.95rem;
}

.doc-chat-msg-user {
  margin-left: auto;
  background: #2563eb;
  color: #fff;
}

.doc-chat-msg-bot {
  background: #fff;
  border: 1px solid #e2e8f0;
  color: #0f172a;
}

.doc-chat-doc-list .list-group-item.active .small {
  color: rgba(255, 255, 255, 0.75) !important;
}

.doc-chat-panel {
  padding: 20px 22px;
}

.attendance-manage-table .attendance-ip-cell {
  min-width: 180px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.78rem;
  line-height: 1.4;
}

/* ==========================================================================
   모바일 반응형
   PC용 고정폭 사이드바를 오프캔버스 메뉴로 전환하고, 상단바·본문·카드의
   여백/폰트를 좁은 화면에 맞게 압축합니다.
   ========================================================================== */

.mobile-menu-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  margin-right: 2px;
}

.mobile-menu-btn:hover {
  background: #f8fafc;
}

.sidebar-backdrop {
  display: none;
}

.topbar-left {
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
}

body.sidebar-open {
  overflow: hidden;
}

@media (max-width: 991.98px) {
  .mobile-menu-btn {
    display: inline-flex;
  }

  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    z-index: 1045;
    width: min(280px, 84vw);
    box-shadow: 10px 0 32px rgba(0, 0, 0, 0.28);
  }

  .sidebar.is-open {
    transform: translateX(0);
  }

  .sidebar-backdrop.is-open {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    z-index: 1040;
  }

  .main-panel {
    margin-left: 0;
  }

  .topbar {
    height: auto;
    min-height: 60px;
    padding: 10px 14px;
    gap: 8px;
  }

  .topbar-title {
    font-size: 16.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .topbar-desc {
    display: none;
  }

  .topbar-right {
    gap: 6px;
  }

  .topbar-actions:not(:empty) {
    margin-right: 2px;
  }

  .notification-bell-btn {
    min-width: 0;
    padding: 6px 9px;
  }

  .notification-label {
    display: none;
  }

  .notification-badge {
    margin-left: 0;
  }

  .user-chip {
    gap: 0;
  }

  .user-chip-info {
    display: none;
  }

  .user-chip .user-avatar {
    width: 32px;
    height: 32px;
    font-size: 0.85rem;
  }

  .user-chip .btn {
    margin-left: 8px !important;
    padding: 6px 10px;
    font-size: 0.78rem;
  }

  .content {
    padding: 18px 14px 44px;
  }

  .card-modern {
    padding: 18px;
  }

  .metric-card {
    padding: 16px;
  }

  .metric-value {
    font-size: 26px;
  }

  .admin-notice {
    flex-wrap: wrap;
    padding: 14px 16px;
  }

  .page-actions {
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 8px;
  }

  .page-actions form {
    flex-wrap: wrap;
  }

  .tpl-toolbar {
    flex-wrap: wrap;
  }

  .tpl-search {
    max-width: 100%;
    flex: 1 1 100%;
  }

  .modal-dialog {
    margin: 10px;
  }
}

@media (max-width: 480px) {
  .topbar-title {
    font-size: 15px;
  }

  .card-modern {
    padding: 15px;
  }

  .metric-value {
    font-size: 23px;
  }

  .attendance-status-grid {
    grid-template-columns: 1fr;
  }

  .doc-chat-doc-list,
  .table-responsive table {
    font-size: 0.85rem;
  }

  .btn {
    white-space: normal;
  }
}
  