/* Glassmorphism Design System - V2 */

@import url("https://fonts.googleapis.com/css2?family=Gowun+Dodum&family=SUIT:wght@400;500;700;800&display=swap");

:root {
  --font-body: "SUIT", "Pretendard", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans KR", sans-serif;
  --font-heading: "Gowun Dodum", "SUIT", "Pretendard", -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans KR", Arial, sans-serif;
  /* 1. Color Palette (Indigo & Amber) - Modern Dark Default */
  --primary: #818cf8;
  --primary-rgb: 129, 140, 248;
  /* Indigo 400 */
  --primary-hover: #6366f1;
  /* Indigo 500 */
  --primary-light: rgba(99, 102, 241, 0.2);
  --accent: #fbbf24;
  /* Amber 400 */
  --accent-hover: #f59e0b;
  /* Amber 500 */
  --accent-light: rgba(245, 158, 11, 0.2);
  --star-empty: rgba(255, 255, 255, 0.2);

  /* 2. Backgrounds & Text (Dark Default) */
  --bg-main: #0f172a;
  /* Slate 900 */
  --text-main: #f1f5f9;
  /* Slate 100 */
  --text-sub: #94a3b8;
  /* Slate 400 */
  --border: rgba(148, 163, 184, 0.2);
  --error: #ef4444;
  --success: #22c55e;

  /* 3. Glassmorphism Tokens (Dark) */
  --glass-bg: rgba(30, 41, 59, 0.7);
  /* Deep Blue-Grey Glass */
  --glass-border: 1px solid rgba(255, 255, 255, 0.08);
  --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  --glass-shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.2);

  /* 4. Layout & Spacing */
  --radius: 20px;
  --radius-sm: 14px;
  --header-height: 64px;

  /* 5. Component Specific (Calendar Dark) */
  --cal-bg: rgba(30, 41, 59, 0.4);
  --cal-header-bg: rgba(255, 255, 255, 0.05);
  --cal-cell-bg: rgba(30, 41, 59, 0.6);
  --cal-cell-border: rgba(255, 255, 255, 0.08);
  --cal-today-bg: #1e293b;
  --cal-item-bg: #334155;

  /* 6. Form & Overlay Tokens (Dark) */
  --input-bg: rgba(15, 23, 42, 0.6);
  --input-border: rgba(255, 255, 255, 0.1);
  --drawer-bg: rgba(15, 23, 42, 0.95);
  --btn-outline-bg: rgba(30, 41, 59, 0.8);
  --input-focus-bg: rgba(30, 41, 59, 1);
  --panel-bg: rgba(255, 255, 255, 0.05);
  --track-bg: rgba(255, 255, 255, 0.1);
  --segment-bg: rgba(255, 255, 255, 0.1);

  /* Table & Scroll */
  --table-hover: rgba(255, 255, 255, 0.05);
  --table-header-bg: rgba(255, 255, 255, 0.03);
  --task-table-header-bg: rgba(15, 23, 42, 0.88);
  --task-table-row-bg: rgba(15, 23, 42, 0.34);
  --task-table-row-hover: rgba(99, 102, 241, 0.12);
  --task-table-section-bg: rgba(30, 41, 59, 0.78);
  --task-table-resizer: rgba(148, 163, 184, 0.38);
  --task-table-resizer-active: rgba(129, 140, 248, 0.86);
  --scrollbar-thumb: rgba(255, 255, 255, 0.2);
  --scrollbar-thumb-hover: rgba(255, 255, 255, 0.3);
}

