/* ============================================================
   AXIS — Layout & screen styles
   ============================================================ */

/* ---------- App shell ---------- */
.app { display: flex; height: 100%; overflow: hidden; background: var(--canvas); }

.sidebar {
  width: var(--sidebar-w); flex: none;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  transition: width .22s cubic-bezier(.4,0,.2,1);
  position: relative; z-index: 30;
}
.sidebar.collapsed { width: var(--sidebar-w-collapsed); }

.brand { display: flex; align-items: center; gap: 11px; height: var(--topbar-h); padding: 0 18px; flex: none; }
.brand-mark {
  width: 32px; height: 32px; border-radius: 9px; flex: none;
  background: linear-gradient(145deg, var(--indigo-500), var(--indigo-700));
  display: grid; place-items: center; color: #fff;
  box-shadow: 0 2px 8px rgba(79,70,229,.35), inset 0 1px 0 rgba(255,255,255,.25);
}
.brand-mark svg { width: 19px; height: 19px; }
.brand-name { font-size: 16.5px; font-weight: 700; letter-spacing: -0.02em; color: var(--ink); }
.sidebar.collapsed .brand { padding: 0; justify-content: center; }

.nav { padding: 10px 12px; flex: 1; overflow-y: auto; overflow-x: hidden; }
.nav-section { font-size: 10.5px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--text-3); padding: 14px 12px 6px; }
.sidebar.collapsed .nav-section { opacity: 0; height: 14px; }

.nav-item {
  display: flex; align-items: center; gap: 11px;
  height: 38px; padding: 0 12px; border-radius: var(--r-md);
  color: var(--text-2); font-size: 13.5px; font-weight: 500;
  position: relative; margin-bottom: 2px; cursor: pointer;
  transition: background .14s, color .14s;
}
.nav-item svg { width: 19px; height: 19px; flex: none; }
.nav-item:hover { background: var(--surface-hover); color: var(--ink-2); }
.nav-item.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.nav-item.active::before {
  content: ''; position: absolute; left: -12px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 20px; border-radius: 0 3px 3px 0; background: var(--primary);
}
[data-theme="dark"] .nav-item.active { color: var(--indigo-300); }
.nav-label { white-space: nowrap; overflow: hidden; }
.nav-badge { margin-left: auto; font-size: 11px; font-weight: 700; color: var(--text-2); background: var(--surface-hover); border-radius: 99px; min-width: 20px; height: 18px; padding: 0 6px; display: grid; place-items: center; }
.nav-item.active .nav-badge { background: var(--indigo-100); color: var(--indigo-700); }
[data-theme="dark"] .nav-item.active .nav-badge { background: rgba(99,102,241,.25); color: var(--indigo-200); }
.sidebar.collapsed .nav-label, .sidebar.collapsed .nav-badge { display: none; }
.sidebar.collapsed .nav-item { justify-content: center; padding: 0; }
.sidebar.collapsed .nav-item.active::before { display: none; }

