/* ============================================
   EliMedi Common Styles
   Based on Office Ally layout with modern UI
   ============================================ */

/* 변수는 design-system.css에서 정의 (ACT-018) */

/* Reset & Base */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    height: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: var(--font-size-base);
    line-height: 1.4;
    color: var(--text-primary);
    background: var(--bg-body);
}

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

a:hover {
    text-decoration: underline;
}

/* ============================================
   Layout Structure
   ============================================ */

.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

.main-wrapper {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
}

/* flex column 스크롤 컨테이너에서 자식 축소 방지 — overflow-y: auto가 스크롤 처리 */
.main-content > * {
    flex-shrink: 0;
}

/* Claim status 요약 strip — nav 하단 공통 바 (모든 default 레이아웃 페이지) */
.app-statusbar {
    display: flex;
    flex-wrap: wrap;
    flex-shrink: 0;
    background: #f7f9fb;
    border-bottom: 1px solid #cbd5e1;
    font-size: 12px;
}
.app-statusbar-item {
    flex: 1 1 auto;
    padding: 5px 12px;
    color: #64748b;
    white-space: nowrap;
    border-right: 1px dashed #cbd5e1;
}
.app-statusbar-item:last-child {
    border-right: none;
}
.app-statusbar-item b {
    color: #1f2937;
    font-weight: 700;
    margin-left: 2px;
}

.content-area {
    flex: 1;
    overflow: auto;
    padding: var(--spacing-md);
    background: var(--bg-body);
}

/* ============================================
   Header
   ============================================ */

.app-header {
    height: var(--header-height);
    background: linear-gradient(180deg, var(--bg-header) 0%, #1a5a6e 100%);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--spacing-lg);
    box-shadow: var(--shadow-md);
    z-index: 100;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.header-logo-link {
    display: flex;
    align-items: center;
    text-decoration: none;
    background: white;
    padding: 4px 10px;
    border-radius: 4px;
}

.header-logo-link:hover {
    text-decoration: none;
    opacity: 0.95;
}

.header-logo-img {
    height: 28px;
    width: auto;
}

/* Fallback for old SVG logo */
.header-logo {
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.header-logo svg {
    width: 20px;
    height: 20px;
    color: white;
}

.header-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-white);
    letter-spacing: -0.5px;
}

/* ============================================
   Practice Switcher (BILLER multi-practice)
   ============================================ */

.practice-switcher {
    position: relative;
    margin-left: var(--spacing-md);
}

/* 단일 practice 사용자: switcher 대신 표시하는 read-only practice 이름 */
.header-practice-name {
    margin-left: var(--spacing-md);
    display: flex;
    align-items: center;
    gap: 6px;
    color: rgba(255, 255, 255, 0.92);
    font-size: var(--font-size-sm);
    font-weight: 600;
    white-space: nowrap;
    max-width: 260px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.practice-switcher-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    padding: 6px 12px;
    color: #fff;
    font-size: var(--font-size-sm);
    cursor: pointer;
    transition: background 0.2s;
    white-space: nowrap;
    max-width: 260px;
}

.practice-switcher-btn:hover {
    background: rgba(255, 255, 255, 0.25);
}

.practice-switcher-btn:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

.practice-switcher-name {
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
}

.practice-switcher-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    min-width: 220px;
    max-width: 360px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    z-index: 200;
    padding: 4px 0;
    max-height: 300px;
    overflow-y: auto;
}

.practice-switcher-dropdown.show {
    display: block;
}

.practice-switcher-item {
    padding: 10px 16px;
    font-size: 13px;
    color: #333;
    cursor: pointer;
    transition: background 0.15s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.practice-switcher-item:hover {
    background: #f0f7ff;
}

.practice-switcher-item.active {
    background: #e8f0fe;
    color: var(--color-primary);
    font-weight: 600;
}

.practice-switcher-item.active::before {
    content: '\2713  ';
}

.practice-switcher-all {
    font-weight: 600;
    color: var(--color-primary);
}

.practice-switcher-divider {
    height: 1px;
    background: #e5e7eb;
    margin: 4px 0;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: var(--spacing-lg);
}

.header-user {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    color: var(--text-white);
    font-size: var(--font-size-sm);
}

.header-user-name {
    font-weight: 500;
}

.header-links {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.header-links a {
    color: rgba(255, 255, 255, 0.8);
    font-size: var(--font-size-sm);
    transition: color 0.2s;
}

.header-links a:hover {
    color: white;
    text-decoration: none;
}

/* Header User Dropdown */
.header-user-dropdown {
    position: relative;
}

.header-user-btn {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    color: white;
    font-size: var(--font-size-sm);
    cursor: pointer;
    transition: all 0.2s;
}

.header-user-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
}

.header-user-avatar {
    width: 28px;
    height: 28px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.header-user-avatar svg {
    color: white;
}

.dropdown-arrow {
    transition: transform 0.2s;
}

.header-user-dropdown.open .dropdown-arrow {
    transform: rotate(180deg);
}

.header-dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 240px;
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s;
    z-index: 1000;
}

.header-user-dropdown.open .header-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-header {
    padding: 12px 16px;
    background: var(--bg-light);
    border-radius: 8px 8px 0 0;
}

.dropdown-user-name {
    display: block;
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--text-primary);
}