/* Light Mode Overrides (Optional) */
body.light-mode {
  --primary: #6366f1;
  --primary-rgb: 99, 102, 241;
  --primary-hover: #4f46e5;
  --primary-light: #e0e7ff;
  --accent: #f59e0b;
  --accent-hover: #d97706;
  --accent-light: #fef3c7;
  --star-empty: #e2e8f0;

  --bg-main: #f8fafc;
  --text-main: #1e293b;
  --text-sub: #64748b;
  --border: rgba(203, 213, 225, 0.6);

  --glass-bg: rgba(255, 255, 255, 0.75);
  --glass-border: 1px solid rgba(255, 255, 255, 0.6);
  --glass-shadow: 0 8px 32px rgba(31, 38, 135, 0.07);
  --glass-shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.05);

  --cal-bg: rgba(255, 255, 255, 0.4);
  --cal-header-bg: rgba(255, 255, 255, 0.5);
  --cal-cell-bg: rgba(255, 255, 255, 0.6);
  --cal-cell-border: rgba(255, 255, 255, 0.8);
  --cal-today-bg: #ffffff;
  --cal-item-bg: #ffffff;

  --input-bg: rgba(255, 255, 255, 0.6);
  --input-border: rgba(203, 213, 225, 0.8);
  --drawer-bg: rgba(255, 255, 255, 0.95);
  --btn-outline-bg: #ffffff;
  --input-focus-bg: #ffffff;
  --panel-bg: rgba(0, 0, 0, 0.03);
  --track-bg: rgba(0, 0, 0, 0.05);
  --segment-bg: rgba(0, 0, 0, 0.05);

  --table-hover: rgba(0, 0, 0, 0.02);
  --table-header-bg: rgba(0, 0, 0, 0.02);
  --task-table-header-bg: rgba(241, 245, 249, 0.92);
  --task-table-row-bg: rgba(255, 255, 255, 0.74);
  --task-table-row-hover: rgba(99, 102, 241, 0.1);
  --task-table-section-bg: rgba(226, 232, 240, 0.92);
  --task-table-resizer: rgba(99, 102, 241, 0.26);
  --task-table-resizer-active: rgba(79, 70, 229, 0.7);
  --scrollbar-thumb: rgba(0, 0, 0, 0.2);
  --scrollbar-thumb-hover: rgba(0, 0, 0, 0.3);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 20px;
  font-family: var(--font-body);
  background:
    radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.1) 0px, transparent 50%),
    radial-gradient(at 100% 0%, rgba(245, 158, 11, 0.05) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(99, 102, 241, 0.05) 0px, transparent 50%),
    var(--bg-main);
  background-attachment: fixed;
  color: var(--text-main);
  min-height: 100vh;
  overflow-x: hidden;
  transition: background 0.3s, color 0.3s;
}

html {
  scroll-behavior: smooth;
  overflow-x: hidden;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-heading);
}

/* Animations */
@keyframes fade-in-up {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-fade-in {
  animation: fade-in-up 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

/* Base UI Components */
button {
  font-family: inherit;
  cursor: pointer;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 12px;
  border: none;
  font-weight: 500;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  background: var(--primary);
  color: white;
  box-shadow: 0 2px 6px var(--primary-soft);
}

.btn:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn.outline {
  background: var(--btn-outline-bg);
  border: 1px solid var(--border);
  color: var(--text-main);
  box-shadow: var(--glass-shadow-sm);
}

.btn.outline:hover {
  background: #f1f5f9;
  border-color: var(--text-sub);
}

.btn.danger {
  background: var(--danger);
  box-shadow: 0 2px 6px var(--danger-soft);
}

.btn.danger:hover {
  background: #dc2626;
}

/* Progress Dashboard Widget */
.dashboard-container {
  display: flex;
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  flex: 1;
  background: var(--glass-bg);
  border: var(--glass-border);
  border-radius: var(--radius-sm);
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--glass-shadow-sm);
}

.stat-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.stat-info .label {
  font-size: 11px;
  color: var(--text-sub);
  display: block;
}

.stat-info .value {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-main);
}

.progress-bar-container {
  flex: 2;
  background: var(--glass-bg);
  border: var(--glass-border);
  border-radius: var(--radius-sm);
  padding: 16px;
  box-shadow: var(--glass-shadow-sm);
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 12px;
  font-weight: 600;
}

.progress-track {
  height: 10px;
  background: var(--track-bg);
  border-radius: 5px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  width: 0%;
  transition: width 1s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Structures */
.container {
  max-width: 1400px;
  margin: 0 auto;
}

.card {
  background: var(--glass-bg);
  border: var(--glass-border);
  border-radius: var(--radius);
  box-shadow: var(--glass-shadow);
  backdrop-filter: blur(8px);
  padding: 24px;
  margin-bottom: 24px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.card-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-main);
}

/* Form Elements */
input,
select,
textarea {
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  padding: 10px 14px;
  border-radius: 12px;
  transition: all 0.2s ease;
  font-size: 14px;
  width: 100%;
  color: var(--text-main);
}

input:focus,
select:focus,
textarea:focus {
  background: var(--input-focus-bg);
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-light);
  outline: none;
}

