/* ============ 应用外壳 ============ */
#app {
  display: flex; flex-direction: column;
  height: 100vh; width: 100vw; min-width: 1280px;
}

/* ============ 顶栏 ============ */
.topbar {
  height: var(--topbar-h);
  background: linear-gradient(90deg, #2C3E50 0%, #34495E 100%);
  color: #fff;
  display: flex; align-items: center;
  padding: 0 16px;
  box-shadow: var(--shadow-md);
  z-index: 10;
  flex-shrink: 0;
}
.topbar__brand { display: flex; align-items: center; gap: 8px; margin-right: 32px; }
.logo {
  width: 30px; height: 30px; border-radius: 6px;
  background: var(--c-primary); color: #2C3E50;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 16px;
}
.logo-text { font-size: 16px; font-weight: 600; letter-spacing: 1px; }
.logo-sub { font-size: 11px; color: rgba(255,255,255,.5); margin-left: 4px; }

.topbar__company {
  display: flex; flex-direction: row; align-items: center;
  padding: 0 16px; border-left: 1px solid rgba(255,255,255,.15);
  border-right: 1px solid rgba(255,255,255,.15);
  margin-right: 16px; gap: 4px;
}
.company-select {
  background: rgba(255,255,255,.12); color: #fff;
  border: 1px solid rgba(255,255,255,.2);
  padding: 4px 8px; border-radius: var(--radius);
  min-width: 180px; max-width: 260px; cursor: pointer;
  font-size: 13px; font-weight: 500;
}
.company-select option { background: #2C3E50; color: #fff; }
#btnNewCompany {
  background: rgba(255,255,255,.12); color: #fff;
  border: 1px solid rgba(255,255,255,.2);
  font-size: 11px; padding: 3px 8px;
}
#btnNewCompany:hover { background: rgba(255,255,255,.22); }
#btnDeleteCompany {
  background: rgba(255,255,255,.08); color: rgba(255,255,255,.7);
  border: 1px solid rgba(255,255,255,.15);
  font-size: 12px; padding: 3px 7px;
}
#btnDeleteCompany:hover { background: rgba(245,108,108,.25); color: #fff; border-color: rgba(245,108,108,.5); }
#btnDeleteCompany:disabled { opacity: .35; cursor: not-allowed; }
#btnDeleteCompany:disabled:hover { background: rgba(255,255,255,.08); color: rgba(255,255,255,.7); border-color: rgba(255,255,255,.15); }

.topbar__actions { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.user-chip {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 10px 4px 4px; border-radius: 20px;
  background: rgba(255,255,255,.1); cursor: pointer;
}
.avatar {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--c-primary); color: #2C3E50;
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 12px;
}
.uname { font-size: 12px; }

.btn--ghost {
  background: transparent; color: rgba(255,255,255,.85);
  border: 1px solid rgba(255,255,255,.3);
}
.btn--ghost:hover { background: rgba(255,255,255,.1); }

/* ============ 主体区 ============ */
.body { flex: 1; display: flex; overflow: hidden; }

/* ============ 侧边栏 ============ */
.sidebar {
  width: var(--sidebar-w); flex-shrink: 0;
  background: var(--c-white);
  border-right: 1px solid var(--c-border-2);
  overflow-y: auto;
  padding: 8px 0;
}
.menu-group { margin-bottom: 4px; }
.menu-group__title {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 16px; font-size: 13px; font-weight: 500;
  color: var(--c-text-2); cursor: pointer;
  user-select: none;
}
.menu-group__title:hover { background: var(--c-bg-2); color: var(--c-text); }
.menu-group__icon {
  width: 16px; height: 16px; display: inline-flex;
  align-items: center; justify-content: center;
  color: var(--c-text-3); font-size: 14px;
}
.menu-group__arrow {
  margin-left: auto; font-size: 10px; color: var(--c-text-3);
  transition: transform .2s;
}
.menu-group.is-open .menu-group__arrow { transform: rotate(90deg); }
.menu-group__items { display: none; }
.menu-group.is-open .menu-group__items { display: block; }
.menu-item {
  display: block; padding: 7px 16px 7px 40px;
  font-size: 12.5px; color: var(--c-text-2);
  cursor: pointer; border-left: 3px solid transparent;
}
.menu-item:hover { background: var(--c-bg-2); color: var(--c-text); }
.menu-item.is-active {
  background: var(--c-primary-light); color: #7A5C00;
  border-left-color: var(--c-primary);
  font-weight: 500;
}
.menu-item--single { padding-left: 16px; }