.dropdown-user-role {
    display: block;
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    margin-top: 2px;
}

.dropdown-divider {
    height: 1px;
    background: var(--border-color);
    margin: 4px 0;
}

.dropdown-section-title {
    padding: 8px 16px 4px;
    font-size: 10px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.15s;
}

.dropdown-item:hover {
    background: var(--bg-light);
    color: var(--primary);
    text-decoration: none;
}

.dropdown-item svg {
    flex-shrink: 0;
    color: var(--text-muted);
}

.dropdown-item:hover svg {
    color: var(--primary);
}

.dropdown-item-danger {
    color: var(--danger);
}

.dropdown-item-danger:hover {
    background: rgba(220, 38, 38, 0.05);
    color: var(--danger);
}

.dropdown-item-danger svg {
    color: var(--danger);
}

/* ============================================
   Main Navigation Tabs
   ============================================ */

.main-nav {
    height: var(--nav-height);
    background: var(--bg-nav);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: stretch;
    padding: 0 var(--spacing-md);
    gap: 2px;
}

.nav-tab {
    display: flex;
    align-items: center;
    padding: 0 var(--spacing-lg);
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--text-secondary);
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.nav-tab:hover {
    color: var(--primary);
    background: rgba(37, 99, 235, 0.04);
}

.nav-tab.active {
    color: var(--primary);
    background: var(--bg-white);
    border-bottom: 3px solid var(--primary);
    border-radius: 0;
}

/* ============================================
   Sub Navigation
   ============================================ */

.sub-nav {
    height: var(--subnav-height);
    background: var(--bg-white);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    padding: 0 var(--spacing-md);
    gap: var(--spacing-sm);
}

.sub-nav-btn {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-xs);
    padding: var(--spacing-xs) var(--spacing-sm);
    font-size: var(--font-size-xs);
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: var(--em-radius-base);
    cursor: pointer;
    transition: all 0.2s var(--em-ease-out);
}

.sub-nav-btn:hover {
    background: var(--bg-nav);
    border-color: var(--border-dark);
}

.sub-nav-btn.primary {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

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

.sub-nav-divider {
    width: 1px;
    height: 20px;
    background: var(--border-color);
    margin: 0 var(--spacing-xs);
}

/* ============================================
   Sidebar (Calendar)
   ============================================ */

.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-light);
    box-shadow: 1px 0 3px rgba(0, 0, 0, 0.04);
    overflow-y: auto;
    flex-shrink: 0;
}

.sidebar-section {
    padding: var(--spacing-sm);
    border-bottom: 1px solid var(--border-color);
}

.sidebar-title {
    font-size: var(--font-size-xs);
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: var(--spacing-sm);
}

/* Quick Links (사이드바 공통) */
.quick-links {
    list-style: none;
    padding: 0;
    margin: 0;
}

.quick-links li {
    margin-bottom: 4px;
}

.quick-links a {
    display: block;
    padding: 6px 8px;
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
    border-radius: var(--em-radius-base);
    transition: all 0.2s var(--em-ease-out);
}

.quick-links a:hover {
    background: var(--bg-light);
    color: var(--primary);
    text-decoration: none;
}

/* Sidebar Summary (공통 — 여러 페이지에서 사용) */
.visit-summary {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.summary-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px;
    background: var(--bg-white);
    border-radius: var(--em-radius-md);
    box-shadow: var(--em-shadow-card);
    transition: box-shadow 0.2s;
}

.summary-item:hover {
    box-shadow: var(--em-shadow-card-hover);
}

.summary-label {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
}

.summary-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

