:root, .theme-classic {
    --bg-body: #f4f5f7;
    --bg-card: #ffffff;
    --bg-hover: #f9fafb;
    --text-main: #1d1d1f;
    --text-muted: #6b7280;
    --border-color: #e5e7eb;
    --primary-gradient: linear-gradient(135deg, #7c3aed, #3b82f6);
    --primary-color: #7c3aed;
    --primary-hover: #6d28d9;
    --accent-badge: #faf5ff;
    --accent-badge-text: #5b21b6;
    --radius-card: 16px;
    --radius-btn: 10px;
    --font-sans: 'Inter', sans-serif;
    --font-header: 'Inter', sans-serif;
    --bg-btn-primary: var(--primary-gradient);
    --text-btn-primary: #ffffff;
}

.theme-linear-obsidian {
    --bg-body: #010102;
    --bg-card: #0f1011;
    --bg-hover: #141516;
    --text-main: #f7f8f8;
    --text-muted: #8a8f98;
    --border-color: #23252a;
    --primary-gradient: none;
    --primary-color: #5e6ad2;
    --primary-hover: #828fff;
    --accent-badge: #141516;
    --accent-badge-text: #5e6ad2;
    --radius-card: 12px;
    --radius-btn: 8px;
    --font-sans: 'Inter', sans-serif;
    --font-header: 'Inter', sans-serif;
    --bg-btn-primary: var(--primary-color);
    --text-btn-primary: #ffffff;
}

.theme-claude-ivory {
    --bg-body: #faf9f5;
    --bg-card: #efe9de;
    --bg-hover: #f5f0e8;
    --text-main: #141413;
    --text-muted: #8e8b82;
    --border-color: #e6dfd8;
    --primary-gradient: none;
    --primary-color: #cc785c;
    --primary-hover: #a9583e;
    --accent-badge: #f5f0e8;
    --accent-badge-text: #cc785c;
    --radius-card: 8px;
    --radius-btn: 6px;
    --font-sans: 'Inter', sans-serif;
    --font-header: 'Cormorant Garamond', serif;
    --bg-btn-primary: var(--primary-color);
    --text-btn-primary: #ffffff;
}

.theme-apple-silver {
    --bg-body: #f5f5f7;
    --bg-card: #ffffff;
    --bg-hover: #fafafc;
    --text-main: #1d1d1f;
    --text-muted: #7a7a7a;
    --border-color: #e0e0e0;
    --primary-gradient: none;
    --primary-color: #0066cc;
    --primary-hover: #0071e3;
    --accent-badge: #fafafc;
    --accent-badge-text: #0066cc;
    --radius-card: 18px;
    --radius-btn: 9999px;
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --font-header: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --bg-btn-primary: var(--primary-color);
    --text-btn-primary: #ffffff;
}

.theme-vercel-mono {
    --bg-body: #ffffff;
    --bg-card: #fafafa;
    --bg-hover: #f5f5f5;
    --text-main: #171717;
    --text-muted: #888888;
    --border-color: #ebebeb;
    --primary-gradient: none;
    --primary-color: #171717;
    --primary-hover: #000000;
    --accent-badge: #f5f5f5;
    --accent-badge-text: #171717;
    --radius-card: 6px;
    --radius-btn: 4px;
    --font-sans: 'Inter', sans-serif;
    --font-header: 'Inter', sans-serif;
    --bg-btn-primary: var(--primary-color);
    --text-btn-primary: #ffffff;
}

.theme-supabase-emerald {
    --bg-body: #1c1c1c;
    --bg-card: #202020;
    --bg-hover: #242424;
    --text-main: #ededed;
    --text-muted: #9a9a9a;
    --border-color: #2e2e2e;
    --primary-gradient: none;
    --primary-color: #3ecf8e;
    --primary-hover: #24b47e;
    --accent-badge: #133827;
    --accent-badge-text: #3ecf8e;
    --radius-card: 12px;
    --radius-btn: 8px;
    --font-sans: 'Inter', sans-serif;
    --font-header: 'Inter', sans-serif;
    --bg-btn-primary: var(--primary-color);
    --text-btn-primary: #171717;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box
}

body {
    font-family: var(--font-sans);
    background: var(--bg-body);
    color: var(--text-main);
    min-height: 100vh;
    transition: background 0.3s, color 0.3s;
}

.hidden {
    display: none !important
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
    max-width: 1720px;
    margin-left: 0;
    margin-right: auto;
}

h1 {
    font-size: 22px;
    font-weight: 800;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    font-family: var(--font-header);
}

.header-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.btn {
    padding: 7px 16px;
    border-radius: var(--radius-btn);
    border: none;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all .2s;
    font-family: inherit
}

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

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(99, 102, 241, .2)
}