/* Utilities */
.hidden {
  display: none !important;
}

.flex {
  display: flex;
}

.gap-2 {
  gap: 8px;
}

.flex-col {
  flex-direction: column;
}

.items-center {
  align-items: center;
}

.justify-between {
  justify-content: space-between;
}

/* Tab Navigation */
.tab-nav {
  display: flex;
  gap: 8px;
  padding-bottom: 1px;
}

.tab {
  padding: 8px 12px;
  border-radius: 8px;
  color: var(--text-sub);
  cursor: pointer;
  font-weight: 500;
  transition: all 0.2s;
  position: relative;
}

.tab:hover {
  background: var(--panel-bg);
  color: var(--text-main);
}

.tab.active {
  color: var(--primary);
}

.tab.active::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 6px;
  right: 6px;
  height: 2px;
  background: var(--primary);
  border-radius: 2px;
}

/* Toast */
#toast-container {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  pointer-events: auto;
  background: rgba(15, 23, 42, 0.9);
  color: white;
  padding: 10px 16px;
  border-radius: 20px;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  backdrop-filter: blur(10px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Drawer & Datail Modal */
.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(8px);
  z-index: 2000;
  opacity: 0;
  pointer-events: none;
  transition: 0.3s;
}

.drawer-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.drawer {
  position: fixed;
  top: 0;
  right: -700px;
  width: 100%;
  max-width: 650px;
  height: 100vh;
  background: var(--drawer-bg);
  backdrop-filter: blur(16px);
  z-index: 2001;
  box-shadow: -10px 0 40px rgba(0, 0, 0, 0.15);
  transition: 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  pointer-events: none;
}

/* V3: Focus Mode (Expanded) */
.drawer.editor-expanded {
  max-width: 900px;
  /* Wider */
  background: var(--panel-bg);
  /* Slightly distinct background if needed */
}

.drawer.editor-expanded #fields-task>div:not(:has(#edit-body)),
.drawer.editor-expanded #fields-ann>div:not(:has(#edit-body)) {
  /* Hide other fields in focus mode, or maybe just dim them? 
       Prompt said "focus mode", expanding on click. 
       Let's making the body area huge. 
    */
  display: none;
}

.drawer.editor-expanded #edit-body {
  height: 60vh !important;
  /* Make textarea huge */
  font-size: 16px;
  line-height: 1.6;
}



.drawer.open {
  right: 0;
  pointer-events: auto;
}

/* Centered Mode (like a popup but inside) */
.drawer.centered {
  right: auto !important;
  left: 50%;
  width: min(1100px, calc(100vw - 48px));
  max-width: calc(100vw - 48px);
  border-radius: 20px;
  height: min(92vh, calc(100vh - 32px));
  max-height: calc(100vh - 32px);
  top: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  transform: translateX(-50%) scale(0.97) translateY(16px);
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.drawer.centered.open {
  right: auto !important;
  left: 50%;
  transform: translateX(-50%) scale(1) translateY(0);
  opacity: 1;
}

.drawer-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  font-size: 15px;
  line-height: 1.6;
  min-height: 0;
}

.drawer-footer {
  padding: 20px 24px;
  border-top: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.5);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.teamhub-editor-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.teamhub-editor-form {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.teamhub-editor-workspace {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
}

#drawer #editor-container {
  display: flex;
  flex: 1;
  min-height: 0;
  flex-direction: column;
}

#drawer .easy-md-container {
  flex: 1;
  min-height: 420px;
}

#drawer .easy-md-textarea,
#drawer .easy-md-preview,
#drawer #body-preview {
  min-height: 420px;
}

#drawer .easy-md-textarea,
#drawer .easy-md-preview {
  font-size: 16px;
  line-height: 1.75;
}

#drawer #body-preview {
  flex: 1;
}

#drawer #file-preview-list {
  max-height: 88px;
  overflow-y: auto;
  padding-right: 4px;
}

/* Grid for Main Layout (Option D) - Page Scroll Version */
.main-grid {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 20px;
  align-items: start;
  /* Don't stretch, let them follow content */
}

/* Sidebar: Sticky so it follows while scrolling right side */
.left-panel {
  position: sticky;
  top: 20px;
  max-height: calc(100vh - 40px);
  display: flex;
  flex-direction: column;
}