.sidebar-foot { padding: 12px; border-top: 1px solid var(--border); flex: none; }
.user-chip {
  display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: var(--r-md);
  cursor: pointer; transition: background .14s;
}
.user-chip:hover { background: var(--surface-hover); }
.user-chip .meta { min-width: 0; flex: 1; }
.user-chip .nm { font-size: 13px; font-weight: 600; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-chip .rl { font-size: 11.5px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar.collapsed .user-chip .meta, .sidebar.collapsed .user-chip > svg { display: none; }
.sidebar.collapsed .user-chip { justify-content: center; padding: 8px 0; }

.collapse-btn {
  position: absolute; top: 64px; right: -12px; z-index: 40;
  width: 24px; height: 24px; border-radius: 99px;
  background: var(--surface); border: 1px solid var(--border-2);
  display: grid; place-items: center; color: var(--text-2);
  box-shadow: var(--shadow-sm); transition: background .14s, color .14s;
}
.collapse-btn:hover { color: var(--primary); border-color: var(--indigo-300); }
.collapse-btn svg { width: 14px; height: 14px; transition: transform .22s; }
.sidebar.collapsed .collapse-btn svg { transform: rotate(180deg); }

/* ---------- Main column ---------- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: hidden; }

.topbar {
  height: var(--topbar-h); flex: none;
  display: flex; align-items: center; gap: 14px;
  padding: 0 24px; background: var(--surface);
  border-bottom: 1px solid var(--border); z-index: 20;
}
.search {
  display: flex; align-items: center; gap: 9px; height: 38px;
  width: 340px; max-width: 38vw; padding: 0 12px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--r-md); color: var(--text-3); cursor: text;
  transition: border-color .14s, background .14s;
}
.search:hover { border-color: var(--border-2); }
.search input { flex: 1; border: none; background: none; outline: none; font-size: 13.5px; color: var(--text); }
.search input::placeholder { color: var(--text-3); }
.topbar .spacer { flex: 1; }

.notif-dot { position: absolute; top: 6px; right: 7px; width: 8px; height: 8px; border-radius: 99px; background: var(--red-500); border: 2px solid var(--surface); }

.content { flex: 1; overflow-y: auto; overflow-x: hidden; }
.page { max-width: 1320px; margin: 0 auto; padding: 28px 32px 56px; }

/* dropdown / popover */
.pop {
  position: absolute; z-index: 60; background: var(--surface);
  border: 1px solid var(--border-2); border-radius: var(--r-lg);
  box-shadow: var(--shadow-pop); padding: 6px; min-width: 220px;
  animation: popIn .14s ease forwards;
}
.pop-item { display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 10px; border-radius: var(--r-sm); font-size: 13px; color: var(--text); cursor: pointer; }
.pop-item:hover { background: var(--surface-hover); color: var(--ink-2); }
.pop-item svg { width: 17px; height: 17px; color: var(--text-2); }
.pop-item.danger { color: var(--red-600); }
.pop-item.danger svg { color: var(--red-500); }
.pop-head { padding: 10px 10px 8px; }

/* ---------- Login ---------- */
.login { display: flex; height: 100%; background: var(--canvas); }
.login-left { flex: 1; display: grid; place-items: center; padding: 40px; position: relative; }
.login-card { width: 100%; max-width: 392px; animation: fadeUp .5s ease forwards; }
.login-logo { display: flex; align-items: center; gap: 11px; margin-bottom: 36px; }
.login-h1 { font-size: 26px; font-weight: 700; letter-spacing: -0.025em; color: var(--ink); margin-bottom: 8px; }
.login-sub { font-size: 14.5px; color: var(--text-2); margin-bottom: 30px; }

.field { margin-bottom: 16px; }
.field label { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink-2); margin-bottom: 7px; }
.input-wrap { position: relative; display: flex; align-items: center; }
.input {
  width: 100%; height: 44px; padding: 0 14px;
  background: var(--surface); border: 1px solid var(--border-2);
  border-radius: var(--r-md); font-size: 14px; color: var(--ink);
  transition: border-color .14s, box-shadow .14s;
}
.input::placeholder { color: var(--text-3); }
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--ring); outline: none; }
.input.has-icon { padding-right: 44px; }
.input.error { border-color: var(--red-500); }
.input.error:focus { box-shadow: 0 0 0 3px rgba(239,68,68,.25); }
.input-action { position: absolute; right: 6px; width: 34px; height: 34px; display: grid; place-items: center; color: var(--text-3); border-radius: var(--r-sm); }
.input-action:hover { color: var(--text); background: var(--surface-hover); }
.field-err { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--red-600); margin-top: 7px; }