.badge-blue   { color: #2563eb; }
.badge-yellow { color: #d97706; }
.badge-purple { color: #8b5cf6; }
.badge-orange { color: #ea580c; }
.badge-green  { color: #059669; }
.badge-red    { color: #dc2626; }
.badge-gray   { color: #94a3b8; }

/* Sidebar Status Filter (공통) */
.status-filter-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.status-filter-list li {
    margin-bottom: 4px;
}

.status-filter-list .form-check {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 0;
    font-size: var(--font-size-sm);
    cursor: pointer;
}

.status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.dot-blue   { background: #2563eb; }
.dot-yellow { background: #d97706; }
.dot-purple { background: #8b5cf6; }
.dot-orange { background: #ea580c; }
.dot-green  { background: #059669; }
.dot-gray   { background: #94a3b8; }
.dot-red    { background: #dc2626; }

/* Sidebar Filter Helpers (공통) */
.sidebar-filter-group {
    margin-bottom: 0;
}

.filter-label-sm {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 2px;
}

/* Mini Calendar */
.mini-calendar {
    width: 100%;
}

.mini-calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--spacing-sm);
}

.mini-calendar-title {
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--text-primary);
}

.mini-calendar-nav {
    display: flex;
    gap: 2px;
}

.mini-calendar-nav button {
    width: 20px;
    height: 20px;
    border: none;
    background: var(--bg-light);
    border-radius: 3px;
    cursor: pointer;
    font-size: 10px;
    color: var(--text-secondary);
}

.mini-calendar-nav button:hover {
    background: var(--bg-nav);
}

.mini-calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    text-align: center;
    font-size: var(--font-size-xs);
}

.mini-calendar-dow {
    padding: 4px 2px;
    font-weight: 600;
    color: var(--text-muted);
}

.mini-calendar-day {
    padding: 4px 2px;
    cursor: pointer;
    border-radius: 3px;
    color: var(--text-secondary);
}

.mini-calendar-day:hover {
    background: var(--bg-nav);
}

.mini-calendar-day.today {
    background: var(--primary);
    color: white;
    font-weight: 600;
}

.mini-calendar-day.selected {
    background: var(--primary-light);
    color: white;
}

.mini-calendar-day.other-month {
    color: var(--text-muted);
}

/* ============================================
   Panels & Cards
   ============================================ */

.panel {
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: var(--em-radius-md);
    box-shadow: var(--em-shadow-card);
    margin-bottom: var(--spacing-md);
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-sm) var(--spacing-md);
    background: var(--bg-light);
    border-bottom: 1px solid var(--border-color);
    border-radius: var(--em-radius-md) var(--em-radius-md) 0 0;
}

.panel-title {
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--text-primary);
}

.panel-body {
    padding: var(--spacing-md);
}

.panel-footer {
    padding: var(--spacing-sm) var(--spacing-md);
    background: var(--bg-light);
    border-top: 1px solid var(--border-color);
    border-radius: 0 0 var(--em-radius-md) var(--em-radius-md);
}

/* Card Panel (공통 유틸리티) */
.card-panel {
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: var(--em-radius-md);
    box-shadow: var(--em-shadow-card);
    transition: box-shadow 0.2s, border-color 0.2s;
}

.card-panel:hover {
    box-shadow: var(--em-shadow-card-hover);
    border-color: var(--em-color-blue-200);
}

/* ============================================
   Tables
   ============================================ */

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--font-size-xs);
}

.data-table th {
    background: var(--bg-light);
    padding: 4px 8px;
    text-align: left;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border-color);
    white-space: nowrap;
    line-height: 1.3;
}

.data-table td {
    padding: 4px 8px;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
    line-height: 1.3;
}

.data-table tr:hover {
    background: rgba(37, 99, 235, 0.03);
}

.data-table tr.selected {
    background: rgba(37, 99, 235, 0.1);
}

/* ============================================
   Forms
   ============================================ */

.form-group {
    margin-bottom: var(--spacing-md);
}

.form-label {
    display: block;
    font-size: var(--font-size-xs);
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-xs);
}

.form-control {
    width: 100%;
    padding: var(--spacing-xs) var(--spacing-sm);
    font-size: var(--font-size-sm);
    border: 1px solid var(--border-color);
    border-radius: var(--em-radius-base);
    background: var(--bg-white);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.12);
}

.form-control-sm {
    padding: 2px 6px;
    font-size: var(--font-size-xs);
}

select.form-control {
    cursor: pointer;
}

/* Inline Form */
.form-inline {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    flex-wrap: wrap;
}

.form-inline .form-group {
    margin-bottom: 0;
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
}

/* Checkbox & Radio */
.form-check {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    font-size: var(--font-size-sm);
}

.form-check input {
    width: 14px;
    height: 14px;
    accent-color: var(--primary);
}

/* ============================================
   Buttons
   ============================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-xs);
    height: 28px;
    padding: 0 12px;
    font-size: var(--font-size-sm);
    font-weight: 500;
    border-radius: var(--em-radius-base);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s var(--em-ease-out);
    white-space: nowrap;
    line-height: 1;
    box-sizing: border-box;
}

.btn-sm {
    height: 24px;
    padding: 0 8px;
    font-size: var(--font-size-xs);
    line-height: 1;
}

.btn-xs {
    height: 20px;
    padding: 0 6px;
    font-size: var(--font-size-xs);
    border-radius: 2px;
    line-height: 1;
}

.list-header-action {
    height: 20px;
    min-height: 20px;
    padding: 1px 8px;
    border: 1px solid #0e7c8a;
    border-radius: 3px;
    background: #0e7c8a;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    line-height: 16px;
    white-space: nowrap;
    cursor: pointer;
}

/* 테이블 행 내 버튼 — compact 모드 */
td .btn {
    height: 20px !important;
    min-height: 0 !important;
    padding: 0 6px !important;
    font-size: var(--font-size-xs) !important;
}

td .btn-sm {
    height: 18px !important;
    min-height: 0 !important;
    padding: 0 5px !important;
    font-size: 10px !important;
}

td .btn-xs {
    height: 16px !important;
    min-height: 0 !important;
    padding: 0 4px !important;
    font-size: 9px !important;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(26, 90, 110, 0.25);
}

.btn-secondary {
    background: var(--bg-light);
    border-color: var(--border-color);
    color: var(--text-secondary);
}

.btn-secondary:hover {
    background: var(--bg-nav);
    border-color: var(--border-dark);
}

.btn-success {
    background: var(--success);
    border-color: var(--success);
    color: white;
}

.btn-success:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(5, 150, 105, 0.25);
}

.btn-danger {
    background: var(--danger);
    border-color: var(--danger);
    color: white;
}

.btn-danger:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(220, 38, 38, 0.25);
}

.btn-link {
    background: transparent;
    border-color: transparent;
    color: var(--text-link);
    padding: 0;
}

.btn-link:hover {
    text-decoration: underline;
}

/* ============================================
   Badges & Status
   ============================================ */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    font-size: var(--font-size-xs);
    font-weight: 600;
    border-radius: var(--em-radius-full);
    letter-spacing: 0.3px;
}