.left-panel .card {
  flex: 1;
  overflow-y: auto;
  margin-bottom: 0;
}

/* Right Panel: Content grows naturally with page */
.right-panel {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
}

.right-panel .calendar-section,
.right-panel .tasks-section {
  flex-shrink: 0;
}

#calendar-view {
  width: 100%;
  min-width: 0;
}

.teamhub-calendar-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
  padding: 4px;
  width: 100%;
  min-width: 0;
}

.teamhub-calendar-grid__weekday {
  min-width: 0;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  padding: 8px;
  color: var(--text-sub);
  background: var(--cal-header-bg);
  border-radius: 6px;
}

.teamhub-calendar-grid__blank {
  min-width: 0;
  min-height: 80px;
}

.teamhub-calendar-cell,
.teamhub-calendar-cell__header,
.teamhub-calendar-cell__items,
.teamhub-calendar-item,
.teamhub-calendar-item__title {
  min-width: 0;
}

.teamhub-calendar-cell__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.teamhub-calendar-cell__items {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.teamhub-calendar-item {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  background: var(--cal-item-bg);
  padding: 3px 6px;
  border-radius: 6px;
  margin-bottom: 3px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  border: 1px solid transparent;
  overflow: hidden;
}

.teamhub-calendar-item__dot {
  flex: 0 0 auto;
  width: 6px;
  height: 6px;
}

.teamhub-calendar-item__dot--task {
  border-radius: 50%;
}

.teamhub-calendar-item__dot--event {
  border-radius: 2px;
}

.teamhub-calendar-item__title {
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Tasks table horizontal scroll support */
.tasks-section {
  overflow-x: auto;
}

/* Premium Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb, rgba(0, 0, 0, 0.1));
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-thumb-hover, rgba(0, 0, 0, 0.2));
}

/* Task Table Custom Styles */
.task-table-wrap {
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  border-radius: 14px;
}

.task-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 100%;
}

.task-table th {
  text-align: left;
  padding: 12px 8px;
  color: var(--text-sub);
  font-weight: 500;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
  background: var(--task-table-header-bg, var(--table-header-bg, transparent));
  border-radius: 8px 8px 0 0;
  position: relative;
}

.task-table td {
  padding: 12px 8px;
  border-bottom: 1px solid var(--border);
  color: var(--text-main);
  vertical-align: middle;
  background: var(--task-table-row-bg);
}

.task-table tr:hover td {
  background: var(--task-table-row-hover);
}

.task-table tbody tr {
  cursor: pointer;
}

.task-th-inner {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 20px;
  min-width: 0;
}

.task-th-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.task-th-button:hover,
.task-th-button:focus-visible {
  color: var(--text-main);
}

.task-th-label {
  display: inline-flex;
  align-items: center;
  min-width: 0;
}

.task-th-sort {
  flex: 0 0 auto;
}

.task-col-resizer {
  position: absolute;
  top: -8px;
  right: -10px;
  width: 18px;
  height: calc(100% + 16px);
  padding: 0;
  border: 0;
  background: transparent;
  cursor: col-resize;
  z-index: 2;
}

.task-col-resizer::before {
  content: "";
  position: absolute;
  top: 6px;
  bottom: 6px;
  left: 50%;
  width: 2px;
  transform: translateX(-50%);
  background: transparent;
  border-radius: 999px;
  opacity: 0.45;
  transition: background 0.16s ease, opacity 0.16s ease;
}

.task-table th:hover .task-col-resizer::before,
.task-col-resizer:focus-visible::before,
.task-col-resizer.active::before,
.task-table.is-resizing .task-col-resizer::before {
  background: var(--task-table-resizer);
  opacity: 1;
}

.task-table.is-resizing .task-col-resizer.active::before,
body.teamhub-col-resizing .task-col-resizer.active::before {
  background: var(--task-table-resizer-active);
}

body.teamhub-col-resizing,
body.teamhub-col-resizing * {
  cursor: col-resize !important;
  user-select: none !important;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  letter-spacing: -0.01em;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.badge.private {
  background: #f3f4f6;
  color: #4b5563;
}

.badge.shared {
  background: #eff6ff;
  color: #3b82f6;
}

.badge.status-my-done {
  background: #ecfccb;
  color: #65a30d;
  border: 1px solid #bef264;
}

.badge.status-in-progress {
  background: #e0f2fe;
  color: #0284c7;
  border: 1px solid #bae6fd;
}

/* Blue for In Progress */
.badge.status-waiting {
  background: #fffbeb;
  color: #d97706;
  border: 1px solid #fde68a;
}

.badge.status-start {
  background: #f3f4f6;
  color: #6b7280;
  border: 1px solid #e5e7eb;
}

/* Gray for Not Started */

.status-tooltip {
  position: relative;
  cursor: help;
}

.status-tooltip:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 8px;
  border-radius: 6px;
  font-size: 11px;
  white-space: pre-line;
  z-index: 1000;
  min-width: 120px;
  pointer-events: none;
  line-height: 1.5;
}

.overdue-warning {
  color: var(--error);
  font-weight: 700;
  background: #fef2f2;
  border: 1px solid #fee2e2;
  padding: 2px 8px;
  border-radius: 6px;
  cursor: pointer;
}

.overdue-warning:hover {
  background: #fee2e2;
}

/* Star Rating Animation */
.star-rating {
  font-size: 16px;
  color: #fbbf24;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  display: inline-block;
  user-select: none;
}

.star-rating:hover {
  transform: scale(1.4);
}

.star-rating.empty {
  color: var(--star-empty);
}

.star-rating.pulse {
  animation: starPulse 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes starPulse {
  0% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.6);
  }

  100% {
    transform: scale(1);
  }
}