.btn-outline {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-main);
}

.btn-outline:hover {
    border-color: var(--text-muted);
    background: var(--bg-hover);
}

.btn-sm {
    padding: 5px 10px;
    font-size: 12px
}

.btn-success {
    background: #059669;
    color: #fff
}

.btn-success:hover {
    background: #047857
}

.btn-danger {
    background: var(--bg-card);
    border: 1px solid #fca5a5;
    color: #dc2626
}

.btn-danger:hover {
    background: #fef2f2
}

/* Stats */
.stats-row {
    display: grid;
    grid-template-columns: 350px 1fr 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
    max-width: 1720px;
    margin-left: 0;
    margin-right: auto;
}

.app.admin-mode .stats-row {
    grid-template-columns: 350px 1fr 1fr 1fr;
    max-width: 1720px;
    gap: 20px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-card);
    padding: 16px 18px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .04);
    transition: background 0.3s, border-color 0.3s;
}

.stat-card .label {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .5px
}

.stat-card .value {
    font-size: 26px;
    font-weight: 800;
    margin-top: 3px
}

.stat-card .value.purple {
    color: var(--primary-color);
}

.stat-card .value.blue {
    color: #2563eb
}

.stat-card .value.green {
    color: #059669
}

.stat-card .value.orange {
    color: #d97706
}

/* Layout */
body {
    overflow-x: hidden
}

.app {
    max-width: 2200px;
    margin-left: 0;
    margin-right: auto;
    padding: 20px
}

.app.admin-mode {
    margin-left: 0;
    margin-right: auto;
}

.app.admin-mode header {
    max-width: 1720px;
}

.main-layout {
    display: grid;
    grid-template-columns: 350px 960px 370px;
    gap: 20px;
    align-items: start;
    justify-content: start;
    position: relative;
    margin: 0;
}

.app.admin-mode .main-layout {
    grid-template-columns: 350px 960px 370px 350px;
}

.overview-left {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    gap: 16px;
}

.overview-fixed {
    position: absolute;
    left: calc(100% + 20px);
    top: 0;
    width: 350px;
    display: flex;
    flex-direction: column;
    overflow: hidden
}

/* 관리자 모드일 때 각 독립된 컬럼 패널들의 높이를 달력과 균형을 이루도록 최소 높이 설정 */
.app.admin-mode #panelEdit .panel-section,
.app.admin-mode #adminOverviewPanel .panel-section {
    min-height: 600px;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.app.admin-mode .overview-fixed {
    width: 700px;
    flex-direction: row;
    gap: 12px
}

.app.admin-mode .overview-fixed .panel-section {
    flex: 1;
    min-width: 0
}

/* 모바일 기기로 접속했을 때(뷰포트가 1400px이라도) 업체 현황을 밑으로 강제 이동 */
html.is-mobile-device .overview-fixed {
    position: static;
    width: 100%;
    max-height: none;
    margin-top: 20px;
}
html.is-mobile-device .app.admin-mode .overview-fixed {
    width: 100%;
    flex-direction: column;
}
html.is-mobile-device .app.admin-mode {
    margin: 0 auto;
}

/* Calendar */
.calendar-area {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-card);
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .04);
    transition: background 0.3s, border-color 0.3s, color 0.3s;
}

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

.cal-header h2 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-main);
    font-family: var(--font-header);
}

.cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px
}

.cal-day-name {
    text-align: center;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    padding: 8px 0
}

.cal-day-name.sun {
    color: #dc2626
}

.cal-day-name.sat {
    color: #2563eb
}

.cal-cell {
    min-height: 90px;
    background: var(--bg-hover);
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-btn);
    padding: 5px 6px;
    cursor: pointer;
    transition: all .2s;
    position: relative;
    overflow: hidden;
}

