/* ═══════════════════════════════════════════
   优尔蓝 · 雇员自助服务 — 共享设计系统
   Tech/utility + Modern minimal
   iPhone 15 Pro: 390x844
   ═══════════════════════════════════════════ */

:root {
  /* Core palette — neutral base, single blue accent */
  --bg:      #f2f4f7;
  --surface: #ffffff;
  --fg:      #181d27;
  --muted:   #5e6672;
  --border:  #e2e5ea;
  --accent:  #2563eb;
  --accent-hover: #1d4ed8;
  --accent-light: #eef4ff;

  /* Semantic */
  --success: #16a34a;
  --success-light: #ecfdf3;
  --warning: #d97706;
  --warning-light: #fff7ed;
  --danger:  #dc2626;
  --danger-light: #fef2f2;

  /* AI assistant — restrained indigo, not purple */
  --ai-accent: #4f56e6;
  --ai-light: #eef1ff;

  /* Typography */
  --font:       -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Helvetica Neue', system-ui, sans-serif;
  --font-mono:  'SF Mono', 'JetBrains Mono', ui-monospace, Menlo, monospace;

  /* Spacing & shape */
  --safe-top: 54px;
  --safe-bottom: 34px;
  --tab-height: 56px;
  --content-padding: 16px;
  --card-radius: 12px;
  --btn-radius: 10px;
  --input-radius: 8px;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-family: var(--font);
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  color: var(--fg);
  background: var(--bg);
  overflow-x: hidden;
}

body {
  width: 100%;
  min-height: 100vh;
  max-width: 390px;
  margin: 0 auto;
  background: var(--bg);
  position: relative;
}

/* ═══════════ Status Bar ═══════════ */
.status-bar {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--safe-top);
  background: var(--bg);
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 0 24px 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--fg);
}

.status-bar .time { font-weight: 600; }
.status-bar .icons { display: flex; gap: 6px; align-items: center; }
.status-bar .icons svg { width: 15px; height: 11px; }

/* ═══════════ Navigation Bar ═══════════ */
.nav-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px var(--content-padding);
  min-height: 48px;
}

.nav-bar .back-btn {
  width: 32px;
  height: 32px;
  border: none;
  background: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  color: var(--accent);
  font-size: 20px;
  flex-shrink: 0;
}

.nav-bar .title {
  font-size: 18px;
  font-weight: 600;
  color: var(--fg);
  flex: 1;
}

/* ═══════════ Content ═══════════ */
.content {
  padding: 0 var(--content-padding) calc(var(--tab-height) + var(--safe-bottom) + 24px);
}

.content.no-tab {
  padding-bottom: calc(var(--safe-bottom) + 24px);
}

/* ═══════════ Cards ═══════════ */
.card {
  background: var(--surface);
  border-radius: var(--card-radius);
  padding: 16px;
  border: 1px solid var(--border);
}

.card:active {
  background: #f9fafb;
}

.card-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

/* ═══════════ Module Grid ═══════════ */
.module-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}

.module-card {
  background: var(--surface);
  border-radius: var(--card-radius);
  padding: 16px 14px;
  border: 1px solid var(--border);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  transition: all 0.15s ease;
  min-height: 96px;
  text-decoration: none;
  color: var(--fg);
}

.module-card:active {
  transform: scale(0.98);
  background: #f9fafb;
}

.module-card .icon-wrap {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 16px;
  font-weight: 600;
}

.module-card .label {
  font-size: 14px;
  font-weight: 600;
  color: var(--fg);
}

.module-card .hint {
  font-size: 11px;
  color: var(--muted);
}

/* ═══════════ Form Elements ═══════════ */
.form-group {
  margin-bottom: 14px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--fg);
  margin-bottom: 6px;
}

.form-input {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  font-size: 15px;
  font-family: var(--font);
  color: var(--fg);
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--input-radius);
  outline: none;
  transition: border-color 0.15s;
}

.form-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.form-input::placeholder {
  color: #b0b6c0;
}

.form-textarea {
  width: 100%;
  min-height: 100px;
  padding: 12px 14px;
  font-size: 15px;
  font-family: var(--font);
  color: var(--fg);
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--input-radius);
  outline: none;
  resize: vertical;
  transition: border-color 0.15s;
}

.form-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

select.form-input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%235e6672' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

/* ═══════════ Buttons ═══════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  padding: 0 20px;
  font-size: 15px;
  font-weight: 600;
  font-family: var(--font);
  border: none;
  border-radius: var(--btn-radius);
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
  white-space: nowrap;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  width: 100%;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-outline {
  background: var(--surface);
  color: var(--accent);
  border: 1.5px solid var(--accent);
}

.btn-ghost {
  background: transparent;
  color: var(--accent);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-sm {
  height: 32px;
  padding: 0 12px;
  font-size: 13px;
  border-radius: 8px;
}

/* ═══════════ Bottom Tab Bar ═══════════ */
.tab-bar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 390px;
  height: calc(var(--tab-height) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 100;
}