/* Table Header Sorting */
.task-table th[onclick] {
  transition: background 0.2s;
}

.task-table th[onclick]:hover {
  background: var(--table-hover);
  color: var(--primary);
}

@media (max-width: 900px) {
  .main-grid {
    grid-template-columns: 1fr;
  }
}

/* Kanban Board Styles */
.kanban-board {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding-bottom: 20px;
  align-items: flex-start;
  min-height: 400px;
}

.kanban-column {
  min-width: 320px;
  max-width: 320px;
  background: var(--glass-bg);
  border: var(--glass-border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  max-height: 80vh;
}

.kanban-header {
  padding: 16px;
  font-weight: 700;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  background: inherit;
  border-radius: var(--radius) var(--radius) 0 0;
  z-index: 10;
  backdrop-filter: blur(8px);
}

.kanban-body {
  padding: 12px;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.kanban-card {
  background: var(--input-bg);
  /* Contrast against column */
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  cursor: grab;
  transition: all 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
  position: relative;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.kanban-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
  border-color: var(--primary);
}

.kanban-card:active {
  cursor: grabbing;
}

/* Floating Action Button (FAB) */
.fab-container {
  position: fixed;
  bottom: 30px;
  right: 30px;
  z-index: 500;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
}

.fab-main {
  width: 56px;
  height: 56px;
  border-radius: 28px;
  background: linear-gradient(135deg, var(--primary), var(--primary-hover));
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
  cursor: pointer;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  border: none;
}

.fab-main:hover {
  transform: scale(1.1) rotate(90deg);
}

.fab-menu {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: flex-end;
  margin-bottom: 4px;
  opacity: 0;
  transform: translateY(20px) scale(0.8);
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.fab-container.active .fab-menu {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.fab-item {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
}

.fab-label {
  background: var(--glass-bg);
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--glass-shadow-sm);
  backdrop-filter: blur(8px);
}

.fab-btn {
  width: 44px;
  height: 44px;
  border-radius: 22px;
  background: var(--glass-bg);
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  box-shadow: var(--glass-shadow-sm);
  border: 1px solid var(--border);
  transition: 0.2s;
}

.fab-btn:hover {
  background: var(--primary-light);
  color: var(--primary);
}

/* Skeleton Loading */
.skeleton {
  background: linear-gradient(90deg,
      rgba(255, 255, 255, 0.05) 25%,
      rgba(255, 255, 255, 0.1) 37%,
      rgba(255, 255, 255, 0.05) 63%);
  background-size: 400% 100%;
  animation: skeleton-loading 1.4s ease infinite;
  border-radius: 4px;
}

@keyframes skeleton-loading {
  0% {
    background-position: 100% 50%;
  }

  100% {
    background-position: 0 50%;
  }
}

/* -------------------------------------------
   New Features: Status Popover & Editor
------------------------------------------- */

/* 1. Status Popover (Notion Style) */
.status-popover-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 9998;
  /* Highest */
  background: transparent;
}

.status-popover {
  position: absolute;
  background: var(--glass-bg);
  border: 1px solid rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(16px);
  border-radius: 8px;
  padding: 6px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  z-index: 9999;
  /* Top of overlay */
  min-width: 160px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  animation: fade-in-up 0.15s ease-out;
}

.status-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  /* Bigger touch area */
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-main);
  transition: background 0.1s;
}