/* ============ 主区 ============ */
.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.breadcrumb {
  height: 36px; padding: 0 20px;
  display: flex; align-items: center; gap: 6px;
  background: var(--c-white);
  border-bottom: 1px solid var(--c-border-2);
  font-size: 12px; color: var(--c-text-3);
  flex-shrink: 0;
}
.breadcrumb__sep { color: #C0C4CC; }
.breadcrumb__cur { color: var(--c-text-2); font-weight: 500; }

.content {
  flex: 1; overflow: auto;
  padding: 16px 20px;
  background: var(--c-bg);
}

/* ============ 页面通用容器 ============ */
.page { }
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}
.page-title { font-size: 16px; font-weight: 600; color: var(--c-text); }
.page-subtitle { font-size: 12px; color: var(--c-text-3); margin-top: 2px; }
.page-actions { display: flex; gap: 8px; }

.card {
  background: var(--c-white); border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm); padding: 16px;
  margin-bottom: 12px;
}
.card--no-pad { padding: 0; }
.card-title {
  font-size: 13px; font-weight: 600; color: var(--c-text);
  padding-bottom: 10px; margin-bottom: 12px;
  border-bottom: 1px solid var(--c-border-2);
  display: flex; align-items: center; justify-content: space-between;
}
.card-title__bar {
  display: inline-block; width: 3px; height: 12px;
  background: var(--c-primary); margin-right: 8px; border-radius: 2px;
  vertical-align: -1px;
}

/* 工具条 */
.toolbar {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 16px; background: var(--c-white);
  border-bottom: 1px solid var(--c-border-2);
  flex-wrap: wrap;
}
.toolbar__sep { width: 1px; height: 20px; background: var(--c-border-2); margin: 0 4px; }
.toolbar__spacer { flex: 1; }

/* ============ 登录页 ============ */
#loginScreen {
  position: fixed; inset: 0; z-index: 9999;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #2C3E50 0%, #34495E 55%, #3d566e 100%);
  overflow: auto;
}
html.is-authed #loginScreen { display: none; }
#loginScreen::before {
  content: ''; position: absolute; width: 640px; height: 640px; border-radius: 50%;
  background: radial-gradient(circle, rgba(245,197,24,.16) 0%, rgba(245,197,24,0) 68%);
  top: -180px; right: -140px; pointer-events: none;
}
#loginScreen::after {
  content: ''; position: absolute; width: 520px; height: 520px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,.06) 0%, rgba(255,255,255,0) 70%);
  bottom: -160px; left: -120px; pointer-events: none;
}
.login-card {
  position: relative; width: 380px; max-width: calc(100vw - 40px);
  background: #fff; border-radius: 12px; padding: 34px 34px 24px;
  box-shadow: 0 20px 60px rgba(0,0,0,.38);
}
.login-card.is-shake { animation: login-shake .38s; }
@keyframes login-shake {
  0%,100% { transform: translateX(0); }
  20% { transform: translateX(-9px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-5px); }
  80% { transform: translateX(4px); }
}
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 26px; }
.login-logo {
  width: 46px; height: 46px; border-radius: 10px; flex-shrink: 0;
  background: var(--c-primary); color: #2C3E50;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; font-weight: 700;
  box-shadow: 0 4px 12px rgba(245,197,24,.4);
}
.login-title { font-size: 21px; font-weight: 700; color: #2C3E50; letter-spacing: 1px; }
.login-sub { font-size: 12px; color: var(--c-text-3); margin-top: 3px; }
.login-label { display: block; font-size: 13px; color: var(--c-text-2); margin-bottom: 7px; }
.login-input-wrap { position: relative; }
.login-input {
  width: 100%; height: 42px; padding: 0 42px 0 12px;
  border: 1px solid var(--c-border); border-radius: var(--radius-md);
  font-size: 14px; color: var(--c-text); background: #fff; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.login-input:focus { border-color: var(--c-primary-dark); box-shadow: 0 0 0 3px rgba(245,197,24,.18); }
.login-toggle {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: 32px; height: 32px; border: none; background: transparent;
  font-size: 15px; color: var(--c-text-3); border-radius: var(--radius); cursor: pointer;
}
.login-toggle:hover { color: var(--c-text-2); background: var(--c-bg); }
.login-error { min-height: 18px; margin: 8px 0 2px; font-size: 12px; color: var(--c-danger); }
.login-remember {
  display: flex; align-items: center; gap: 6px; font-size: 12px;
  color: var(--c-text-2); cursor: pointer; margin-bottom: 18px; user-select: none;
}
.login-remember input { width: 14px; height: 14px; cursor: pointer; }
.login-btn {
  width: 100%; height: 44px; border: none; border-radius: var(--radius-md);
  background: var(--c-primary); color: #2C3E50;
  font-size: 15px; font-weight: 600; letter-spacing: 4px;
  cursor: pointer; transition: background .15s, transform .05s;
}
.login-btn:hover { background: var(--c-primary-dark); color: #fff; }
.login-btn:active { transform: translateY(1px); }
.login-foot { margin-top: 20px; text-align: center; font-size: 11px; color: var(--c-text-3); }