.badge-primary {
    background: rgba(37, 99, 235, 0.1);
    color: var(--primary);
}

.badge-success {
    background: rgba(5, 150, 105, 0.1);
    color: var(--success);
}

.badge-warning {
    background: rgba(217, 119, 6, 0.1);
    color: var(--warning);
}

.badge-danger {
    background: rgba(220, 38, 38, 0.1);
    color: var(--danger);
}

.badge-secondary {
    background: var(--bg-nav);
    color: var(--text-secondary);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.status-dot.active {
    background: var(--success);
}

.status-dot.pending {
    background: var(--warning);
}

.status-dot.inactive {
    background: var(--text-muted);
}

/* ============================================
   Footer
   ============================================ */

.app-footer {
    padding: var(--spacing-sm) var(--spacing-lg);
    background: var(--bg-white);
    border-top: 1px solid var(--border-color);
    text-align: center;
    font-size: var(--font-size-xs);
    color: var(--text-muted);
}

/* ============================================
   Utilities
   ============================================ */

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

.text-right {
    text-align: right;
}

.text-muted {
    color: var(--text-muted);
}

.text-primary {
    color: var(--primary);
}

.text-success {
    color: var(--success);
}

.text-danger {
    color: var(--danger);
}

.text-warning {
    color: var(--warning);
}

.font-bold {
    font-weight: 600;
}

.font-normal {
    font-weight: 400;
}

.d-flex {
    display: flex;
}

.align-center {
    align-items: center;
}

.justify-between {
    justify-content: space-between;
}

.gap-sm {
    gap: var(--spacing-sm);
}

.gap-md {
    gap: var(--spacing-md);
}

.mt-sm {
    margin-top: var(--spacing-sm);
}

.mt-md {
    margin-top: var(--spacing-md);
}

.mb-sm {
    margin-bottom: var(--spacing-sm);
}

.mb-md {
    margin-bottom: var(--spacing-md);
}

.w-100 {
    width: 100%;
}

.h-100 {
    height: 100%;
}

.overflow-auto {
    overflow: auto;
}

.overflow-hidden {
    overflow: hidden;
}

.cursor-pointer {
    cursor: pointer;
}

/* ============================================
   Responsive
   ============================================ */

@media (max-width: 1024px) {
    .sidebar {
        width: 180px;
    }
}

@media (max-width: 768px) {
    .sidebar {
        display: none;
    }

    .header-links {
        display: none;
    }
}

/* ============================================
   Modal Styles (Global)
   ============================================ */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-overlay.show {
    display: flex;
}

.modal {
    background: var(--bg-white);
    border-radius: var(--em-radius-xl);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2), 0 8px 16px rgba(0, 0, 0, 0.08);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.modal.modal-lg {
    max-width: 800px;
}

.modal.modal-sm {
    max-width: 400px;
}

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

.modal-title {
    font-size: var(--font-size-lg);
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.modal-close {
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    font-size: 20px;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--em-radius-base);
    transition: all 0.2s;
}

.modal-close:hover {
    background: var(--bg-light);
    color: var(--text-primary);
}

.modal-body {
    padding: var(--spacing-lg);
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: var(--spacing-sm);
    padding: var(--spacing-md) var(--spacing-lg);
    border-top: 1px solid var(--border-color);
    background: var(--bg-light);
    border-radius: 0 0 var(--em-radius-xl) var(--em-radius-xl);
}

/* ============================================
   Pagination
   ============================================ */

.pagination {
    display: flex;
    align-items: center;
    gap: 4px;
}

.page-info {
    padding: 0 12px;
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
}

/* ============================================
   Accessibility - Screen Reader Only
   sr-only는 accessibility.css에도 정의되어 있으나
   accessibility.css 로드 전에도 사용 가능하도록 여기에도 추가
   ============================================ */

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}