.status-option:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* 2. Easy Markdown Editor (Focus Mode) */
.easy-md-container {
  position: relative;
  width: 100%;
  min-height: 300px;
  border-radius: 8px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.2);
}

.easy-md-textarea {
  width: 100%;
  height: 100%;
  min-height: 300px;
  font-family: inherit;
  line-height: 1.6;
  background: transparent;
  border: none;
  color: var(--text-main);
  resize: none;
  outline: none;
  padding: 24px;
  font-size: 15px;
}

.easy-md-preview {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow-y: auto;
  padding: 24px;
  background: var(--bg-main);
  /* Non-transparent in preview */
  display: none;
}

/* Focus Mode Overrides */
.drawer.focus-mode {
  width: 100vw !important;
  max-width: 100vw !important;
  height: 100vh !important;
  top: 0 !important;
  right: 0 !important;
  border-radius: 0;
  background: var(--bg-main) !important;
  /* Hide everything behind */
  z-index: 5000 !important;
  padding: 0;
}

.drawer.focus-mode .drawer-header,
.drawer.focus-mode .drawer-footer {
  /* Optional: Hide header/footer or make them minimal */
  /* User said: "다른 배경 삭제되고 편집박스 크게 키우기" */
  /* Let's keep navbar but maybe transparent or minimal? */
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

.drawer.focus-mode .drawer-body {
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
  padding: 0;
  /* Remove padding to let editor grow */
  display: flex;
  flex-direction: column;
}

/* Hide other fields in focus mode */
.drawer.focus-mode #fields-task>div:not(:has(#easy-md-container)),
.drawer.focus-mode #fields-ann>div:not(:has(#easy-md-container)) {
  display: none;
}

/* Ensure container (which holds toolbar + editor) is visible */
/* We need to target the parent div of editor-toolbar/editor-container */

.drawer.focus-mode .easy-md-container {
  height: calc(100vh - 150px) !important;
  /* Full height minus header/footer */
  min-height: 80vh;
  background: transparent;
  /* Clean */
}

.drawer.focus-mode .easy-md-textarea,
.drawer.focus-mode .easy-md-preview {
  font-size: 18px;
  /* Larger font */
  line-height: 1.8;
  max-width: 900px;
  margin: 0 auto;
  padding: 40px;
}

/* 3. Button Hit Area Tweaks */
.quick-action {
  padding: 6px 12px;
  /* Bigger */
  min-width: 32px;
}

.status-tooltip {
  padding: 4px;
  /* Space around badge to easier click */
  border-radius: 4px;
  transition: background 0.1s;
}

.status-tooltip:hover {
  background: rgba(255, 255, 255, 0.05);
}

/* Zen Toggle Button in Toolbar */
.zen-btn {
  border: 1px solid var(--primary);
  color: var(--primary);
}

.skeleton-text {
  height: 1em;
  margin-bottom: 8px;
  width: 80%;
}

.skeleton-rect {
  width: 100%;
  height: 100%;
}

/* Glass Popover */
.popover {
  position: absolute;
  background: var(--glass-bg);
  border: var(--glass-border);
  backdrop-filter: blur(12px);
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  z-index: 2000;
  min-width: 280px;
  animation: fade-in-up 0.2s ease-out;
}

/* Focus Mode for Drawer Editor */
.drawer.focus-mode {
  width: 100vw !important;
  max-width: 100vw !important;
  height: 100vh !important;
  max-height: 100vh !important;
  border-radius: 0 !important;
  top: 0 !important;
  left: 0 !important;
  transform: none !important;
}

.drawer.focus-mode .drawer-body {
  max-height: calc(100vh - 130px);
  overflow-y: auto;
}

.drawer.focus-mode #edit-body,
.drawer.focus-mode #body-preview {
  min-height: 50vh;
}

/* Markdown Preview Styling */
#body-preview h1,
#body-preview h2,
#body-preview h3 {
  margin-top: 1em;
  margin-bottom: 0.5em;
  color: var(--text-main);
}

