:root {
  --brand-red: #c41d30; --brand-blue: #4f7abd; --brand-green: #34a154; --brand-yellow: #f5ba4a;
  --ink: #17202a; --muted: #69717b; --line: #dfe4ea; --paper: #f4f6f9;
  --card: #fff; --green: var(--brand-green); --green2: #288747; --lime: var(--brand-yellow);
  --primary: #3d639e; --primary-dark: #304f82; --danger: var(--brand-red);
  --warning: #96620b; --shadow: 0 18px 45px rgba(40,61,91,.10);
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; font-family: Pretendard, "Noto Sans KR", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color: var(--ink); background: var(--paper); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.eyebrow { display: block; font-size: 11px; font-weight: 850; letter-spacing: .14em; color: var(--primary); margin-bottom: 5px; }
.muted { color: var(--muted); }
.error { min-height: 20px; color: var(--danger); font-size: 13px; }
.login-view { min-height: 100vh; display: grid; grid-template-columns: 1.15fr .85fr; background: #f7f8fb; }
.login-brand { padding: 10vh 10vw; color: white; display: flex; flex-direction: column; justify-content: center; position: relative; overflow: hidden; }
.login-brand { background: linear-gradient(145deg, #263d66 0%, var(--brand-blue) 58%, #397f67 100%); }
.login-brand:before { content: ""; position: absolute; inset: 0; opacity: .22; background: radial-gradient(circle at 16% 18%, var(--brand-red) 0 8%, transparent 8.5%), radial-gradient(circle at 83% 18%, var(--brand-yellow) 0 10%, transparent 10.5%), radial-gradient(circle at 74% 82%, var(--brand-green) 0 14%, transparent 14.5%); }
.login-brand:after { content: ""; width: 500px; height: 500px; position: absolute; border: 110px solid rgba(245,186,74,.16); border-radius: 50%; right: -220px; bottom: -280px; }
.login-brand > * { position: relative; z-index: 1; }
.login-brand h1 { font-size: clamp(40px, 5vw, 72px); line-height: 1.12; margin: 15px 0 25px; letter-spacing: -.05em; }
.login-brand p { font-size: 18px; color: rgba(255,255,255,.78); }
.login-brand .eyebrow { color: var(--brand-yellow); }
.login-card { align-self: center; justify-self: center; width: min(420px, 84%); background: white; padding: 45px; border-radius: 24px; box-shadow: var(--shadow); }
.login-card:before { content: ""; display: block; height: 5px; margin: -45px -45px 30px; border-radius: 24px 24px 0 0; background: linear-gradient(90deg, var(--brand-red) 0 25%, var(--brand-blue) 25% 50%, var(--brand-green) 50% 75%, var(--brand-yellow) 75%); }
.login-card-logo { display: block; width: 220px; max-width: 82%; height: auto; margin-bottom: 24px; }
.login-card h2 { margin: 0 0 5px; font-size: 26px; }
.login-card label, .form-grid label { display: flex; flex-direction: column; gap: 7px; font-size: 12px; font-weight: 700; color: #53605b; margin-top: 18px; }
.login-card label.remember { flex-direction: row; align-items: center; font-weight: 600; }
.login-card label.remember input { width: 16px; height: 16px; margin: 0; accent-color: var(--brand-blue); }
input, select, textarea { border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; outline: none; background: #fff; color: var(--ink); }
input:focus, select:focus, textarea:focus { border-color: var(--brand-blue); box-shadow: 0 0 0 3px rgba(79,122,189,.14); }
textarea { min-height: 85px; resize: vertical; }
.button { border: 0; padding: 11px 17px; border-radius: 10px; font-weight: 750; }
.button.primary { background: var(--primary); color: white; box-shadow: 0 5px 14px rgba(79,122,189,.20); }
.button.primary:hover { background: var(--primary-dark); }
.button.ghost { background: #edf1ef; color: var(--ink); }
.button.danger { background: #fae9e6; color: var(--danger); }
.button.wide { width: 100%; padding: 13px; }
.app { min-height: 100vh; display: grid; grid-template-columns: 230px 1fr; }
.sidebar { background: #171c26; color: white; padding: 18px 16px 25px; position: fixed; width: 230px; height: 100vh; display: flex; flex-direction: column; z-index: 4; }
.brand { display: block; padding: 10px 10px 18px; margin-bottom: 8px; background: white; border-radius: 14px; box-shadow: inset 0 -4px 0 var(--brand-yellow); }
.brand img { display: block; width: 100%; height: auto; }
.brand span { display: block; margin-top: 4px; text-align: right; color: #59616c; font-size: 9px; font-weight: 900; letter-spacing: .22em; }
nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item { background: transparent; border: 0; color: #aeb6c3; display: flex; align-items: center; gap: 11px; padding: 11px 12px; border-radius: 10px; text-align: left; position: relative; }
.nav-item:hover { color: white; background: #242c3a; }
.nav-item.active { color: white; background: var(--primary); font-weight: 800; box-shadow: 0 6px 16px rgba(79,122,189,.24); }
.nav-item.active:before { content: ""; position: absolute; left: 0; top: 9px; bottom: 9px; width: 4px; border-radius: 0 4px 4px 0; background: var(--brand-yellow); }
.nav-icon { width: 22px; font-size: 16px; text-align: center; }
.nav-item:nth-child(4n+1) .nav-icon { color: #ef6675; }
.nav-item:nth-child(4n+2) .nav-icon { color: #82a7df; }
.nav-item:nth-child(4n+3) .nav-icon { color: #6bc184; }
.nav-item:nth-child(4n) .nav-icon { color: var(--brand-yellow); }
.nav-item.active .nav-icon { color: white; }
.sidebar-bottom { margin-top: auto; border-top: 1px solid #303746; padding: 18px 5px 0; display: flex; align-items: center; justify-content: space-between; }
.user { display: flex; align-items: center; gap: 9px; font-size: 12px; }
.user > span { width: 33px; height: 33px; display: grid; place-items: center; background: var(--primary); border-radius: 50%; color: white; font-weight: 800; box-shadow: 0 0 0 3px rgba(245,186,74,.22); }
.user small { display: block; color: #87958f; margin-top: 2px; }
.icon-button { border: 0; background: transparent; color: #94a19c; font-size: 19px; }
main { grid-column: 2; min-width: 0; }
.topbar { padding: 28px 36px 18px; display: flex; align-items: center; justify-content: space-between; background: rgba(244,246,249,.94); backdrop-filter: blur(10px); position: sticky; top: 0; z-index: 3; }
.topbar:after { content: ""; position: absolute; left: 36px; right: 36px; bottom: 0; height: 2px; background: linear-gradient(90deg, var(--brand-red), var(--brand-blue), var(--brand-green), var(--brand-yellow)); opacity: .7; }
.topbar h1 { margin: 0; font-size: 28px; letter-spacing: -.04em; }
.today { text-align: right; display: flex; flex-direction: column; font-size: 12px; color: var(--muted); }
.today b { color: var(--ink); margin-top: 3px; }
.menu-button { display: none; }
.content { padding: 10px 36px 50px; }
.hero { border-radius: 20px; background: linear-gradient(120deg, #3f649e 0%, var(--brand-blue) 48%, var(--brand-green) 130%); color: white; padding: 30px 34px; margin-bottom: 20px; position: relative; overflow: hidden; display: flex; justify-content: space-between; align-items: center; box-shadow: 0 14px 32px rgba(79,122,189,.18); }
.hero:before { content: ""; position: absolute; width: 140px; height: 140px; background: var(--brand-red); opacity: .13; border-radius: 50%; left: 42%; bottom: -105px; }
.hero:after { content: ""; position: absolute; width: 230px; height: 230px; border: 55px solid rgba(245,186,74,.22); border-radius: 50%; right: -70px; top: -110px; }
.hero h2 { margin: 4px 0 8px; font-size: 27px; letter-spacing: -.04em; }
.hero p { margin: 0; color: rgba(255,255,255,.76); }
.hero .button { position: relative; z-index: 1; background: var(--lime); color: var(--ink); }
.metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.metric, .panel { background: var(--card); border: 1px solid #e2e6ed; border-radius: 16px; box-shadow: 0 6px 18px rgba(40,61,91,.045); }
.metric { padding: 20px; border-top: 4px solid var(--brand-blue); }
.metric:nth-child(2) { border-top-color: var(--brand-green); }
.metric:nth-child(3) { border-top-color: var(--brand-yellow); }
.metric:nth-child(4) { border-top-color: var(--brand-red); }
.metric .label { font-size: 12px; color: var(--muted); font-weight: 700; }
.metric strong { display: block; font-size: 28px; margin: 9px 0 4px; letter-spacing: -.04em; }
.metric small { color: var(--muted); }
.metric.danger strong { color: var(--danger); }
.dashboard-grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: 16px; }
.panel { padding: 21px; min-width: 0; }
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 17px; }
.panel h3 { margin: 0; font-size: 17px; }
.panel-head small { color: var(--muted); }
.pipeline-bars { display: flex; flex-direction: column; gap: 13px; }
.bar-row { display: grid; grid-template-columns: 50px 1fr 82px; gap: 10px; align-items: center; font-size: 12px; }
.track { height: 9px; border-radius: 10px; background: #e9edf3; overflow: hidden; }
.fill { height: 100%; background: linear-gradient(90deg, var(--brand-blue), var(--brand-green)); border-radius: inherit; }
.list { display: flex; flex-direction: column; }
.list-item { padding: 12px 0; border-top: 1px solid #eef1ef; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.list-item:first-child { border-top: 0; padding-top: 2px; }
.list-item b { display: block; font-size: 13px; }
.list-item small { color: var(--muted); margin-top: 4px; display: block; }
.date-badge { flex: none; background: #eaf0f9; color: var(--primary); border-radius: 8px; padding: 6px 8px; font-size: 11px; font-weight: 800; }
.date-badge.overdue { color: var(--danger); background: #faecea; }
.page-actions { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; gap: 12px; }
.task-actions { display: flex; align-items: center; gap: 10px; }
.view-switch { display: inline-flex; padding: 3px; border: 1px solid var(--line); border-radius: 11px; background: white; }
.view-switch button { border: 0; border-radius: 8px; padding: 7px 13px; background: transparent; color: var(--muted); font-size: 12px; font-weight: 750; }
.view-switch button.active { background: var(--primary); color: white; box-shadow: 0 3px 9px rgba(79,122,189,.2); }
.search { width: min(350px, 60%); position: relative; }
.search input { width: 100%; padding-left: 36px; background: white; }
.search:before { content: "⌕"; position: absolute; left: 13px; top: 7px; font-size: 22px; color: var(--muted); z-index: 1; }
.table-wrap { overflow-x: auto; background: white; border: 1px solid #e2e8e4; border-radius: 15px; }
table { border-collapse: collapse; width: 100%; font-size: 13px; white-space: nowrap; }
th { background: #f8faf8; color: #65716c; font-size: 11px; text-align: left; padding: 13px 15px; border-bottom: 1px solid var(--line); }
td { padding: 13px 15px; border-bottom: 1px solid #edf1ef; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fbfcfb; }
.clickable-row { cursor: pointer; }
.link-button { padding: 0; border: 0; background: transparent; color: var(--primary); font-weight: 750; }
.badge { display: inline-flex; align-items: center; border-radius: 20px; padding: 4px 8px; font-size: 11px; font-weight: 750; background: #edf2ef; color: #50605a; }
.badge.green { background: #e3f4e8; color: #277f40; }
.badge.yellow { background: #fbf1d9; color: #9a681b; }
.badge.red { background: #f9e8e5; color: var(--danger); }
.empty { padding: 50px 20px; text-align: center; color: var(--muted); }
.task-calendar { padding: 0; overflow: hidden; }
.calendar-toolbar { min-height: 86px; display: flex; align-items: center; gap: 20px; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.calendar-toolbar h2 { margin: 0; font-size: 22px; letter-spacing: -.03em; }
.calendar-summary { display: flex; flex-direction: column; padding-left: 20px; border-left: 1px solid var(--line); font-size: 12px; }
.calendar-summary b { color: var(--primary); font-size: 16px; }
.calendar-summary span { margin-top: 2px; color: var(--muted); }
.calendar-nav { display: flex; gap: 6px; margin-left: auto; }
.calendar-nav .button { min-width: 38px; padding: 8px 11px; }
.calendar-scroll { overflow-x: auto; }
.calendar-weekdays, .calendar-grid { min-width: 840px; display: grid; grid-template-columns: repeat(7, minmax(120px, 1fr)); }
.calendar-weekdays { border-bottom: 1px solid var(--line); background: #f8fafc; }
.calendar-weekdays b { padding: 10px 12px; color: var(--muted); text-align: center; font-size: 11px; }
.calendar-weekdays b:first-child { color: var(--brand-red); }
.calendar-weekdays b:last-child { color: var(--brand-blue); }
.calendar-day { min-height: 142px; padding: 9px; border-right: 1px solid #e8ecf1; border-bottom: 1px solid #e8ecf1; background: white; }
.calendar-day:nth-child(7n) { border-right: 0; }
.calendar-day.outside { background: #fafbfc; }
.calendar-day.outside .calendar-date, .calendar-day.outside .calendar-tasks { opacity: .38; }
.calendar-day.today { background: #f5f8fd; box-shadow: inset 0 0 0 2px rgba(79,122,189,.35); }
.calendar-date { min-height: 24px; display: flex; align-items: center; justify-content: space-between; margin-bottom: 5px; font-size: 12px; font-weight: 800; }
.calendar-date b { padding: 3px 6px; border-radius: 10px; background: var(--brand-blue); color: white; font-size: 9px; }
.calendar-tasks { display: flex; flex-direction: column; gap: 4px; }
.calendar-task { width: 100%; min-width: 0; padding: 6px 7px; border: 0; border-left: 3px solid var(--brand-yellow); border-radius: 6px; background: #fff5dc; color: var(--ink); text-align: left; }
.calendar-task:hover { filter: brightness(.97); transform: translateY(-1px); }
.calendar-task span, .calendar-task small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.calendar-task span { font-size: 11px; font-weight: 750; }
.calendar-task small { margin-top: 3px; color: var(--muted); font-size: 9px; }
.calendar-task.in-progress { border-left-color: var(--brand-blue); background: #eaf0f9; }
.calendar-task.complete { border-left-color: var(--brand-green); background: #e8f5eb; color: #467151; }
.calendar-task.complete span { text-decoration: line-through; }
.calendar-task.overdue { border-left-color: var(--brand-red); background: #fae9e8; }
.calendar-legend { display: flex; gap: 16px; padding: 11px 22px 14px; color: var(--muted); font-size: 10px; }
.calendar-legend span { display: flex; align-items: center; gap: 5px; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--brand-yellow); }
.status-dot.in-progress { background: var(--brand-blue); }
.status-dot.complete { background: var(--brand-green); }
.status-dot.overdue { background: var(--brand-red); }
.kanban { display: grid; grid-template-columns: repeat(6, minmax(230px, 1fr)); gap: 13px; overflow-x: auto; padding-bottom: 10px; }
.kanban-col { background: #e9edf3; border-radius: 15px; padding: 13px; min-height: 360px; border-top: 3px solid var(--brand-blue); }
.kanban-col:nth-child(4n+2) { border-top-color: var(--brand-green); }
.kanban-col:nth-child(4n+3) { border-top-color: var(--brand-yellow); }
.kanban-col:nth-child(4n) { border-top-color: var(--brand-red); }
.kanban-head { display: flex; justify-content: space-between; align-items: center; font-size: 13px; font-weight: 800; padding: 2px 3px 11px; }
.kanban-count { background: white; border-radius: 20px; padding: 2px 7px; color: var(--muted); }
.opportunity-card { background: white; border-radius: 11px; padding: 14px; margin-bottom: 9px; box-shadow: 0 3px 9px rgba(20,40,32,.05); cursor: pointer; border: 1px solid transparent; }
.opportunity-card:hover { border-color: #a9bfdf; transform: translateY(-1px); }
.opportunity-card h4 { margin: 0 0 8px; font-size: 13px; }
.opportunity-card strong { font-size: 14px; }
.opportunity-card small { display: block; color: var(--muted); margin-top: 9px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
dialog { border: 0; border-radius: 18px; padding: 0; width: min(760px, calc(100% - 30px)); max-height: 90vh; box-shadow: 0 30px 80px rgba(0,0,0,.25); }
dialog::backdrop { background: rgba(23,32,42,.58); backdrop-filter: blur(3px); }
#entity-form { padding: 27px; overflow-y: auto; max-height: 90vh; }
.dialog-head { display: flex; justify-content: space-between; align-items: flex-start; }
.dialog-head h2 { margin: 0; font-size: 22px; }
.close { border: 0; background: #eef1ef; border-radius: 50%; width: 34px; height: 34px; font-size: 22px; color: #63706b; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.form-grid .wide { grid-column: 1 / -1; }
.image-upload { display: flex; flex-direction: column; gap: 8px; }
.image-upload img { width: 100%; max-height: 180px; object-fit: contain; border: 1px solid var(--line); border-radius: 10px; background: #f8faf8; }
.image-upload small { color: var(--muted); font-weight: 500; }
.card-thumb { width: 56px; height: 36px; object-fit: cover; border-radius: 5px; border: 1px solid var(--line); vertical-align: middle; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 22px; }
.dialog-spacer { flex: 1; }
.contact-detail { padding: 27px; overflow-y: auto; max-height: 90vh; }
.detail-card-image { display: block; margin: 22px 0; }
.detail-card-image img { display: block; width: 100%; max-height: 380px; object-fit: contain; border: 1px solid var(--line); border-radius: 14px; background: #f8faf8; }
.contact-detail-list { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; margin: 0; }
.contact-detail-list div { padding: 12px 0; border-bottom: 1px solid var(--line); }
.contact-detail-list dt { color: var(--muted); font-size: 11px; font-weight: 750; }
.contact-detail-list dd { margin: 5px 0 0; font-size: 14px; }
.detail-notes { margin-top: 20px; padding: 16px; background: #f5f7f5; border-radius: 12px; }
.detail-notes p { margin: 8px 0 0; color: #53605b; font-size: 13px; line-height: 1.6; }
.toast { position: fixed; right: 25px; bottom: 25px; background: var(--primary); color: white; border-radius: 10px; border-left: 5px solid var(--brand-yellow); padding: 13px 17px; opacity: 0; transform: translateY(15px); transition: .2s; pointer-events: none; z-index: 10; font-size: 13px; }
.toast.show { opacity: 1; transform: none; }
@media (max-width: 1000px) {
  .metrics { grid-template-columns: 1fr 1fr; }
  .dashboard-grid { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .login-view { grid-template-columns: 1fr; }
  .login-brand { display: none; }
  .login-card { width: min(420px, calc(100% - 32px)); padding: 32px 26px; }
  .login-card:before { margin: -32px -26px 26px; }
  .login-card-logo { width: 205px; max-width: 78%; }
  .app { display: block; }
  .sidebar { transform: translateX(-100%); transition: .2s; box-shadow: 10px 0 40px rgba(0,0,0,.2); }
  .sidebar.open { transform: none; }
  main { width: 100%; }
  .menu-button { display: block; border: 0; background: transparent; font-size: 22px; margin-right: 12px; }
  .topbar { justify-content: flex-start; padding: 20px; }
  .today { margin-left: auto; }
  .content { padding: 5px 16px 35px; }
  .hero { padding: 23px; align-items: flex-start; }
  .hero h2 { font-size: 22px; max-width: 75%; }
  .hero p { display: none; }
  .metrics { grid-template-columns: 1fr 1fr; gap: 9px; }
  .metric { padding: 15px; }
  .metric strong { font-size: 22px; }
  .task-page-actions { align-items: stretch; flex-direction: column; }
  .task-page-actions .search { width: 100%; }
  .task-actions { justify-content: space-between; }
  .calendar-toolbar { flex-wrap: wrap; gap: 10px; padding: 15px; }
  .calendar-summary { padding-left: 12px; }
  .calendar-nav { width: 100%; justify-content: flex-end; }
  .calendar-day { min-height: 126px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .wide { grid-column: auto; }
}
