:root {
  --orange: #FF7A30;
  --orange-dark: #E85F12;
  --orange-soft: #FFE8D9;
  --orange-glow: rgba(255, 122, 48, 0.18);
  --bg: #F3F2F0;
  --bg-soft: #EAE8E4;
  --card: #FFFFFF;
  --ink: #1A1A1A;
  --ink-2: #5C5C5C;
  --ink-3: #8A8A8A;
  --line: #E8E6E2;
  --green: #22A06B;
  --green-soft: #E3F7EE;
  --red: #E5484D;
  --red-soft: #FDE8E8;
  --blue: #3B82F6;
  --purple: #7C5CFC;
  --yellow: #E8A317;
  --radius: 22px;
  --radius-sm: 14px;
  --radius-xs: 10px;
  --shadow: 0 8px 28px rgba(26, 26, 26, 0.06);
  --shadow-sm: 0 2px 10px rgba(26, 26, 26, 0.04);
  --sidebar-w: 240px;
  --font: 'Plus Jakarta Sans', system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  overflow-x: clip;
}
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
  overscroll-behavior-y: contain;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
img { max-width: 100%; display: block; }

/* ===== Shell ===== */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w);
  background: #111;
  color: #fff;
  display: flex;
  flex-direction: column;
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 100;
  transition: transform .25s ease;
}
.sidebar-brand {
  display: flex; align-items: center; justify-content: space-between;
  padding: 22px 18px 16px;
}
.brand-link { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 10px;
  background: url('/assets/img/icon.png') center / contain no-repeat;
  flex-shrink: 0;
  box-shadow: none;
}
.brand-mark::after { display: none; content: none; }
.brand-logo {
  display: block;
  height: 40px;
  width: auto;
  max-width: min(220px, 70vw);
  object-fit: contain;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: 15px; letter-spacing: .02em; }