#body-preview p {
  margin-bottom: 0.75em;
  line-height: 1.6;
}

#body-preview ul,
#body-preview ol {
  padding-left: 1.5em;
  margin-bottom: 0.75em;
}

#body-preview img {
  max-width: 48%;
  height: auto;
  border-radius: 8px;
  margin: 8px 4px;
  display: inline-block;
  vertical-align: top;
}

#body-preview code {
  background: var(--panel-bg);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.9em;
}

#body-preview pre {
  background: var(--panel-bg);
  padding: 12px;
  border-radius: 8px;
  overflow-x: auto;
}

/* Task Table Row Effects */
.task-row {
  transition: all 0.15s ease;
  border-left: 3px solid transparent;
}

.task-row:hover {
  background: var(--table-hover);
  border-left-color: var(--primary);
}

.task-row:nth-child(even) {
  background: rgba(255, 255, 255, 0.02);
}

.task-row:nth-child(even):hover {
  background: var(--table-hover);
}

/* Star rating colors */
.star-rating {
  color: #fbbf24;
  cursor: pointer;
  transition: transform 0.1s;
}

.star-rating:hover {
  transform: scale(1.2);
}

.star-rating.empty {
  color: #3f3f46;
}

/* Filter Chips */
.filter-chip {
  padding: 4px 10px;
  font-size: 11px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-sub);
  cursor: pointer;
  transition: all 0.15s;
}

.filter-chip:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.filter-chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

/* Announcement Compact List */
.ann-row {
  display: flex;
  flex-direction: column;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.15s;
  background: transparent;
}

.ann-row:hover {
  background: var(--table-hover);
  padding-left: 18px;
  /* Slight slide effect */
}

.ann-row.ann-sortable {
  cursor: default;
}

.ann-row.ann-sortable:hover {
  padding-left: 14px;
}

.ann-row.ann-dragging {
  opacity: 0.55;
}

.ann-row.ann-drop-before {
  box-shadow: inset 0 2px 0 var(--primary);
}

.ann-row.ann-drop-after {
  box-shadow: inset 0 -2px 0 var(--primary);
}

.ann-row:last-child {
  border-bottom: none;
}

.ann-pinned {
  background: rgba(var(--primary-rgb), 0.05);
  border-left: 3px solid var(--primary);
}

.ann-pinned:hover {
  background: rgba(var(--primary-rgb), 0.1);
}

.ann-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-main);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.ann-drag-handle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  padding: 1px 4px;
  border-radius: 6px;
  border: 1px dashed transparent;
  color: var(--text-sub);
  cursor: grab;
  user-select: none;
  font-size: 13px;
  letter-spacing: -1px;
}

.ann-drag-handle:hover {
  color: var(--primary);
  border-color: rgba(var(--primary-rgb), 0.3);
  background: rgba(var(--primary-rgb), 0.08);
}

.ann-drag-handle:active {
  cursor: grabbing;
}

.ann-meta {
  font-size: 11px;
  color: var(--text-sub);
  display: flex;
  justify-content: space-between;
}

.link-highlight {
  display: inline-block;
  padding: 4px 8px;
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: 6px;
  margin: 4px 0;
  color: #3b82f6;
  text-decoration: none;
  font-weight: 500;
}

.link-highlight:hover {
  text-decoration: underline;
}

.filter-chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

/* Responsive Table Column Widths (Adjusted) */
.col-title {
  width: 15%;
  min-width: 100px;
}

.col-desc {
  width: 45%;
}

/* Increased width significantly */
.col-cat {
  width: 8%;
  min-width: 50px;
  text-align: center;
}

.col-status {
  width: 8%;
  min-width: 60px;
  text-align: center;
}

/* Reduced width (~50% less) */
.col-pri {
  width: 10%;
  min-width: 80px;
  text-align: center;
}

.col-due {
  width: 8%;
  min-width: 60px;
  text-align: center;
}

.col-action {
  width: 6%;
  min-width: 40px;
  text-align: center;
}

/* Status Tooltip Area (Hit Area increase) */
.status-tooltip {
  padding: 8px 4px;
  /* Taller vertical hit area */
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.1s;
  width: 100%;
  /* Fill cell */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.status-tooltip:hover {
  background: rgba(255, 255, 255, 0.05);
}

/* Action Menu Button */
.btn-action-menu {
  border: none;
  background: transparent;
  color: var(--text-sub);
  font-size: 16px;
  padding: 6px 10px;
  /* Bigger hit area */
  cursor: pointer;
  border-radius: 4px;
}

.btn-action-menu:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-main);
}