/* ============================================
   Accessibility - Focus Visible (보강)
   기존 :focus 스타일과 :focus-visible 공존
   ============================================ */

.form-control:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 0;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(26, 90, 110, 0.15);
}

/* ============================================
   Toast Notification (Notify 컴포넌트)
   common.js의 Notify.show()에서 생성하는 알림
   ============================================ */

.notification {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-width: 300px;
    max-width: 480px;
    padding: 12px 16px;
    margin-bottom: 8px;
    border-radius: 6px;
    font-size: 14px;
    line-height: 1.4;
    color: #fff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    animation: notifySlideIn 0.3s ease-out;
}

.notification span {
    flex: 1;
    word-break: break-word;
}

.notification-close {
    background: none;
    border: none;
    color: inherit;
    font-size: 18px;
    cursor: pointer;
    opacity: 0.7;
    padding: 0 2px;
    line-height: 1;
    flex-shrink: 0;
}

.notification-close:hover {
    opacity: 1;
}

.notification-success {
    background: var(--success, #28a745);
}

.notification-error {
    background: var(--danger, #dc3545);
}

.notification-warning {
    background: var(--warning, #ffc107);
    color: #333;
}

.notification-info {
    background: var(--info, #17a2b8);
}

@keyframes notifySlideIn {
    from {
        opacity: 0;
        transform: translateX(40px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Google Places PlaceAutocompleteElement 스타일 (form-control 매칭) */
gmp-place-autocomplete {
    display: block;
    width: 100%;
    --gmpx-color-surface: var(--bg-white, #ffffff);
    --gmpx-color-on-surface: var(--text-primary, #333333);
    --gmpx-color-on-surface-variant: var(--text-secondary, #6c757d);
    --gmpx-color-primary: var(--primary, #2563eb);
    --gmpx-font-family-base: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --gmpx-font-size-base: var(--font-size-sm, 0.875rem);
    --gmpx-controls-height: 32px;
    border: 1px solid var(--border-color, #d1d5db);
    border-radius: 4px;
    transition: border-color 0.15s, box-shadow 0.15s;
}

gmp-place-autocomplete:focus-within {
    border-color: var(--primary-light, #60a5fa);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

/* OfficeAlly date field: visible mm/dd/yyyy text + native calendar indicator */
.oa-date-picker-auto {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    width: 100%;
}

.oa-date-picker-auto .oa-date-display {
    flex: 1 1 auto;
    min-width: 0;
}

.oa-date-picker-auto .oa-native-date-picker {
    flex: 0 0 20px;
    width: 20px;
    min-width: 20px;
    height: 20px;
    min-height: 20px;
    padding: 0;
    border: 0;
    background: transparent;
    color: transparent;
    cursor: pointer;
}

.oa-date-picker-auto .oa-native-date-picker::-webkit-datetime-edit {
    display: none;
}

.oa-date-picker-auto .oa-native-date-picker::-webkit-calendar-picker-indicator {
    display: block;
    width: 16px;
    height: 16px;
    margin: 0;
    padding: 0;
    opacity: 1;
    cursor: pointer;
}

/* ===== Coverage Details 색상 리치 에디터 (CoverageEditor — settings + eligibility 공용) ===== */
.cov-editor-wrap { border: 1px solid var(--border-color, #d1d5db); border-radius: var(--em-radius-base, 6px); overflow: hidden; }
.cov-toolbar {
    display: flex; align-items: center; gap: 4px; flex-wrap: wrap;
    padding: 5px 8px; background: var(--bg-light, #f8fafc);
    border-bottom: 1px solid var(--border-color, #d1d5db);
}
.cov-toolbar-label { font-size: 12px; color: var(--text-muted, #6b7280); margin-right: 2px; }
.cov-toolbar-sep { width: 1px; height: 18px; background: var(--border-color, #d1d5db); margin: 0 4px; }
.cov-bold-btn {
    width: 24px; height: 24px; padding: 0; line-height: 22px; text-align: center;
    font-size: 14px; color: var(--text-primary, #111827);
    background: #fff; border: 1px solid var(--border-color, #d1d5db); border-radius: 4px; cursor: pointer;
}
.cov-bold-btn:hover { background: var(--bg-light, #f0f7ff); }
.cov-color-btn {
    width: 24px; height: 24px; padding: 0; line-height: 22px; text-align: center;
    font-weight: 700; font-size: 14px;
    background: #fff; border: 1px solid var(--border-color, #d1d5db); border-radius: 4px; cursor: pointer;
}
.cov-color-btn:hover { background: var(--bg-light, #f0f7ff); }
.cov-editor {
    min-height: 90px; max-height: 300px; overflow-y: auto;
    padding: 8px 10px; line-height: 1.5; white-space: pre-wrap; word-break: break-word;
    border: none; border-radius: 0; outline: none;
}
.cov-editor:focus { box-shadow: inset 0 0 0 2px var(--primary-color, #2563eb); }
.cov-editor:empty::before {
    content: attr(data-placeholder); color: var(--text-muted, #9ca3af); pointer-events: none;
}
.cov-editor s, .cov-inline s { text-decoration: line-through; }

/* ===== Coverage Summary 값 인라인 리치 에디터 (한 줄, 겉보기는 input) + 공용 서식 툴바 ===== */
.cov-inline {
    height: auto; min-height: 38px; line-height: 1.5;
    white-space: nowrap; overflow-x: auto; overflow-y: hidden; outline: none;
}
.cov-inline:focus { box-shadow: 0 0 0 2px var(--primary-color, #2563eb) inset; }
.cov-inline:empty::before {
    content: attr(data-placeholder); color: var(--text-muted, #9ca3af); pointer-events: none;
}
/* 취소선 토글 버튼 (Bold 버튼과 동일 형태) */
.cov-strike-btn {
    width: 24px; height: 24px; padding: 0; line-height: 22px; text-align: center;
    font-size: 14px; color: var(--text-primary, #111827);
    background: #fff; border: 1px solid var(--border-color, #d1d5db); border-radius: 4px; cursor: pointer;
}
.cov-strike-btn:hover { background: var(--bg-light, #f0f7ff); }
/* 서식 지우기 버튼 */
.cov-clear-btn {
    height: 24px; padding: 0 7px; line-height: 22px; font-size: 12px;
    color: var(--text-muted, #6b7280);
    background: #fff; border: 1px solid var(--border-color, #d1d5db); border-radius: 4px; cursor: pointer;
}
.cov-clear-btn:hover { background: var(--bg-light, #f0f7ff); }
/* Coverage Summary 섹션 상단 공용 툴바 */
.cov-summary-toolbar { display: flex; flex-direction: column; gap: 5px; }
.cov-summary-hint { font-size: 12px; color: var(--text-muted, #6b7280); }
.cov-toolbar-shared { border: 1px solid var(--border-color, #d1d5db); border-radius: 6px; }