.cal-cell:hover {
    border-color: var(--primary-color);
    background: var(--bg-card);
}

.cal-cell.today {
    border-color: var(--primary-color);
    background: var(--accent-badge);
}

.cal-cell.selected {
    border-color: var(--primary-color);
    background: var(--accent-badge);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, .15)
}

.cal-cell.empty {
    opacity: .15;
    pointer-events: none;
    min-height: 40px
}

.cal-cell .day-num {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 3px;
    display: flex;
    justify-content: space-between
}

.cal-cell.today .day-num {
    color: var(--primary-color);
}

.cal-cell.holiday .day-num span:first-child {
    color: #dc2626
}

.cal-cell.sunday .day-num span:first-child {
    color: #dc2626
}

.cal-cell.saturday .day-num span:first-child {
    color: #2563eb
}

.cal-cell .holiday-name {
    font-size: 8px;
    color: #dc2626;
    font-weight: 600;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis
}

.cal-cell .day-num .day-total {
    color: #7c3aed;
    font-size: 11px;
    font-weight: 800
}

.cal-cell .cell-writers {
    display: flex;
    flex-direction: column;
    gap: 2px
}

.cell-writer-row {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden
}

.cell-writer-row .cw-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0
}

.cell-writer-row .cw-name {
    color: #4b5563;
    flex-shrink: 0
}

.cell-writer-row .cw-detail {
    color: #9ca3af;
    overflow: hidden;
    text-overflow: ellipsis
}

.cal-legend {
    display: flex;
    gap: 14px;
    margin-top: 14px;
    flex-wrap: wrap
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: #6b7280
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%
}

/* Side Panel */
.side-panel {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-height: 0
}

.panel-section {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-card);
    box-shadow: 0 1px 3px rgba(0, 0, 0, .04);
    overflow: hidden;
    transition: background 0.3s, border-color 0.3s;
}

.panel-flex {
    display: flex;
    flex-direction: column;
    padding: 0
}

.panel-sticky-header {
    padding: 14px 18px 10px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
    background: var(--bg-card);
    border-radius: var(--radius-card) var(--radius-card) 0 0;
    transition: background 0.3s, border-color 0.3s;
}

.panel-sticky-header h3 {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-main);
    font-family: var(--font-header);
}

.panel-scroll-body {
    padding: 10px 18px 14px;
    overflow-y: auto;
    flex: 1
}

.panel-section h3 {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 14px;
    color: var(--text-main);
    font-family: var(--font-header);
}

.month-tag {
    font-size: 11px;
    color: #9ca3af;
    font-weight: 500;
    margin-left: 6px
}

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

.edit-header h3 {
    margin-bottom: 0
}

/* Writer selector */
.writer-selector {
    display: flex;
    gap: 6px;
    margin-bottom: 14px;
    flex-wrap: wrap
}

.writer-selector .ws-btn {
    padding: 6px 14px;
    border-radius: 20px;
    border: 2px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-main);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all .2s;
    font-family: inherit;
    display: flex;
    align-items: center;
    gap: 5px;
}

.writer-selector .ws-btn.active {
    border-color: var(--wc);
    background: var(--wc);
    color: #fff
}

.writer-selector .ws-btn .ws-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%
}

/* Sort selector */
.sort-selector {
    display: flex;
    gap: 4px;
    margin-top: 6px
}

.sort-btn {
    padding: 4px 10px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all .2s;
    font-family: inherit;
    color: var(--text-muted);
}

.sort-btn.active {
    background: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
}

.sort-btn:hover:not(.active) {
    background: var(--bg-hover);
}

/* Company cards */
.company-card {
    padding: 12px;
    background: var(--bg-hover);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-btn);
    margin-bottom: 8px;
    transition: all .2s
}

.company-card:hover {
    border-color: var(--primary-color);
    box-shadow: 0 2px 6px rgba(0, 0, 0, .04)
}

.company-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px
}

.company-name {
    font-weight: 700;
    font-size: 14px;
    color: var(--text-main);
    font-family: var(--font-header);
}

.company-count {
    font-size: 12px;
    color: var(--text-muted);
}

.company-count .done {
    color: #059669;
    font-weight: 700
}

.company-count .remain {
    color: #d97706;
    font-weight: 700
}