.checkbox { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; user-select: none; font-size: 13px; color: var(--text); }
.checkbox input { display: none; }
.checkbox .box { width: 18px; height: 18px; border-radius: 5px; border: 1.5px solid var(--border-2); display: grid; place-items: center; color: #fff; transition: background .14s, border-color .14s; }
.checkbox input:checked + .box { background: var(--primary); border-color: var(--primary); }
.checkbox .box svg { width: 13px; height: 13px; opacity: 0; transition: opacity .12s; stroke-width: 3; }
.checkbox input:checked + .box svg { opacity: 1; }

.login-divider { display: flex; align-items: center; gap: 14px; margin: 22px 0; color: var(--text-3); font-size: 12px; }
.login-divider::before, .login-divider::after { content: ''; flex: 1; height: 1px; background: var(--border-2); }

.alert-error {
  display: flex; align-items: flex-start; gap: 9px; padding: 11px 13px; margin-bottom: 20px;
  background: var(--red-50); border: 1px solid rgba(239,68,68,.25); border-radius: var(--r-md);
  font-size: 13px; color: var(--red-700); animation: popIn .18s ease forwards;
}
[data-theme="dark"] .alert-error { color: #FCA5A5; }
.alert-error svg { width: 17px; height: 17px; flex: none; margin-top: 1px; }

.login-foot { margin-top: 28px; font-size: 13px; color: var(--text-2); text-align: center; }
.login-foot a { color: var(--primary); font-weight: 600; }

/* Right brand panel */
.login-right {
  flex: 1; max-width: 50%; position: relative; overflow: hidden;
  background: linear-gradient(150deg, #312E81 0%, #4F46E5 48%, #4338CA 100%);
  display: flex; flex-direction: column; justify-content: space-between;
  padding: 56px; color: #fff;
}
.login-right::before {
  content: ''; position: absolute; inset: 0;
  background-image:
    radial-gradient(circle at 78% 18%, rgba(255,255,255,.16), transparent 42%),
    radial-gradient(circle at 12% 88%, rgba(129,140,248,.4), transparent 46%);
}
.geo { position: absolute; inset: 0; opacity: .5; }
.brand-quote { position: relative; z-index: 2; max-width: 460px; }
.brand-quote .q { font-size: 30px; font-weight: 600; line-height: 1.25; letter-spacing: -0.02em; }
.brand-quote .q em { font-style: normal; color: var(--indigo-200); }
.brand-stats { position: relative; z-index: 2; display: flex; gap: 36px; }
.brand-stats .n { font-size: 27px; font-weight: 700; letter-spacing: -0.02em; }
.brand-stats .l { font-size: 12.5px; color: rgba(255,255,255,.72); margin-top: 2px; }
.login-topbrand { position: relative; z-index: 2; display: flex; align-items: center; gap: 11px; }
.login-topbrand .brand-name { color: #fff; }

@media (max-width: 920px) { .login-right { display: none; } .login-left { flex: 1; } }

/* ---------- Dashboard ---------- */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.greeting { font-size: 27px; font-weight: 700; letter-spacing: -0.025em; color: var(--ink); }
.greeting .wave { font-weight: 400; }
.page-date { font-size: 13.5px; color: var(--text-2); margin-top: 5px; }

.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 22px; }
.kpi { padding: 18px; display: flex; flex-direction: column; gap: 14px; transition: box-shadow .18s, transform .18s, border-color .18s; }
.kpi:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.kpi-top { display: flex; align-items: center; justify-content: space-between; }
.kpi-ico { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; }
.kpi-ico svg { width: 19px; height: 19px; }
.ico-indigo { background: var(--indigo-50); color: var(--indigo-600); }
.ico-blue   { background: var(--blue-50);   color: var(--blue-600); }
.ico-green  { background: var(--green-50);  color: var(--green-600); }
.ico-red    { background: var(--red-50);    color: var(--red-600); }
[data-theme="dark"] .ico-indigo{ color: var(--indigo-300); } [data-theme="dark"] .ico-blue{ color: #93C5FD; }
[data-theme="dark"] .ico-green { color: #6EE7B7; } [data-theme="dark"] .ico-red{ color: #FCA5A5; }
.kpi-delta { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; font-weight: 600; padding: 3px 7px; border-radius: 99px; }
.kpi-delta svg { width: 13px; height: 13px; }
.delta-up { color: var(--green-700); background: var(--green-50); }
.delta-down { color: var(--green-700); background: var(--green-50); }
.delta-flat { color: var(--text-2); background: var(--surface-hover); }
.delta-bad { color: var(--red-700); background: var(--red-50); }
[data-theme="dark"] .delta-up,[data-theme="dark"] .delta-down { color: #6EE7B7; } [data-theme="dark"] .delta-bad { color: #FCA5A5; }
.kpi-num { font-size: 32px; font-weight: 700; letter-spacing: -0.03em; color: var(--ink); line-height: 1; }
.kpi-label { font-size: 13px; font-weight: 600; color: var(--ink-2); margin-top: 7px; }
.kpi-trend { font-size: 12px; color: var(--text-3); margin-top: 2px; }

.dash-grid { display: grid; grid-template-columns: 1.55fr 1fr; gap: 16px; align-items: start; }

.panel { overflow: hidden; }
.panel-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.panel-title { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; color: var(--ink); display: flex; align-items: center; gap: 9px; }
.panel-title .cnt { font-size: 12px; font-weight: 600; color: var(--text-2); background: var(--surface-hover); border-radius: 99px; padding: 1px 8px; }
.link-btn { font-size: 12.5px; font-weight: 600; color: var(--primary); display: inline-flex; align-items: center; gap: 3px; padding: 4px 6px; border-radius: var(--r-sm); }
.link-btn:hover { background: var(--primary-soft); }
.link-btn svg { width: 14px; height: 14px; }

.stack-2 { display: flex; flex-direction: column; gap: 16px; }

/* task row */
.task-row { display: flex; align-items: center; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--border); transition: background .14s; cursor: pointer; }
.task-row:last-child { border-bottom: none; }
.task-row:hover { background: var(--surface-2); }
.check {
  width: 19px; height: 19px; border-radius: 6px; border: 1.6px solid var(--border-2); flex: none;
  display: grid; place-items: center; color: #fff; transition: background .14s, border-color .14s; cursor: pointer;
}
.check svg { width: 12px; height: 12px; opacity: 0; stroke-width: 3; transition: opacity .12s; }
.check.done { background: var(--green-500); border-color: var(--green-500); }
.check.done svg { opacity: 1; }
.prio-flag { width: 14px; height: 14px; flex: none; }
.task-main { flex: 1; min-width: 0; }
.task-title { font-size: 13.5px; font-weight: 500; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.task-title.done { color: var(--text-3); text-decoration: line-through; }
.task-meta { display: flex; align-items: center; gap: 10px; margin-top: 4px; font-size: 12px; color: var(--text-2); }
.task-meta .mi { display: inline-flex; align-items: center; gap: 4px; }
.task-meta .mi svg { width: 13px; height: 13px; }
.tag { font-size: 11px; font-weight: 600; color: var(--text-2); background: var(--surface-hover); border-radius: 5px; padding: 2px 7px; }
.due-chip { font-size: 12px; font-weight: 600; }
.due-today { color: var(--blue-600); } .due-over { color: var(--red-600); } .due-soft { color: var(--text-2); }
[data-theme="dark"] .due-today { color: #93C5FD; } [data-theme="dark"] .due-over { color: #FCA5A5; }

/* project progress card */
.pp-list { padding: 6px 0; }
.pp-item { display: block; padding: 12px 18px; border-bottom: 1px solid var(--border); cursor: pointer; transition: background .14s; }
.pp-item:last-child { border-bottom: none; }
.pp-item:hover { background: var(--surface-2); }
.pp-top { display: flex; align-items: center; gap: 10px; margin-bottom: 9px; }
.pp-badge { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; color: #fff; font-size: 11px; font-weight: 700; flex: none; }
.pp-name { font-size: 13.5px; font-weight: 600; color: var(--ink-2); flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pp-pct { font-size: 13px; font-weight: 700; color: var(--ink-2); }
.pp-bar-row { display: flex; align-items: center; gap: 12px; }
.pp-sub { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; font-size: 12px; color: var(--text-2); }

/* activity feed */
.feed { padding: 6px 18px 14px; }
.feed-item { display: flex; gap: 12px; padding: 11px 0; position: relative; }
.feed-item:not(:last-child)::after { content: ''; position: absolute; left: 15px; top: 38px; bottom: -11px; width: 1.5px; background: var(--border); }
.feed-av { z-index: 1; }
.feed-body { font-size: 13px; color: var(--text); line-height: 1.45; }
.feed-body b { font-weight: 600; color: var(--ink-2); }
.feed-body .pj { font-weight: 600; color: var(--primary); }
.feed-time { font-size: 11.5px; color: var(--text-3); margin-top: 3px; }

/* deadlines */
.dl-item { display: flex; align-items: center; gap: 12px; padding: 13px 18px; border-bottom: 1px solid var(--border); }
.dl-item:last-child { border-bottom: none; }
.dl-cal { width: 42px; height: 44px; border-radius: 9px; border: 1px solid var(--border); display: flex; flex-direction: column; align-items: center; justify-content: center; flex: none; overflow: hidden; }
.dl-cal .m { font-size: 9px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: #fff; background: var(--slate-500); width: 100%; text-align: center; padding: 1px 0; }
.dl-cal.amber .m { background: var(--amber-500); }
.dl-cal .d { font-size: 16px; font-weight: 700; color: var(--ink-2); line-height: 1; margin-top: 4px; }
.dl-body { flex: 1; min-width: 0; }
.dl-title { font-size: 13px; font-weight: 600; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dl-sub { font-size: 12px; color: var(--text-2); margin-top: 2px; }

/* empty + generic page */
.empty { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 64px 24px; }
.empty-ico { width: 56px; height: 56px; border-radius: 16px; background: var(--surface-2); border: 1px solid var(--border); display: grid; place-items: center; color: var(--text-3); margin-bottom: 16px; }
.empty-ico svg { width: 26px; height: 26px; }
.empty h3 { font-size: 16px; color: var(--ink); margin-bottom: 6px; }
.empty p { font-size: 13.5px; color: var(--text-2); max-width: 360px; margin-bottom: 18px; }

@media (max-width: 1080px) { .kpi-grid { grid-template-columns: repeat(2, 1fr); } .dash-grid { grid-template-columns: 1fr; } }
@media (max-width: 720px) { .kpi-grid { grid-template-columns: 1fr; } .page { padding: 20px 18px 48px; } .search { display: none; } }