/* Popover for Action Menu */
.action-popover {
  position: absolute;
  background: var(--glass-bg);
  border: 1px solid var(--border);
  backdrop-filter: blur(12px);
  border-radius: 6px;
  padding: 4px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
  z-index: 3000;
  min-width: 100px;
  display: flex;
  flex-direction: column;
}

.action-option {
  padding: 8px 12px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-main);
  border-radius: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.action-option:hover {
  background: rgba(255, 255, 255, 0.1);
}

.action-option.delete {
  color: var(--error);
}

/* Mobile Responsiveness */
@media (max-width: 768px) {

  /* Layout Stacking */
  .main-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .left-panel {
    position: static;
    max-height: none;
    gap: 16px;
  }

  /* Drawer Full Width */
  .drawer,
  .drawer.centered {
    width: 100% !important;
    max-width: 100% !important;
    right: -100% !important;
    left: auto !important;
    border-radius: 0;
    margin: 0;
    height: 100vh;
    max-height: 100vh;
    top: 0;
  }

  .drawer.open,
  .drawer.centered.open {
    right: 0 !important;
    transform: none;
  }

  .drawer-header,
  .drawer-body,
  .drawer-footer {
    padding: 16px;
  }

  /* Adjust Card Padding */
  .card {
    padding: 16px;
    margin-bottom: 16px;
  }

  .task-col-resizer {
    display: none !important;
  }

  /* Adjust Table Cell Padding & Font */
  .task-table th,
  .task-table td {
    padding: 10px 4px;
    /* Tighter padding */
    font-size: 13px !important;
  }

  /* Status Badge Compact */
  .status-tooltip span:last-child {
    display: none;
    /* Hide status text label ("진행중"), keep circles only if really tight? Or keep text but small */
  }

  /* Adjust Stats Dashboard */
  .dashboard-container {
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
  }

  .stat-card {
    padding: 12px;
  }

  /* Announcements */
  .ann-row {
    padding: 12px 10px;
  }

  .ann-title {
    font-size: 13px;
  }

  .ann-drag-handle {
    font-size: 12px;
  }

  /* Hide Calendar View toggles to save space if needed, or make them scrollable */
  .calendar-section .card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .calendar-section .card-header>div:last-child {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 4px;
    justify-content: flex-start;
  }
}

/* Mobile Responsiveness */
@media (max-width: 768px) {

  /* Layout Stacking */
  .main-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .left-panel {
    position: static;
    max-height: none;
    gap: 16px;
  }

  /* Drawer Full Width */
  .drawer,
  .drawer.centered {
    width: 100% !important;
    max-width: 100% !important;
    right: -100% !important;
    left: auto !important;
    border-radius: 0;
    margin: 0;
    height: 100vh;
    max-height: 100vh;
    top: 0;
  }

  .drawer.open,
  .drawer.centered.open {
    right: 0 !important;
    transform: none;
  }

  .drawer-header {
    padding: 16px;
  }

  .drawer-body {
    padding: 16px;
  }

  /* Adjust Card Padding */
  .card {
    padding: 16px;
    margin-bottom: 16px;
  }

  .task-col-resizer {
    display: none !important;
  }

  /* Adjust Table Cell Padding */
  .task-table th,
  .task-table td {
    padding: 10px 8px;
    font-size: 13px !important;
  }

  /* Adjust Stats Dashboard */
  .dashboard-container {
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
  }

  .stat-card {
    padding: 12px;
  }

  /* Announcements */
  .ann-row {
    padding: 12px 10px;
  }

  .ann-title {
    font-size: 13px;
  }

  .ann-drag-handle {
    font-size: 12px;
  }
}

/* Event Modal Visibility */
#event-modal-overlay,
#event-modal {
  display: none;
}

#event-modal-overlay.visible {
  display: flex;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 3500;
  align-items: center;
  justify-content: center;
}

#event-modal.visible {
  display: block;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 3501;
  background: var(--drawer-bg);
  border-radius: 12px;
  box-shadow: var(--glass-shadow);
}

/* Button Text No Wrap */
.btn {
  white-space: nowrap;
}