.company-bar {
    height: 5px;
    background: #e5e7eb;
    border-radius: 99px;
    overflow: hidden;
    margin-bottom: 6px
}

.company-bar-fill {
    height: 100%;
    border-radius: 99px;
    transition: width .4s
}

.company-actions {
    display: flex;
    gap: 5px
}

/* Edit mode */
.writer-group {
    margin-bottom: 16px
}

.writer-group-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    border-bottom: 1px solid #e5e7eb;
    margin-bottom: 8px
}

.writer-group-header .wg-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0
}

.writer-group-header .wg-name {
    font-weight: 700;
    font-size: 15px;
    color: var(--text-main);
    font-family: var(--font-header);
}

.writer-group-header .wg-total {
    margin-left: auto;
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 600
}

.company-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 7px 12px;
    background: var(--bg-hover);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-btn);
    margin-bottom: 4px
}

.company-row .cr-name {
    font-size: 13px;
    font-weight: 600;
    flex: 1;
    color: var(--text-main);
}

.company-row .cr-count {
    font-size: 18px;
    font-weight: 800;
    color: var(--primary-color);
    min-width: 30px;
    text-align: center;
    margin: 0 8px
}

.cr-btns {
    display: flex;
    gap: 4px
}

.cr-btn {
    width: 30px;
    height: 30px;
    border-radius: var(--radius-btn);
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-main);
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all .15s
}

.cr-btn:hover {
    background: #f3f4f6
}

.cr-btn.plus {
    border-color: #86efac;
    color: #059669;
    background: #f0fdf4
}

.cr-btn.plus:hover {
    background: #dcfce7
}

.cr-btn.minus {
    border-color: #fcd34d;
    color: #d97706;
    background: #fffbeb
}

.cr-btn.minus:hover {
    background: #fef3c7
}

/* 메모 - 우측 슬라이드 패널 */
.memo-btn {
    font-size: 11px;
    color: #92400e;
    background: #fef3c7;
    cursor: pointer;
    font-weight: 600;
    border: 1px solid #fcd34d;
    font-family: inherit;
    padding: 3px 10px;
    border-radius: 6px;
    margin-left: auto;
    white-space: nowrap
}

.memo-btn:hover {
    background: #fde68a
}

.memo-btn .memo-badge {
    background: #d97706;
    color: #fff;
    font-weight: 800;
    border-radius: 4px;
    padding: 0 4px;
    margin-left: 3px;
    font-size: 10px
}

.memo-slide {
    position: fixed;
    top: 0;
    right: -420px;
    width: 400px;
    height: 100vh;
    background: var(--bg-card);
    border-left: 1px solid var(--border-color);
    box-shadow: -4px 0 30px rgba(0, 0, 0, .1);
    z-index: 200;
    transition: right .3s ease, background 0.3s, border-color 0.3s;
    display: flex;
    flex-direction: column;
}

.memo-slide.open {
    right: 0
}

.memo-slide-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 20px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-hover);
    flex-shrink: 0;
    transition: background 0.3s, border-color 0.3s;
}

.memo-slide-header h4 {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-main);
    font-family: var(--font-header);
}

.memo-panel-close {
    border: none;
    background: none;
    font-size: 20px;
    cursor: pointer;
    color: var(--primary-color);
    font-weight: 700;
    padding: 2px 6px
}

.memo-panel-close:hover {
    color: #dc2626
}

.memo-slide-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px
}

.memo-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .15);
    z-index: 199;
    opacity: 0;
    pointer-events: none;
    transition: opacity .3s
}

.memo-backdrop.open {
    opacity: 1;
    pointer-events: all
}

.memo-entry {
    padding: 14px;
    background: var(--bg-hover);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-btn);
    margin-bottom: 10px
}

.memo-entry-num {
    font-size: 12px;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 8px
}

.memo-entry input {
    padding: 8px 10px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-btn);
    font-size: 13px;
    font-family: inherit;
    background: var(--bg-card);
    color: var(--text-main);
    outline: none;
    width: 100%;
    margin-bottom: 6px
}

.memo-entry input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(124, 58, 237, .1)
}

.memo-entry input::placeholder {
    color: var(--text-muted);
}

.memo-entry-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 6px
}

.memo-link {
    color: #2563eb;
    font-size: 12px;
    word-break: break-all;
    text-decoration: none;
    flex: 1
}