.brand-text small { color: rgba(255,255,255,.55); font-size: 11px; font-weight: 500; }
.sidebar-close { display: none; background: none; border: 0; color: #fff; font-size: 28px; cursor: pointer; }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 8px 12px 20px; }
.nav-divider {
  height: 1px;
  margin: 12px 14px;
  background: rgba(255,255,255,.12);
}
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px; border-radius: 14px;
  color: rgba(255,255,255,.62); font-size: 14px; font-weight: 500;
  transition: .15s ease;
}
.nav-item .nav-label { flex: 1; min-width: 0; }
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.is-active {
  background: var(--orange); color: #fff;
  box-shadow: 0 8px 20px rgba(255,122,48,.35);
}
.nav-item.is-active .nav-new { background: #fff; color: var(--orange-dark); }
.nav-item-hot {
  color: #fff; font-weight: 700;
  background: linear-gradient(90deg, rgba(255,122,48,.28), rgba(255,122,48,.10));
  box-shadow: inset 0 0 0 1px rgba(255,122,48,.45);
}
.nav-item-hot .nav-icon { color: var(--orange); }
.nav-item-hot:hover { background: linear-gradient(90deg, rgba(255,122,48,.4), rgba(255,122,48,.16)); color: #fff; }
.nav-item-hot.is-active { background: var(--orange); box-shadow: 0 8px 20px rgba(255,122,48,.35); }
.nav-item-hot.is-active .nav-icon { color: #fff; }
.nav-icon {
  width: 1.1em; height: 1.1em;
  flex-shrink: 0;
  font-size: 15px;
  display: inline-flex; align-items: center; justify-content: center;
  line-height: 1;
}
.nav-sub { display: none; padding: 4px 0 8px 34px; }
.nav-group.is-open .nav-sub,
.nav-group:has(.nav-item.is-active) .nav-sub { display: block; }
.nav-sub-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; border-radius: 10px;
  color: rgba(255,255,255,.5); font-size: 13px;
}
.nav-sub-item .nav-label { flex: 1; min-width: 0; }
.nav-item .nav-label { flex: 1; min-width: 0; }
.nav-ext-ico {
  margin-left: auto;
  font-size: 11px;
  opacity: .55;
  flex-shrink: 0;
}
.nav-sub-item:hover .nav-ext-ico,
.nav-item:hover .nav-ext-ico { opacity: .9; }
.nav-sub-icon {
  width: 1em; font-size: 12px; opacity: .85;
  display: inline-flex; justify-content: center;
}
.nav-sub-item:hover, .nav-sub-item.is-active { color: #fff; background: rgba(255,255,255,.06); }
.nav-new {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 2px 6px; border-radius: 999px;
  font-size: 9px; font-weight: 800; letter-spacing: .04em;
  text-transform: uppercase; line-height: 1.2;
  background: #FF5A1F; color: #fff;
  box-shadow: 0 0 0 1px rgba(255,90,31,.25);
  flex-shrink: 0;
}
.nav-new[hidden] { display: none !important; }
.nav-sub-item.is-active .nav-new { background: #fff; color: var(--orange-dark); }
.sidebar-footer { padding: 12px; border-top: 1px solid rgba(255,255,255,.08); }
.sidebar-footer .nav-item {
  width: 100%;
  background: transparent;
  border: 0;
  cursor: pointer;
  text-align: left;
  font: inherit;
}
.sidebar-footer .nav-logout:hover { color: #fff; }
.sidebar-footer .nav-logout .nav-icon { opacity: .85; }

.main-wrap {
  flex: 1; margin-left: var(--sidebar-w);
  min-width: 0; display: flex; flex-direction: column;
}

/* ===== Topbar ===== */
.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 18px 28px 8px; position: sticky; top: 0; z-index: 50;
  background: linear-gradient(180deg, var(--bg) 70%, transparent);
}
.menu-toggle {
  display: none; flex-direction: column; gap: 5px;
  background: var(--card); border: 0; border-radius: 12px;
  width: 42px; height: 42px; padding: 11px; cursor: pointer; box-shadow: var(--shadow-sm);
}
.menu-toggle span { display: block; height: 2px; background: var(--ink); border-radius: 2px; }
.topbar-search {
  flex: 1; max-width: 420px; position: relative;
  background: var(--card); border-radius: 999px;
  display: flex; align-items: center; gap: 10px;
  padding: 0 16px; box-shadow: var(--shadow-sm); height: 46px;
}
.topbar-search .topbar-ico,
.topbar-search i {
  color: var(--ink-3); flex-shrink: 0; font-size: 14px;
}
.topbar-search input {
  border: 0; outline: 0; background: transparent; width: 100%;
  font-size: 14px; color: var(--ink);
}
.search-results {
  position: absolute; left: 0; right: 0; top: calc(100% + 8px);
  background: var(--card); border-radius: var(--radius-sm);
  box-shadow: var(--shadow); padding: 8px; z-index: 60; max-height: 320px; overflow: auto;
}
.search-results a {
  display: block; padding: 10px 12px; border-radius: 10px; font-size: 13px;
}
.search-results a:hover { background: var(--bg); }
.search-results .meta { color: var(--ink-3); font-size: 11px; }

.topbar-actions { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.icon-btn {
  position: relative; width: 42px; height: 42px; border-radius: 50%;
  border: 0; background: var(--card); cursor: pointer;
  display: grid; place-items: center; box-shadow: var(--shadow-sm);
  font-size: 16px; color: var(--ink-2);
}
.icon-btn:hover { color: var(--ink); }
.icon-btn svg { width: 18px; height: 18px; }
.badge-dot {
  position: absolute; top: 8px; right: 8px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--red); display: none;
}
.badge-dot.show { display: block; }
.badge-count {
  position: absolute; top: 4px; right: 2px;
  min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 999px; background: var(--orange); color: #fff;
  font-size: 10px; font-weight: 700; line-height: 16px; text-align: center;
  box-shadow: 0 0 0 2px var(--bg);
}
.todo-menu { position: relative; }
.todo-panel {
  position: absolute; top: calc(100% + 10px); right: 0;
  width: min(380px, calc(100vw - 32px));
  background: var(--card); border-radius: 16px;
  box-shadow: var(--shadow-lg, 0 18px 48px rgba(20,20,20,.16));
  border: 1px solid rgba(0,0,0,.06);
  z-index: 80; overflow: hidden;
}
.todo-panel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 14px 10px; border-bottom: 1px solid var(--line, #EEE);
}
.todo-panel-head strong { font-size: 14px; }
.todo-panel-actions { display: flex; gap: 4px; align-items: center; }
.todo-panel-body { max-height: min(420px, 55vh); overflow-y: auto; padding: 6px 0; }
.todo-panel-foot {
  padding: 10px 14px 14px; border-top: 1px solid var(--line, #EEE);
}
.todo-panel-foot .btn { width: 100%; justify-content: center; }
.todo-item {
  appearance: none; border: 0; background: transparent; width: 100%; text-align: left;
  display: grid; grid-template-columns: 1fr auto;
  gap: 10px; align-items: start;
  padding: 10px 14px; cursor: pointer; font: inherit; color: inherit;
}
.todo-item:hover { background: var(--bg); }
.todo-item:focus-visible { outline: 2px solid var(--orange); outline-offset: -2px; }
.todo-item .todo-item-main { min-width: 0; }
.todo-item .ttl { font-size: 13px; font-weight: 600; color: var(--ink); line-height: 1.35; }
.todo-item .meta { font-size: 11px; color: var(--ink-3); margin-top: 3px; }
.todo-item .pri {
  font-size: 10px; font-weight: 700; padding: 2px 6px; border-radius: 999px;
  background: #F3F4F6; color: #6B7280; white-space: nowrap;
}
.todo-item .pri.is-high { background: #FFF1E8; color: #C2410C; }
.todo-item .pri.is-urgent { background: #FEE2E2; color: #B91C1C; }
.todo-item.is-delayed .ttl { color: #B91C1C; }
.todo-item a.src { color: var(--orange); text-decoration: none; }
.todo-item a.src:hover { text-decoration: underline; }

.due-date-field .due-presets {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-top: 8px;
}
.due-preset {
  border: 1px solid #E5E7EB; background: #fff; color: #4B5563;
  border-radius: 999px; padding: 4px 10px;
  font-size: 12px; font-weight: 600; cursor: pointer;
  line-height: 1.3;
}
.due-preset:hover { border-color: var(--orange); color: var(--orange); }
.due-preset.is-active {
  background: #FFF1E8; border-color: var(--orange); color: #C2410C;
}
.due-hint {
  margin-top: 6px; font-size: 11px; color: var(--ink-3, #8A8A8A);
}
.user-chip {
  display: flex; align-items: center; gap: 10px;
  background: var(--card); padding: 6px 14px 6px 6px;
  border-radius: 999px; box-shadow: var(--shadow-sm);
  border: 0; cursor: pointer; font: inherit; color: inherit; text-align: left;
}
.user-chip:hover { box-shadow: var(--shadow); }
.user-chip:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, var(--orange), #FFB347);
  color: #fff; display: grid; place-items: center;
  font-weight: 700; font-size: 14px;
  object-fit: cover; flex-shrink: 0;
}
img.avatar, .avatar-img {
  padding: 0; background: #E5E7EB; display: block;
}

.person-link, .person-chip {
  appearance: none; border: 0; background: transparent; padding: 0;
  display: inline-flex; align-items: center; gap: 8px;
  font: inherit; font-size: 13px; font-weight: 600; color: #111;
  cursor: pointer; border-radius: 999px; max-width: 100%;
  vertical-align: middle; text-align: left;
}
.person-chip { cursor: default; font-weight: 600; color: #374151; }
.person-link:hover span { text-decoration: underline; }
.person-link:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; }
.person-link .avatar, .person-chip .avatar { flex-shrink: 0; }
.person-link span, .person-chip span {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.emp-card { display: flex; flex-direction: column; gap: 14px; }
.emp-card-head { display: flex; align-items: center; gap: 14px; }
.emp-card-meta { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.emp-card-meta strong { font-size: 18px; font-weight: 800; letter-spacing: -.02em; }
.emp-card-meta span { font-size: 13px; color: #6B7280; }
.emp-card-rows {
  border: 1px solid #EEE; border-radius: 14px; overflow: hidden; background: #FAFAFA;
}
.emp-card-row {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 10px 14px; border-bottom: 1px solid #EEE; font-size: 13px;
}
.emp-card-row:last-child { border-bottom: 0; }
.emp-card-row span { color: #8A8A8A; }
.emp-card-row strong { font-weight: 700; color: #111; text-align: right; word-break: break-all; }
.emp-card-hint { margin: 0; font-size: 12px; color: #6B7280; line-height: 1.45; }

.avatar-editor {
  display: flex; align-items: center; gap: 14px;
  padding: 12px; border: 1px solid #EEE; border-radius: 14px;
  background: #FAFAFA; margin-bottom: 4px;
}
.avatar-editor .preview {
  width: 72px; height: 72px; border-radius: 50%;
  object-fit: cover; background: linear-gradient(135deg, var(--orange), #FFB347);
  color: #fff; display: grid; place-items: center;
  font-weight: 800; font-size: 28px; flex-shrink: 0;
}
.avatar-editor .preview.is-img { background: #E5E7EB; }
.avatar-editor .meta { flex: 1; min-width: 0; }
.avatar-editor .meta .hint { font-size: 12px; color: #8A8A8A; margin-top: 4px; line-height: 1.4; }
.avatar-editor .actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.user-meta { display: flex; flex-direction: column; line-height: 1.2; }
.user-meta strong { font-size: 13px; }
.user-meta small { font-size: 11px; color: var(--ink-3); }
.logout-link { color: var(--ink-3); font-size: 14px; padding: 4px 6px; }
.logout-link:hover { color: var(--ink); }

.page-content { padding: 12px 28px 40px; flex: 1; }

/* ===== Cards / UI ===== */
.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px; margin-bottom: 22px; flex-wrap: wrap;
}
.page-head h1 {
  margin: 0; font-size: 28px; font-weight: 800; letter-spacing: -.02em;
  display: flex; align-items: center; gap: 10px;
}
.page-head h1 > i {
  color: var(--orange); font-size: .78em; line-height: 1;
}
.page-head .sub { color: var(--ink-2); margin-top: 4px; font-size: 14px; }
.page-head .date-chip {
  background: var(--card); padding: 10px 16px; border-radius: 999px;
  font-size: 13px; color: var(--ink-2); box-shadow: var(--shadow-sm);
}

.btn i, .btn .fa-solid, .btn .fa-regular {
  font-size: .95em; line-height: 1;
}
.health-pill i { font-size: 10px; }

.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-6 { grid-template-columns: repeat(6, 1fr); }

.card {
  background: var(--card); border-radius: var(--radius);
  padding: 22px; box-shadow: var(--shadow-sm);
}
.card-orange {
  background: linear-gradient(145deg, #FF8A45, var(--orange-dark));
  color: #fff; box-shadow: 0 12px 30px var(--orange-glow);
}
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 16px;
}
.card-head h3 { margin: 0; font-size: 16px; font-weight: 700; }
.card-head .muted { color: var(--ink-3); font-size: 12px; }

.kpi-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; margin-bottom: 18px; }
.kpi {
  background: var(--card); border-radius: var(--radius);
  padding: 18px 20px; box-shadow: var(--shadow-sm);
  position: relative; overflow: hidden;
}
.kpi::after {
  content: ''; position: absolute; right: -10px; top: -10px;
  width: 70px; height: 70px; border-radius: 50%;
  background: var(--orange-soft); opacity: .55;
}
.kpi .label { font-size: 12px; color: var(--ink-3); font-weight: 600; margin-bottom: 8px; position: relative; }
.kpi .value { font-size: 26px; font-weight: 800; letter-spacing: -.03em; position: relative; }
.kpi .hint { font-size: 12px; color: var(--ink-2); margin-top: 6px; position: relative; }
.trend {
  display: inline-flex; align-items: center; gap: 2px;
  padding: 3px 8px; border-radius: 999px; font-size: 11px; font-weight: 700;
}
.trend.up { background: var(--green-soft); color: var(--green); }
.trend.down { background: var(--red-soft); color: var(--red); }
.trend.warn { background: #FFF3D6; color: var(--yellow); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 0; border-radius: 999px; padding: 10px 18px;
  font-weight: 600; font-size: 13px; cursor: pointer;
  transition: .15s ease;
}
.btn-primary { background: var(--orange); color: #fff; }
.btn-primary:hover { background: var(--orange-dark); }
.btn-white { background: #fff; color: var(--ink); }
.btn-ghost { background: var(--bg); color: var(--ink); }
.btn-dark { background: #111; color: #fff; }
.btn-sm { padding: 7px 12px; font-size: 12px; }
.btn-block { width: 100%; }

.tag {
  display: inline-flex; align-items: center;
  padding: 4px 10px; border-radius: 999px;
  font-size: 11px; font-weight: 700;
  background: var(--bg); color: var(--ink-2);
}
.tag-orange { background: var(--orange-soft); color: var(--orange-dark); }
.tag-green { background: var(--green-soft); color: var(--green); }
.tag-red { background: var(--red-soft); color: var(--red); }
.tag-blue { background: #E8F0FE; color: var(--blue); }
.tag-purple { background: #EEE8FF; color: var(--purple); }
.tag-yellow { background: #FFF3D6; color: #B87A00; }

.progress {
  height: 8px; background: var(--bg-soft); border-radius: 999px; overflow: hidden;
}
.progress > span {
  display: block; height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, var(--orange), #FFB347);
}

.table-wrap { overflow-x: auto; }
table.data {
  width: 100%; border-collapse: collapse; font-size: 13px;
}
table.data th {
  text-align: left; color: var(--ink-3); font-weight: 600;
  padding: 10px 12px; border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
table.data td {
  padding: 14px 12px; border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
table.data tr:last-child td { border-bottom: 0; }
table.data tr:hover td { background: #FAFAF9; }

.form-grid { display: grid; gap: 14px; }
.form-grid.cols-2 { grid-template-columns: 1fr 1fr; }
.field label {
  display: block; font-size: 12px; font-weight: 600;
  color: var(--ink-2); margin-bottom: 6px;
}
.field input, .field select, .field textarea {
  width: 100%; border: 1px solid var(--line); background: #fff;
  border-radius: var(--radius-xs); padding: 11px 14px;
  outline: 0; transition: border .15s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--orange);
  box-shadow: 0 0 0 3px var(--orange-glow);
}
.field textarea { min-height: 90px; resize: vertical; }

/* Pipeline */
.pipeline {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(200px, 1fr);
  gap: 14px; overflow-x: auto; padding-bottom: 8px;
}
.pipe-col {
  background: var(--bg-soft); border-radius: var(--radius);
  padding: 14px; min-height: 420px;
}
.pipe-col h4 {
  margin: 0 0 12px; font-size: 13px; display: flex;
  justify-content: space-between; align-items: center;
}
.pipe-card {
  background: var(--card); border-radius: 16px; padding: 14px;
  margin-bottom: 10px; box-shadow: var(--shadow-sm); cursor: pointer;
  transition: transform .15s;
}
.pipe-card:hover { transform: translateY(-2px); }
.pipe-card .amt { font-weight: 800; font-size: 15px; margin: 6px 0 8px; }
.pipe-card .meta { font-size: 11px; color: var(--ink-3); display: flex; justify-content: space-between; }

/* Status board */
.status-board {
  display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px;
}
.status-cell {
  background: var(--bg); border-radius: 16px; padding: 16px; text-align: center;
}
.status-cell .n { font-size: 28px; font-weight: 800; }
.status-cell .l { font-size: 12px; color: var(--ink-3); margin-top: 4px; }
.status-cell.warn { background: #FFF3D6; }
.status-cell.warn .n { color: #B87A00; }
.status-cell.danger { background: var(--red-soft); }
.status-cell.danger .n { color: var(--red); }
.status-cell.ok { background: var(--green-soft); }
.status-cell.ok .n { color: var(--green); }

/* Activity feed */
.feed { display: flex; flex-direction: column; gap: 0; }
.feed-item {
  display: flex; gap: 14px; padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.feed-item:last-child { border-bottom: 0; }
.feed-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--orange); margin-top: 6px; flex-shrink: 0;
}
.feed-dot.as { background: var(--blue); }
.feed-dot.마케팅 { background: var(--purple); }
.feed-dot.계약 { background: var(--green); }
.feed-dot.회의 { background: var(--yellow); }
.feed-body { flex: 1; min-width: 0; }
.feed-body strong { font-size: 13px; display: block; }
.feed-body p { margin: 4px 0 0; font-size: 12px; color: var(--ink-2); }
.feed-time { font-size: 11px; color: var(--ink-3); white-space: nowrap; }

/* Director cards */
.director-card {
  background: var(--card); border-radius: var(--radius); padding: 20px;
  box-shadow: var(--shadow-sm);
}
.director-card h4 { margin: 0 0 14px; font-size: 16px; display: flex; align-items: center; gap: 10px; }
.stat-row { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 6px; }
.stat-row .v { font-weight: 700; }
.mini-stats {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
  margin: 14px 0; text-align: center;
}
.mini-stats div {
  background: var(--bg); border-radius: 12px; padding: 10px 6px;
}
.mini-stats .n { font-weight: 800; font-size: 16px; }
.mini-stats .l { font-size: 10px; color: var(--ink-3); margin-top: 2px; }
.next-list { font-size: 12px; color: var(--ink-2); }
.next-list li { margin-bottom: 4px; }

/* Attendance dots */
.att-grid {
  display: flex; flex-wrap: nowrap; gap: 10px;
  overflow-x: auto; -webkit-overflow-scrolling: touch;
}
.att-cell {
  background: var(--bg); border-radius: 14px; padding: 14px 10px; text-align: center;
  flex: 1 1 0; min-width: 88px;
}
.att-cell .n { font-size: 22px; font-weight: 800; }
.att-cell .l {
  font-size: 11px; color: var(--ink-3); margin-top: 4px;
  display: flex; align-items: center; justify-content: center; gap: 5px;
  flex-wrap: nowrap; white-space: nowrap;
}
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot-office { background: #22A06B; }
.dot-field { background: #3B82F6; }
.dot-work { background: #7C5CFC; }
.dot-home { background: #E8A317; }
.dot-leave { background: #A1A1A1; }

.mp-att {
  display: flex; flex-direction: column; gap: 10px;
  padding: 0; margin: 0;
  border: 0; border-radius: 0; background: transparent;
}
.mp-att-empty {
  font-size: 13px; color: #8A8A8A;
  padding: 20px; border: 1px dashed #E5E7EB; border-radius: 14px; background: #FAFAFA;
}
.mp-meta {
  font-size: 12px; color: #8A8A8A; margin-bottom: 12px;
}
.mp-tabs {
  display: grid; grid-template-columns: 1fr 1fr; gap: 4px;
  padding: 4px; margin-bottom: 16px;
  background: #F3F4F6; border-radius: 12px;
}
.mp-tab {
  appearance: none; border: 0; background: transparent; color: #6B7280;
  font: inherit; font-size: 13px; font-weight: 700;
  padding: 10px 12px; border-radius: 10px; cursor: pointer;
}
.mp-tab:hover { color: #111; }
.mp-tab.is-active {
  background: #fff; color: #111;
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
}
.mp-tab-panel[hidden] { display: none !important; }
.mp-pw-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-top: 8px; padding: 12px 14px;
  border: 1px solid #EEE; border-radius: 14px; background: #FAFAFA;
}
.mp-pw-row strong { display: block; font-size: 13px; font-weight: 700; }
.mp-pw-row span { display: block; font-size: 12px; color: #8A8A8A; margin-top: 2px; line-height: 1.4; }
.mp-pw-row .btn { flex-shrink: 0; }
.mp-pw-hint {
  margin: 0; font-size: 13px; color: #6B7280; line-height: 1.45;
  padding: 12px 14px; background: #FFF8F2; border-radius: 12px;
}
.mp-att-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.mp-att-head strong { font-size: 14px; font-weight: 800; }
.mp-att-times {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
}
.mp-att-times > div {
  background: #fff; border: 1px solid #EEE; border-radius: 12px;
  padding: 10px 12px; display: flex; flex-direction: column; gap: 2px;
}
.mp-att-times .l { font-size: 11px; color: #8A8A8A; }
.mp-att-times strong { font-size: 18px; font-weight: 800; letter-spacing: -.02em; }
.mp-att-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.mp-status-picks { display: flex; flex-wrap: wrap; gap: 6px; }
.mp-status-chip {
  appearance: none; border: 1px solid #E5E7EB; background: #fff; color: #111;
  font: inherit; font-size: 12px; font-weight: 600;
  padding: 6px 10px; border-radius: 999px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
}
.mp-status-chip:hover { border-color: #D1D5DB; background: #F9FAFB; }
.mp-status-chip.is-on {
  border-color: #111; background: #111; color: #fff;
}
.mp-status-chip.is-on .dot { box-shadow: 0 0 0 2px rgba(255,255,255,.35); }

/* Alert list */
.alert-list { display: flex; flex-direction: column; gap: 8px; }
.alert-item {
  display: flex; align-items: center; gap: 10px;
  background: #FFF8F0; border-radius: 12px; padding: 12px 14px;
  font-size: 13px; color: #8A4B12;
}
.alert-item.danger { background: var(--red-soft); color: var(--red); }
.alert-item.is-link {
  cursor: pointer; text-decoration: none;
  transition: transform .12s ease, box-shadow .12s ease;
}
.alert-item.is-link:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
  filter: brightness(0.98);
}
.alert-item.is-unread {
  font-weight: 600;
  box-shadow: inset 3px 0 0 #FF7A30;
}
.alert-go {
  margin-left: auto; font-weight: 700; opacity: .55;
}

/* AI panel */
.ai-chat { display: flex; flex-direction: column; gap: 12px; max-height: 520px; overflow-y: auto; }
.ai-bubble {
  max-width: 90%; padding: 14px 16px; border-radius: 18px;
  font-size: 13px; line-height: 1.55; white-space: pre-wrap;
}
.ai-bubble.bot { background: var(--bg); align-self: flex-start; border-bottom-left-radius: 6px; }
.ai-bubble.me { background: var(--orange); color: #fff; align-self: flex-end; border-bottom-right-radius: 6px; }
.ai-input-row { display: flex; gap: 10px; margin-top: 14px; }
.ai-input-row input { flex: 1; border: 1px solid var(--line); border-radius: 999px; padding: 12px 18px; outline: 0; }
.ai-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.ai-chips button {
  border: 0; background: var(--orange-soft); color: var(--orange-dark);
  border-radius: 999px; padding: 8px 14px; font-size: 12px; font-weight: 600; cursor: pointer;
}

/* Empty / loading */
.empty {
  text-align: center; padding: 40px 20px; color: var(--ink-3); font-size: 14px;
}
.skeleton {
  background: linear-gradient(90deg, #eee, #f7f7f7, #eee);
  background-size: 200% 100%; animation: shimmer 1.2s infinite;
  border-radius: 8px; height: 16px;
}
@keyframes shimmer { 0%{background-position:200% 0} 100%{background-position:-200% 0} }

/* Modal / Toast */
.overlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 90;
}
.overlay.show { display: block; }
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.4);
  display: none; place-items: center; z-index: 200; padding: 20px;
}
.modal-backdrop:not([hidden]) {
  display: grid;
}
.modal {
  background: #fff; border-radius: var(--radius); width: min(560px, 100%);
  max-height: 90vh; overflow: auto; box-shadow: 0 24px 60px rgba(0,0,0,.2);
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px; border-bottom: 1px solid var(--line);
}
.modal-head h3 { margin: 0; font-size: 17px; }
.modal-close { border: 0; background: none; font-size: 24px; cursor: pointer; color: var(--ink-3); }
.modal-body { padding: 22px; }
.modal-foot {
  padding: 14px 22px 20px; display: flex; justify-content: flex-end; gap: 8px;
  border-top: 1px solid var(--line);
}
.toast-wrap {
  position: fixed; right: 20px; bottom: 20px; z-index: 300;
  display: flex; flex-direction: column; gap: 8px;
}
.toast {
  background: #111; color: #fff; padding: 12px 18px; border-radius: 14px;
  font-size: 13px; box-shadow: var(--shadow); animation: slideIn .25s ease;
}
.toast.error { background: var(--red); }
.toast.success { background: var(--green); }
@keyframes slideIn { from{transform:translateY(12px);opacity:0} to{transform:none;opacity:1} }

/* Login */
.login-page {
  min-height: 100vh; display: grid; place-items: center;
  background:
    radial-gradient(ellipse at 20% 20%, rgba(255,122,48,.2), transparent 50%),
    radial-gradient(ellipse at 80% 80%, rgba(255,179,71,.18), transparent 45%),
    var(--bg);
  padding: 24px;
}
.login-card {
  width: min(420px, 100%); background: #fff; border-radius: 28px;
  padding: 40px 36px; box-shadow: var(--shadow);
}
.login-card .brand { display: flex; align-items: center; gap: 12px; margin-bottom: 28px; }
.login-card .brand-logo { height: 48px; max-width: 260px; }
.login-card h1 { margin: 0 0 6px; font-size: 24px; }
.login-card .desc { color: var(--ink-2); font-size: 14px; margin-bottom: 28px; }
.login-error {
  background: var(--red-soft); color: var(--red); padding: 12px 14px;
  border-radius: 12px; font-size: 13px; margin-bottom: 16px; display: none;
}
.login-error.show { display: block; }
.login-info {
  background: var(--orange-soft); color: var(--orange-dark); padding: 12px 14px;
  border-radius: 12px; font-size: 13px; margin-bottom: 16px; display: none;
}
.login-info.show { display: block; }
.google-login-wrap {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  margin-bottom: 8px;
}
.google-hint {
  margin: 0; font-size: 12px; color: var(--ink-3); text-align: center; line-height: 1.4;
}
.login-divider {
  display: flex; align-items: center; gap: 12px;
  margin: 18px 0; color: var(--ink-3); font-size: 12px;
}
.login-divider::before, .login-divider::after {
  content: ''; flex: 1; height: 1px; background: var(--line);
}
.login-hint {
  margin-top: 20px; padding: 14px; background: var(--bg); border-radius: 14px;
  font-size: 12px; color: var(--ink-2); line-height: 1.6;
}

.chart-box { position: relative; height: 240px; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.filters select, .filters input {
  border: 1px solid var(--line); border-radius: 999px; padding: 8px 14px;
  background: #fff; font-size: 13px;
}

/* Assignee picker chips */
.assignee-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.assignee-pick {
  appearance: none;
  border: 1px solid #E5E7EB;
  background: #fff;
  color: #111;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 6px 12px 6px 6px;
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  line-height: 1.2;
  transition: background .15s, border-color .15s, box-shadow .15s;
}
.assignee-pick:hover { border-color: #D1D5DB; background: #F9FAFB; }
.assignee-pick.is-active {
  border-color: #111;
  background: #111;
  color: #fff;
  box-shadow: 0 4px 12px rgba(0,0,0,.12);
}
.assignee-pick .avatar {
  box-shadow: 0 0 0 1px rgba(0,0,0,.06);
}
.assignee-pick.is-active .assignee-none {
  background: rgba(255,255,255,.22) !important;
  color: #fff !important;
}
.assignee-pick-name { white-space: nowrap; }

.span-2 { grid-column: span 2; }
.span-3 { grid-column: span 3; }

/* Responsive */
@media (max-width: 1200px) {
  .kpi-row { grid-template-columns: repeat(3, 1fr); }
  .status-board { grid-template-columns: repeat(3, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-6 { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 980px) {
  .sidebar {
    transform: translateX(-100%);
    width: min(var(--sidebar-w), calc(100vw - 48px));
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    padding-left: env(safe-area-inset-left);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-close { display: block; }
  .main-wrap { margin-left: 0; max-width: 100vw; }
  .menu-toggle { display: flex; flex-shrink: 0; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .kpi-row { grid-template-columns: repeat(2, 1fr); }
  .page-content {
    padding: 10px 14px max(28px, calc(20px + env(safe-area-inset-bottom) + 64px));
    max-width: 100%;
    overflow-x: clip;
  }
  .topbar {
    padding: max(10px, env(safe-area-inset-top)) 12px 8px;
    gap: 8px;
  }
  .topbar-search {
    max-width: none; min-width: 0; flex: 1; height: 42px; padding: 0 12px;
  }
  .topbar-actions { gap: 6px; flex-shrink: 0; }
  .user-meta { display: none; }
  .user-chip { padding: 4px; }
  .form-grid.cols-2 { grid-template-columns: 1fr; }
  .span-2, .span-3 { grid-column: span 1; }

  .page-head { gap: 10px; margin-bottom: 14px; align-items: flex-start; }
  .page-head > div:last-child {
    display: flex; flex-wrap: wrap; gap: 8px; width: 100%;
  }
  .page-head > div:last-child .btn { flex: 1 1 auto; min-height: 42px; }

  .filters { gap: 8px; margin-bottom: 12px; }
  .filters select, .filters input {
    max-width: 100%; min-height: 42px; font-size: 16px;
  }

  .card { padding: 14px; border-radius: 16px; }
  .table-wrap {
    margin: 0 -4px;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
  }
  table.data { font-size: 12px; }
  table.data th, table.data td { padding: 10px 8px; }

  .modal-backdrop {
    padding: 0;
    align-items: stretch;
    place-items: stretch;
  }
  .modal {
    width: 100%;
    max-width: 100%;
    min-height: 100%;
    max-height: 100%;
    border-radius: 0;
    display: flex;
    flex-direction: column;
  }
  .modal-head {
    padding: max(14px, env(safe-area-inset-top)) 16px 14px;
    flex-shrink: 0;
  }
  .modal-body {
    padding: 16px;
    flex: 1;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
  }
  .modal-foot {
    padding: 12px 16px max(16px, env(safe-area-inset-bottom));
    flex-shrink: 0;
    flex-wrap: wrap;
  }
  .modal-foot .btn { min-height: 44px; }

  .toast-wrap {
    right: 12px; left: 12px;
    bottom: max(12px, env(safe-area-inset-bottom));
    align-items: stretch;
  }
  .todo-panel {
    position: fixed;
    top: auto; bottom: 0; right: 0; left: 0;
    width: 100%;
    max-height: min(78vh, 640px);
    border-radius: 18px 18px 0 0;
    padding-bottom: env(safe-area-inset-bottom);
  }
  .todo-panel-body { max-height: min(52vh, 420px); }

  .cal-cell { min-height: 64px; }
  .chat-main, .chat-layout { min-height: 70vh; }
  .chat-bubble { max-width: 88%; }

  /* Floating install/push panels — keep content visible */
  #berpInstallPanel, #berpPushPanel {
    max-width: min(280px, calc(100vw - 24px)) !important;
    font-size: 13px !important;
  }
  #berpInstallPanel { left: max(10px, env(safe-area-inset-left)) !important; }
  #berpPushPanel { right: max(10px, env(safe-area-inset-right)) !important; }
  #berpInstallPanel, #berpPushPanel {
    bottom: max(10px, env(safe-area-inset-bottom)) !important;
  }
}
@media (max-width: 560px) {
  .kpi-row, .status-board, .grid-4, .grid-6, .mini-stats { grid-template-columns: 1fr 1fr; }
  .page-head h1 { font-size: 20px; }
  .page-head .sub { font-size: 12px; }
  .login-card { padding: 28px 22px; width: min(420px, 100%); }
  .login-page { padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom)); }
  .kpi .value { font-size: 22px; }

  /* Dense data tables → stacked cards on phones */
  table.data.mobile-cards thead { display: none; }
  table.data.mobile-cards,
  table.data.mobile-cards tbody,
  table.data.mobile-cards tr,
  table.data.mobile-cards td {
    display: block; width: 100%;
  }
  table.data.mobile-cards tr {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 12px;
    margin-bottom: 10px;
  }
  table.data.mobile-cards tr:hover td { background: transparent; }
  table.data.mobile-cards td {
    padding: 6px 0;
    border-bottom: 0;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
  }
  table.data.mobile-cards td::before {
    content: attr(data-label);
    flex: 0 0 auto;
    min-width: 52px;
    color: var(--ink-3);
    font-size: 11px;
    font-weight: 700;
    padding-top: 2px;
  }
  table.data.mobile-cards td:first-child {
    display: block;
    padding-bottom: 8px;
    margin-bottom: 4px;
    border-bottom: 1px solid var(--line);
  }
  table.data.mobile-cards td:first-child::before { display: none; }
  table.data.mobile-cards td:last-child {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 6px;
    padding-top: 10px;
    margin-top: 4px;
    border-top: 1px solid var(--line);
  }
  table.data.mobile-cards td:last-child::before { display: none; }
  table.data.mobile-cards .todo-progress { max-width: none; min-width: 0; flex: 1; }
  table.data.mobile-cards .empty { border: 0; padding: 28px 12px; }
}

/* ===== Collab / Docs / A4 print ===== */
.cal-wrap { display: grid; grid-template-columns: 1fr 280px; gap: 16px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-dow { text-align: center; font-size: 12px; color: #8A8A8A; padding: 6px; font-weight: 600; }
.cal-cell {
  min-height: 92px; background: #fff; border: 1px solid #EEE; border-radius: 10px;
  padding: 6px; cursor: pointer; position: relative;
}
.cal-cell:hover { border-color: #FF7A30; }
.cal-cell.muted { opacity: .45; }
.cal-cell.today { box-shadow: inset 0 0 0 2px #FF7A30; }
.cal-daynum { font-size: 12px; font-weight: 700; margin-bottom: 4px; }
.cal-ev {
  display: block; font-size: 10px; padding: 2px 4px; border-radius: 4px; margin-bottom: 2px;
  color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chat-layout { display: grid; grid-template-columns: 260px 1fr; gap: 0; min-height: 560px; background: #fff; border-radius: 16px; overflow: hidden; border: 1px solid #EEE; }
.chat-rooms { border-right: 1px solid #EEE; overflow: auto; background: #FAFAFA; }
.chat-room {
  padding: 12px 14px; cursor: pointer; border-bottom: 1px solid #F0F0F0;
}
.chat-room:hover, .chat-room.active { background: #FFF4EC; }
.chat-room strong { display: block; font-size: 13px; }
.chat-room small { color: #8A8A8A; font-size: 11px; }
.chat-main { display: flex; flex-direction: column; min-height: 560px; }
.chat-log { flex: 1; overflow: auto; padding: 16px; background: #F7F7F5; }
.chat-bubble { max-width: 70%; margin-bottom: 10px; padding: 10px 12px; border-radius: 14px; background: #fff; border: 1px solid #EEE; }
.chat-bubble.me { margin-left: auto; background: #FFE8D6; border-color: #FFD0B0; }
.chat-bubble .who { font-size: 11px; color: #8A8A8A; margin-bottom: 4px; }
.chat-compose { display: flex; gap: 8px; padding: 12px; border-top: 1px solid #EEE; }
.chat-compose input { flex: 1; }
.progress-bar { height: 8px; background: #EEE; border-radius: 99px; overflow: hidden; }
.progress-bar > span { display: block; height: 100%; background: linear-gradient(90deg, #FF7A30, #FFB347); }
.doc-editor {
  min-height: 70vh; background: #E8E8E4; padding: 24px; border-radius: 16px;
}
.a4-sheet {
  width: 210mm; max-width: 100%; min-height: 297mm; margin: 0 auto; background: #fff;
  padding: 18mm 16mm; box-shadow: 0 8px 32px rgba(0,0,0,.12); outline: none;
}
.a4-sheet:focus { box-shadow: 0 8px 32px rgba(255,122,48,.18); }
.a4-doc h1 { font-size: 22px; margin: 0 0 18px; }
.quote-items input, .quote-items select { width: 100%; }
.quote-items td { vertical-align: middle; }
@media (max-width: 980px) {
  .cal-wrap, .chat-layout { grid-template-columns: 1fr; }
}
@media print {
  body * { visibility: hidden !important; }
  .print-root, .print-root * { visibility: visible !important; }
  .print-root {
    position: absolute; left: 0; top: 0; width: 100%;
    background: #fff !important; box-shadow: none !important; padding: 0 !important;
  }
  .no-print { display: none !important; }
  .sidebar, .topbar, .page-head, .filters, .chat-compose, .btn { display: none !important; }
  .main-wrap { margin: 0 !important; }
  .a4-sheet { box-shadow: none !important; width: auto; min-height: auto; padding: 0; }
}
@page { size: A4; margin: 12mm; }