.tab-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px 10px;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--muted);
  font-family: var(--font);
  font-size: 10px;
  font-weight: 500;
  text-decoration: none;
  transition: color 0.15s;
}

.tab-item.active {
  color: var(--accent);
}

.tab-item svg {
  width: 22px;
  height: 22px;
}

/* ═══════════ Section Header ═══════════ */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0 8px;
  margin-bottom: 4px;
}

.section-header .title {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

/* ═══════════ List Item ═══════════ */
.list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  text-decoration: none;
  color: var(--fg);
}

.list-item:last-child {
  border-bottom: none;
}

.list-item .icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 600;
  flex-shrink: 0;
  color: #fff;
}

.list-item .body {
  flex: 1;
  min-width: 0;
}

.list-item .body .title {
  font-size: 15px;
  font-weight: 500;
  color: var(--fg);
}

.list-item .body .sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.list-item .trailing {
  color: var(--muted);
  font-size: 13px;
  flex-shrink: 0;
}

/* ═══════════ Badge / Tag ═══════════ */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 6px;
}

.badge-success {
  background: var(--success-light);
  color: var(--success);
}

.badge-warning {
  background: var(--warning-light);
  color: var(--warning);
}

.badge-danger {
  background: var(--danger-light);
  color: var(--danger);
}

/* ═══════════ Segmented Control ═══════════ */
.segmented-control {
  display: flex;
  background: #f3f4f6;
  border-radius: 10px;
  padding: 3px;
  margin-bottom: 16px;
}

.segmented-control .segment {
  flex: 1;
  padding: 8px 0;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  border-radius: 8px;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--muted);
  font-family: var(--font);
  transition: all 0.15s;
}

.segmented-control .segment.active {
  background: var(--surface);
  color: var(--fg);
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

/* ═══════════ Empty State ═══════════ */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
  color: var(--muted);
}

/* ═══════════ AI Float Button ═══════════ */
.ai-float-btn {
  position: fixed;
  bottom: calc(var(--tab-height) + var(--safe-bottom) + 20px);
  right: calc(50% - 185px);
  width: 50px;
  height: 50px;
  border-radius: 25px;
  background: var(--ai-accent);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(79,86,230,0.25);
  z-index: 90;
  transition: all 0.15s ease;
}

.ai-float-btn:active {
  transform: scale(0.92);
  box-shadow: 0 1px 4px rgba(79,86,230,0.15);
}

/* ═══════════ Chat ═══════════ */
.chat-area {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-bottom: 80px;
}

.chat-bubble {
  max-width: 82%;
  padding: 12px 16px;
  font-size: 14px;
  line-height: 1.5;
  border-radius: 18px;
  word-break: break-word;
}

.chat-bubble.user {
  align-self: flex-end;
  background: var(--accent);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.chat-bubble.ai {
  align-self: flex-start;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--fg);
  border-bottom-left-radius: 4px;
}

.chat-input-bar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 390px;
  padding: 8px 12px calc(var(--safe-bottom) + 4px);
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  align-items: flex-end;
  z-index: 100;
}

.chat-input-bar .input {
  flex: 1;
  min-height: 38px;
  max-height: 100px;
  padding: 8px 14px;
  font-size: 15px;
  font-family: var(--font);
  color: var(--fg);
  background: #f3f4f6;
  border: none;
  border-radius: 20px;
  outline: none;
  resize: none;
}

.chat-input-bar .send-btn {
  width: 38px;
  height: 38px;
  border-radius: 19px;
  background: var(--ai-accent);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

/* ═══════════ Quick Suggestions ═══════════ */
.quick-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.quick-chip {
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 500;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  cursor: pointer;
  color: var(--fg);
  font-family: var(--font);
  transition: all 0.15s;
}

.quick-chip:active {
  background: var(--accent-light);
  border-color: var(--accent);
  color: var(--accent);
}

/* ═══════════ Payslip ═══════════ */
.pay-summary {
  background: var(--accent);
  color: #fff;
  border-radius: var(--card-radius);
  padding: 20px;
  text-align: center;
  margin-bottom: 16px;
}

.pay-summary .month {
  font-size: 13px;
  opacity: 0.85;
  margin-bottom: 4px;
}

.pay-summary .amount {
  font-size: 40px;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  font-family: var(--font-mono);
}

.pay-summary .label {
  font-size: 12px;
  opacity: 0.75;
  margin-top: 2px;
}

.pay-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.pay-row:last-child {
  border-bottom: none;
}

.pay-row .key {
  font-size: 14px;
  color: var(--muted);
}

.pay-row .val {
  font-size: 15px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  font-family: var(--font-mono);
}

/* ═══════════ Inline SVG icon helper ═══════════ */
.icon-svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-svg-sm {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ═══════════ Utility ═══════════ */
.text-center { text-align: center; }
.text-muted { color: var(--muted); font-size: 13px; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-20 { margin-top: 20px; }
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.flex-row { display: flex; align-items: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.w-full { width: 100%; }