.memo-link:hover {
    text-decoration: underline
}

.memo-del-btn {
    font-size: 11px;
    color: #dc2626;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    border-radius: 6px;
    padding: 4px 12px;
    cursor: pointer;
    font-family: inherit;
    font-weight: 600
}

.memo-del-btn:hover {
    background: #fef2f2;
    border-color: #fca5a5;
}

.memo-check-btn {
    font-size: 11px;
    color: #059669;
    border: 1px solid #86efac;
    background: #f0fdf4;
    border-radius: 6px;
    padding: 4px 12px;
    cursor: pointer;
    font-family: inherit;
    font-weight: 600
}

.memo-check-btn:hover {
    background: #dcfce7
}

.memo-check-btn.checked {
    background: #059669;
    color: #fff;
    border-color: #059669
}

.memo-checked {
    border-color: #86efac;
    background: #f0fdf4
}

.memo-checked .memo-entry-num {
    color: #059669
}

/* 편집 패널 상단 추가 영역 */
.add-entry-row {
    display: flex;
    gap: 6px;
    margin-bottom: 14px;
    padding: 10px;
    background: var(--bg-hover);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-btn);
}

.add-entry-row select {
    flex: 1;
    padding: 6px 8px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-btn);
    font-size: 12px;
    font-family: inherit;
    background: var(--bg-card);
    color: var(--text-main);
    outline: none
}

.add-entry-row select:focus {
    border-color: var(--primary-color);
}

.add-entry-row input[type="number"] {
    width: 55px;
    padding: 6px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-btn);
    font-size: 13px;
    font-family: inherit;
    background: var(--bg-card);
    color: var(--text-main);
    text-align: center;
    outline: none
}

.add-entry-row input[type="number"]:focus {
    border-color: var(--primary-color);
}

/* 미래 날짜(예정) 스타일 */
.cal-cell.future-day {
    border-style: dashed;
    border-color: var(--border-color);
    background: var(--bg-hover);
}

.cal-cell.future-day:hover {
    border-color: var(--primary-color);
    background: var(--bg-card);
}

.cal-cell.future-day .cw-name {
    color: #d97706
}

.cal-cell.future-day .cw-detail {
    color: #d97706;
    opacity: 0.8
}

.cal-cell.future-day .day-total {
    color: #d97706
}

/* Modals */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .3);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: all
}

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-card);
    padding: 24px;
    width: 380px;
    max-width: 90vw;
    transform: translateY(20px);
    transition: transform .25s, background 0.3s, border-color 0.3s;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .15)
}

.modal-overlay.active .modal {
    transform: translateY(0)
}

.modal h3 {
    font-size: 17px;
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--text-main);
    font-family: var(--font-header);
}

.modal input {
    width: 100%;
    padding: 10px 12px;
    border-radius: var(--radius-btn);
    border: 1px solid var(--border-color);
    background: var(--bg-hover);
    color: var(--text-main);
    font-size: 14px;
    font-family: inherit;
    margin-bottom: 10px;
    outline: none
}

.modal input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, .1)
}

.modal-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 12px
}

.writer-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 10px;
    background: var(--bg-hover);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-btn);
    margin-bottom: 6px
}

.writer-row .wname {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 14px;
    color: var(--text-main);
}

.writer-row .wdot {
    width: 12px;
    height: 12px;
    border-radius: 50%
}

.log-empty {
    text-align: center;
    padding: 20px;
    color: #9ca3af;
    font-size: 13px
}

::-webkit-scrollbar {
    width: 5px
}

::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 99px
}

@media(max-width:1200px) {
    .main-layout {
        grid-template-columns: 1fr;
    }
    .app.admin-mode {
        margin-left: 0;
        margin-right: auto;
    }
    .overview-fixed {
        position: static;
        width: 100%;
        max-height: none !important;
        margin-top: 24px;
        flex-direction: row;
        gap: 20px;
    }
    .app.admin-mode .overview-fixed {
        width: 100%;
    }
    .overview-fixed .panel-section {
        flex: 1;
        min-width: 0;
    }
    #companyList, #adminCompanyList {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 12px;
    }
}

@media(max-width:900px) {
    .main-layout {
        grid-template-columns: 1fr;
    }
    .stats-row {
        grid-template-columns: repeat(2, 1fr);
    }
    .overview-fixed {
        flex-direction: column !important;
    }
}

.sticky-note.minimized .sticky-toolbar,
.sticky-note.minimized .sticky-body,
.sticky-note.minimized .sticky-color-picker {
    display: none;
}
.sticky-note.minimized {
    min-height: auto !important;
    height: auto !important;
    resize: none;
}

/* ===== Sticky Notes ===== */
.sticky-fab {
    position: fixed;
    bottom: 28px;
    left: 28px;
    z-index: 300;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: #fff;
    font-size: 28px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(245, 158, 11, .4);
    transition: all .2s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: inherit;
    line-height: 1;
}

.sticky-fab:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 24px rgba(245, 158, 11, .5)
}

.sticky-note {
    position: fixed;
    z-index: 250;
    min-width: 240px;
    min-height: 200px;
    border-radius: 6px 6px 10px 10px;
    display: flex;
    flex-direction: column;
    box-shadow: 2px 4px 20px rgba(0, 0, 0, .15);
    transition: box-shadow .2s;
    resize: both;
    overflow: hidden;
}

.sticky-note:hover {
    box-shadow: 3px 6px 28px rgba(0, 0, 0, .22)
}

.sticky-note.dragging {
    opacity: .85;
    box-shadow: 4px 8px 32px rgba(0, 0, 0, .3);
    cursor: grabbing
}

.sticky-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 10px;
    cursor: grab;
    user-select: none;
    border-bottom: 1px solid rgba(0, 0, 0, .08);
    font-size: 12px;
    font-weight: 700;
    color: rgba(0, 0, 0, .55);
    gap: 6px;
}

.sticky-header .sticky-title-input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 12px;
    font-weight: 700;
    color: rgba(0, 0, 0, .6);
    font-family: inherit;
    outline: none;
    min-width: 0;
}

.sticky-header .sticky-title-input::placeholder {
    color: rgba(0, 0, 0, .3)
}

.sticky-header-btns {
    display: flex;
    gap: 2px;
    flex-shrink: 0
}

.sticky-header-btns button {
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 14px;
    padding: 2px 5px;
    border-radius: 4px;
    color: rgba(0, 0, 0, .4);
    transition: all .15s;
    line-height: 1;
}

.sticky-header-btns button:hover {
    background: rgba(0, 0, 0, .08);
    color: rgba(0, 0, 0, .7)
}

.sticky-header-btns .sticky-close:hover {
    color: #dc2626;
    background: rgba(220, 38, 38, .1)
}

/* 서식 툴바 */
.sticky-toolbar {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 4px 8px;
    border-bottom: 1px solid rgba(0, 0, 0, .06);
    background: rgba(255, 255, 255, .4);
    flex-wrap: wrap;
}

.sticky-toolbar button {
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 3px 6px;
    border-radius: 4px;
    font-size: 13px;
    color: rgba(0, 0, 0, .5);
    transition: all .15s;
    font-family: inherit;
    line-height: 1;
    min-width: 24px;
    text-align: center;
}

.sticky-toolbar button:hover {
    background: rgba(0, 0, 0, .08);
    color: rgba(0, 0, 0, .8)
}

.sticky-toolbar button.active {
    background: rgba(0, 0, 0, .12);
    color: rgba(0, 0, 0, .8)
}

.sticky-toolbar .stb-sep {
    width: 1px;
    height: 16px;
    background: rgba(0, 0, 0, .1);
    margin: 0 2px
}

.sticky-toolbar select {
    border: 1px solid rgba(0, 0, 0, .12);
    background: rgba(255, 255, 255, .6);
    border-radius: 4px;
    font-size: 11px;
    padding: 2px 4px;
    color: rgba(0, 0, 0, .6);
    font-family: inherit;
    outline: none;
    cursor: pointer;
}

.sticky-toolbar input[type="color"] {
    width: 22px;
    height: 22px;
    border: 1px solid rgba(0, 0, 0, .12);
    border-radius: 4px;
    padding: 0;
    cursor: pointer;
    background: transparent;
}

.sticky-body {
    flex: 1;
    padding: 0;
    display: flex;
    overflow: hidden;
}

.sticky-editor {
    flex: 1;
    border: none;
    background: transparent;
    padding: 10px 12px;
    font-size: 13px;
    line-height: 1.6;
    font-family: 'Inter', sans-serif;
    color: rgba(0, 0, 0, .75);
    outline: none;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-word;
}

.sticky-editor:empty::before {
    content: attr(data-placeholder);
    color: rgba(0, 0, 0, .25);
    pointer-events: none;
}

.sticky-color-picker {
    display: flex;
    gap: 3px;
    padding: 6px 10px;
    border-top: 1px solid rgba(0, 0, 0, .06);
    background: rgba(255, 255, 255, .3);
}

.sticky-color-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all .15s;
}

.sticky-color-dot:hover {
    transform: scale(1.2)
}

.sticky-color-dot.active {
    border-color: rgba(0, 0, 0, .35);
    transform: scale(1.15)
}

/* 공유 메모 스타일 */
.sticky-shared {
    box-shadow: 2px 4px 20px rgba(37, 99, 235, .25), 0 0 0 2px rgba(37, 99, 235, .3)
}

.sticky-shared .sticky-header::after {
    content: '공유중';
    font-size: 9px;
    color: #2563eb;
    background: #dbeafe;
    padding: 1px 6px;
    border-radius: 4px;
    font-weight: 700;
    margin-right: 4px;
}

.sticky-share-label {
    display: flex;
    align-items: center;
    gap: 2px;
    cursor: pointer;
    font-size: 13px;
    color: rgba(0, 0, 0, .4);
    padding: 2px 4px;
    border-radius: 4px;
    transition: all .15s;
}

.sticky-share-label:hover {
    background: rgba(0, 0, 0, .06)
}

.sticky-share-cb {
    width: 13px;
    height: 13px;
    cursor: pointer;
    accent-color: #2563eb
}

/* 연장 신청 스타일 */
@keyframes blinker {
    50% { opacity: 0.2; }
}

.ext-req-badge {
    background: #ef4444;
    color: #fff;
    font-size: 10px;
    padding: 2px 6px;
    font-weight: 700;
    border-radius: 4px;
    animation: blinker 1.5s linear infinite;
    display: inline-block;
}

.company-card.ext-requested {
    border: 2px solid #ef4444 !important;
    background-color: #fff5f5 !important;
}

/* Server Status Indicator */
.status-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 20px;
    margin-left: 12px;
    vertical-align: middle;
    background: rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}
.status-indicator.online {
    color: #059669;
    background: rgba(5, 150, 105, 0.1);
}
.status-indicator.offline {
    color: #dc2626;
    background: rgba(220, 38, 38, 0.1);
}
.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
    display: inline-block;
    position: relative;
}
.status-indicator.online .status-dot::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    border-radius: 50%;
    background: currentColor;
    animation: status-ping 1.5s infinite ease-in-out;
}
@keyframes status-ping {
    0% { transform: scale(1); opacity: 0.8; }
    100% { transform: scale(2.5); opacity: 0; }
}

/* Unsynced items waiting for server */
.log-badge.unsynced-yellow {
    background: #fef3c7 !important;
    color: #d97706 !important;
    border: 1px dashed #d97706 !important;
    position: relative;
}
.log-badge.unsynced-yellow::after {
    content: '⏳';
    margin-left: 2px;
    font-size: 10px;
}
.memo-entry.unsynced-memo {
    border: 2px dashed #d97706 !important;
    background: #fef3c7 !important;
}
.memo-entry.unsynced-memo input {
    background: #fffbeb !important;
    border-color: #d97706 !important;
    color: #b45309 !important;
}

/* 미동기화 대기 중인 업체 행 카드 스타일 */
.company-row.unsynced-row {
    border: 2px dashed #f59e0b !important;
    background: #fffbeb !important;
}

/* 미동기화 대기 중인 메모 배지 */
.memo-badge.unsynced-badge {
    background: #f59e0b !important;
    color: #ffffff !important;
    animation: status-pulse 1.5s infinite ease-in-out;
}

@keyframes status-pulse {
    0% { opacity: 1; }
    50% { opacity: 0.7; }
    100% { opacity: 1; }
}

/* 에러 토스트 알림창 전용 스타일 */
#toastNotification.error-toast {
    background: #dc2626 !important;
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3) !important;
}



