:root {
  --panel: #ffffff;
  --page: #f8f9fc;
  --line: #eeeeef;
  --table-line: #e2e5ed;
  --table-head: #eef4ff;
  --text: #15171c;
  --muted: #666b73;
  --soft: #c8cbd0;
  --blue: #3d8df5;
  --teal: #1da3ba;
  --danger: #d63b58;
  --gold: #8c642a;
  --success: #34a853;
}

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

html,
body {
  margin: 0;
  min-height: 100%;
  background: #f0f2f5;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

body {
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  border: 0;
  background: none;
  color: inherit;
  cursor: pointer;
}

input:focus,
textarea:focus {
  outline: none;
}

/* ===== 应用外壳 ===== */
.app-shell {
  width: min(100vw, 430px);
  min-height: 100dvh;
  background: var(--panel);
  position: relative;
  box-shadow: 0 0 30px rgba(0, 0, 0, 0.08);
}

/* ===== 浏览器标题栏 ===== */
.browser-bar {
  height: 68px;
  display: grid;
  grid-template-columns: 56px 1fr 56px;
  align-items: center;
  background: #f1f1f3;
  border-bottom: 1px solid var(--line);
  padding: 0 4px;
}

.browser-title {
  text-align: center;
  line-height: 1.1;
}

.browser-title strong {
  display: block;
  font-size: 20px;
  font-weight: 700;
  color: #1a1d23;
}

.browser-title span {
  display: block;
  color: #6a6b70;
  font-size: 14px;
  margin-top: 2px;
}

.icon-button {
  width: 56px;
  height: 56px;
  position: relative;
  border-radius: 8px;
  transition: background 0.2s;
}

.icon-button:hover {
  background: rgba(0, 0, 0, 0.05);
}

.close-button::before,
.close-button::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 2px;
  height: 26px;
  background: #16181d;
  border-radius: 2px;
}

.close-button::before {
  transform: translate(-50%, -50%) rotate(45deg);
}

.close-button::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

.more-button::before {
  content: "···";
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 2px;
  color: #1a1d23;
}

/* 更多按钮下拉菜单 */
.more-dropdown {
  position: relative;
}

.more-menu {
  position: absolute;
  right: 4px;
  top: calc(100% + 8px);
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  min-width: 120px;
  padding: 4px 0;
  display: none;
  z-index: 100;
  overflow: hidden;
}

.more-menu.show {
  display: block;
}

.more-item {
  width: 100%;
  padding: 10px 16px;
  text-align: left;
  font-size: 15px;
  color: #3b3f47;
  transition: background 0.2s;
}

.more-item:hover {
  background: #f5f5f5;
}

/* ===== 主屏幕 ===== */
.screen {
  min-height: calc(100dvh - 142px);
  background: #ffffff;
}

/* ===== 页面头部 ===== */
.page-head {
  height: 64px;
  display: grid;
  grid-template-columns: 56px 1fr 56px;
  align-items: center;
  background: #fff;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
  padding: 0 4px;
}

.page-head h1 {
  margin: 0;
  text-align: center;
  font-size: 20px;
  font-weight: 700;
  color: #1a1d23;
}

.back {
  width: 56px;
  height: 56px;
  position: relative;
  border-radius: 8px;
  transition: background 0.2s;
}

.back:hover {
  background: rgba(0, 0, 0, 0.05);
}

.back::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 10px;
  height: 10px;
  border-left: 2.5px solid #202228;
  border-bottom: 2.5px solid #202228;
  transform: translate(-30%, -50%) rotate(45deg);
}

.menu-lines {
  width: 24px;
  height: 20px;
  margin: auto;
  position: relative;
}

.menu-lines::before,
.menu-lines::after {
  content: "";
  position: absolute;
  left: 0;
  width: 24px;
  border-top: 2px solid #252832;
}

.menu-lines::before {
  top: 6px;
}

.menu-lines::after {
  top: 14px;
}

/* ===== 应用首页 ===== */
.category {
  padding: 20px 0 8px;
  border-bottom: 1px solid #f1f1f3;
}

.category-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 20px 16px;
  font-size: 20px;
  font-weight: 600;
  color: #1a1d23;
}

.category-title::before {
  content: "";
  width: 4px;
  height: 20px;
  border-radius: 2px;
  background: var(--danger);
}

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

.app-tile {
  min-height: 110px;
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border-radius: 8px;
  color: #3b3f47;
  transition: background 0.2s;
}

.app-tile:active {
  background: #f5fbff;
}

.app-icon {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(160deg, #77b5ff, #4482ef);
  flex-shrink: 0;
}

.app-icon svg {
  width: 28px;
  height: 28px;
}

.app-tile span:last-child {
  font-size: 14px;
  line-height: 1.2;
  text-align: center;
  color: #3b3f47;
}

/* ===== 底部导航 ===== */
.bottom-nav {
  height: 68px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-top: 1px solid var(--line);
  background: #fff;
  position: sticky;
  bottom: 0;
  z-index: 10;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: #8e9299;
  font-size: 13px;
  transition: color 0.2s;
}

.nav-item.active {
  color: #22a8bf;
}

.nav-icon {
  width: 28px;
  height: 28px;
  display: block;
  position: relative;
}

.grid-icon {
  border: 2.5px solid currentColor;
  border-radius: 4px;
}

.grid-icon::before,
.grid-icon::after {
  content: "";
  position: absolute;
  border: 2.5px solid currentColor;
  border-radius: 4px;
}

.grid-icon::before {
  width: 8px;
  height: 8px;
  right: -10px;
  top: -2px;
  transform: rotate(45deg);
}

.grid-icon::after {
  width: 10px;
  height: 10px;
  right: -11px;
  bottom: -2px;
}

.user-icon::before,
.user-icon::after {
  content: "";
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  border: 2.5px solid currentColor;
}

.user-icon::before {
  top: 1px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.user-icon::after {
  bottom: 1px;
  width: 24px;
  height: 13px;
  border-radius: 14px 14px 3px 3px;
}

/* ===== 请假记录列表 ===== */
.record-list {
  padding: 16px 12px 24px;
  background: #f8f9fc;
}

.record-card {
  position: relative;
  padding: 18px 16px 20px;
  margin: 0 0 14px;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(32, 44, 72, 0.10);
  transition: transform 0.15s;
  cursor: pointer;
}

.record-card:active {
  transform: scale(0.99);
}

.cancel-leave-btn {
  display: inline-block;
  margin-top: 12px;
  padding: 8px 10px;
  font-size: 13px;
  font-weight: bold;
  color: #3b6db5;
  background: #ffffff;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  cursor: pointer;
  text-align: center;
}

.record-name {
  margin: 0 0 8px;
  font-size: 17px;
  font-weight: 700;
  color: #1a1d23;
}

.status-tag {
  position: absolute;
  top: 18px;
  right: 16px;
  color: var(--gold);
  font-size: 14px;
  font-weight: 700;
  background: #fef8e8;
  padding: 2px 10px;
  border-radius: 12px;
}

.status-tag.approved {
  color: #2a5a8f;
  background: transparent;
  font-weight: 550;
}

.status-tag.pending {
  color: #f59a23;
  background: #fff3e0;
}

.status-tag.rejected {
  color: var(--danger);
  background: #fce4ec;
}

.status-tag.cancelled {
  color: #6b4a1f;
  background: transparent;
  font-weight: 550;
}

.record-line {
  margin: 5px 0;
  color: #535760;
  font-size: 14px;
  line-height: 1.4;
}

.record-line a {
  color: #277ec3;
  text-decoration: none;
}

.record-line a:hover {
  text-decoration: underline;
}

/* ===== 新增按钮浮动 ===== */
.float-add {
  position: sticky;
  top: 64px;
  z-index: 5;
  display: flex;
  justify-content: flex-end;
  padding: 0 14px;
  pointer-events: none;
  height: 0;
}

.float-add button {
  pointer-events: auto;
  margin-top: 10px;
  background: rgba(255, 255, 255, 0.95);
  color: #4a4e57;
  border: 1px solid #e3e3e7;
  border-radius: 6px;
  padding: 6px 14px;
  font-size: 14px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  transition: all 0.2s;
}

.float-add button:active {
  transform: scale(0.95);
}

/* ===== 表单样式 ===== */
.form {
  background: #fff;
  padding-bottom: 80px;
}

/* 审核历史表格 */
.audit-table-wrap {
  padding: 16px 12px 20px;
  background: #f7faff;
}

.audit-title {
  padding: 14px 12px;
  text-align: center;
  background: var(--table-head);
  border: 1px solid var(--table-line);
  border-bottom: 0;
  font-size: 17px;
  font-weight: 700;
  color: #1a1d23;
  border-radius: 8px 8px 0 0;
}

.audit-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  background: #fff;
  font-size: 14px;
  border-radius: 0 0 8px 8px;
  overflow: hidden;
}

.audit-table th,
.audit-table td {
  border: 1px solid var(--table-line);
  padding: 12px 8px;
  text-align: center;
  vertical-align: middle;
  word-break: break-word;
}

.audit-table th {
  background: var(--table-head);
  font-size: 14px;
  font-weight: 700;
  color: #1a1d23;
}

.audit-table th:first-child,
.audit-table td:first-child {
  width: 26%;
  text-align: left;
}

.audit-table th:nth-child(2),
.audit-table th:nth-child(3) {
  width: 14%;
}

.audit-table th:nth-child(4) {
  width: 12%;
}

.audit-table th:last-child {
  width: 34%;
}

.audit-table .time-cell {
  padding: 0 !important;
}

.audit-table .time-cell .select-like {
  padding: 8px;
}

.audit-table .audit-time-input {
  width: 100%;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: #1a1d23;
  font-size: 14px;
}

/* 表单项 */
.field {
  min-height: 60px;
  display: grid;
  grid-template-columns: 110px 1fr;
  align-items: center;
  column-gap: 12px;
  padding: 6px 14px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.field > label {
  font-size: 16px;
  color: #17191f;
  white-space: nowrap;
  font-weight: 500;
}

.field > label.required::after {
  content: " *";
  color: var(--danger);
  font-weight: 700;
}

.field input,
.field textarea,
.field .select-like input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: #1a1d23;
  font-size: 16px;
  padding: 8px 0;
}

.field input::placeholder,
.field textarea::placeholder {
  color: #b9bbc1;
}

.field textarea {
  min-height: 48px;
  resize: vertical;
  padding: 10px 0;
  line-height: 1.6;
}

/* 单选按钮 */
.radio-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  padding: 8px 0;
}

.radio-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #4a4e57;
  font-size: 16px;
  cursor: pointer;
}

.radio-pill input {
  appearance: none;
  width: 22px;
  height: 22px;
  margin: 0;
  border: 2px solid #d5d7dc;
  border-radius: 50%;
  background: #fff;
  position: relative;
  flex-shrink: 0;
  cursor: pointer;
  transition: all 0.2s;
}

.radio-pill input:checked {
  border-color: var(--blue);
  background: var(--blue);
}

.radio-pill input:checked::after {
  content: "✔";
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) rotate(0deg) scale(1.1);
  color: #fff;
  font-size: 13px;
  font-weight: normal;
  line-height: 1;
}

.radio-pill input:checked + span {
  color: var(--blue);
}

.radio-text {
  color: #333;
}

/* 禁用状态的输入框变灰 */
.field input:disabled,
.field input[disabled] {
  color: #999;
  background-color: #fff;
  cursor: not-allowed;
}

/* 禁用状态的单选框变灰 */
.radio-pill input:disabled {
  opacity: 0.6;
}

.radio-pill input:disabled + span {
  color: #999;
}

.radio-pill input:disabled:checked {
  border-color: #999;
  background: #999;
}

.radio-pill input:disabled:checked + span {
  color: #666;
}

/* 时间选择 */
.select-like {
  display: grid;
  grid-template-columns: 1fr 20px;
  align-items: center;
  color: #8b8f98;
}

.select-like span {
  font-size: 22px;
  color: #8e9299;
  line-height: 1;
}

.select-like input[type="datetime-local"] {
  padding: 8px 0;
}

/* 文件上传 */
.upload-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 0;
  flex-wrap: wrap;
}

.upload-thumb {
  width: 80px;
  height: 80px;
  border-radius: 6px;
  border: 1px solid #eceef3;
  object-fit: cover;
  background: #f7f7f9;
  flex-shrink: 0;
}

.upload-box {
  width: 80px;
  height: 80px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  color: #c8cbd3;
  border: 2px dashed #eceef3;
  background: #fafafc;
  transition: all 0.2s;
  flex-shrink: 0;
}

.upload-box:hover {
  border-color: var(--blue);
  background: #f0f7ff;
}

.upload-box:active {
  transform: scale(0.95);
}

.camera-icon {
  width: 32px;
  height: 24px;
  position: relative;
  border-radius: 4px;
  background: #d8dbe1;
}

.camera-icon::before {
  content: "";
  position: absolute;
  left: 10px;
  top: -6px;
  width: 12px;
  height: 7px;
  border-radius: 3px 3px 0 0;
  background: #d8dbe1;
}

.camera-icon::after {
  content: "";
  position: absolute;
  left: 10px;
  top: 6px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #eff0f3;
}

.upload-file-name {
  font-size: 14px;
  color: #666b73;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 表单按钮 */
.form-actions {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: min(100vw, 430px);
  display: flex;
  justify-content: center;
  gap: 12px;
  padding: 14px 16px;
  background: #f7f7fa;
  border-top: 1px solid var(--line);
  z-index: 10;
}

.primary,
.secondary,
.danger {
  min-width: 72px;
  height: 40px;
  padding: 0 20px;
  border-radius: 6px;
  border: 1px solid transparent;
  font-size: 15px;
  font-weight: 600;
  transition: all 0.2s;
}

.primary {
  color: #fff;
  background: #1f8df5;
}

.primary:active {
  transform: scale(0.96);
  background: #1976d4;
}

.secondary {
  color: #227aad;
  background: #fff;
  border-color: #7bb9dd;
}

.secondary:active {
  transform: scale(0.96);
  background: #f5faff;
}

.danger {
  color: #fff;
  background: #cf415d;
}

.danger:active {
  transform: scale(0.96);
  background: #b8354f;
}

/* ===== 个人信息页面 ===== */
.profile {
  padding: 20px;
  background: #f8f9fc;
  min-height: calc(100dvh - 142px);
}

.profile-card {
  padding: 20px 18px;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 2px 12px rgba(37, 46, 70, 0.08);
}

.profile-card h2 {
  margin: 0 0 14px;
  font-size: 19px;
  color: #1a1d23;
}

.profile-row {
  display: grid;
  grid-template-columns: 80px 1fr;
  gap: 10px;
  padding: 10px 0;
  color: #4f535d;
  border-bottom: 1px solid #f0f0f2;
  align-items: center;
}

.profile-row:last-of-type {
  border-bottom: none;
}

.profile-row span {
  font-size: 15px;
  font-weight: 500;
  color: #4f535d;
}

.profile-row input {
  width: 100%;
  border: 0;
  outline: 0;
  color: #1a1d23;
  background: transparent;
  font-size: 15px;
  padding: 4px 0;
}

.profile-row input:focus {
  border-bottom: 2px solid var(--blue);
}

.profile .form-actions {
  position: static;
  width: auto;
  transform: none;
  margin: 18px -18px -20px;
  padding: 16px 18px;
  border-radius: 0 0 10px 10px;
}

/* ===== Toast 提示 ===== */
.toast {
  position: fixed;
  left: 50%;
  bottom: 80px;
  transform: translateX(-50%) translateY(20px);
  opacity: 0;
  pointer-events: none;
  padding: 10px 18px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.78);
  color: #fff;
  font-size: 14px;
  transition: all 0.3s ease;
  z-index: 999;
  backdrop-filter: blur(4px);
  max-width: 80%;
  text-align: center;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ===== 工具类 ===== */
.hidden {
  display: none !important;
}

.text-muted {
  color: var(--muted);
}

/* ===== 响应式 ===== */
@media (min-width: 700px) {
  body {
    background: #eef0f4;
    padding: 20px 0;
  }

  .app-shell {
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(28, 34, 46, 0.15);
    overflow: hidden;
  }

  .form-actions {
    border-radius: 0 0 16px 16px;
  }
}

@media (max-width: 380px) {
  .field {
    grid-template-columns: 90px 1fr;
    column-gap: 8px;
    padding: 4px 10px;
  }

  .field > label,
  .field input,
  .radio-pill {
    font-size: 14px;
  }

  .upload-thumb,
  .upload-box {
    width: 64px;
    height: 64px;
  }

  .audit-table {
    font-size: 12px;
  }

  .audit-table th,
  .audit-table td {
    padding: 8px 4px;
  }

  .page-head h1 {
    font-size: 18px;
  }
}

/* ===== 确认弹窗 ===== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.modal-overlay.show {
  display: flex;
}

.modal-content {
  width: 80%;
  max-width: 320px;
  background: #fff;
  border-radius: 10px;
  padding: 0;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  overflow: hidden;
}

.modal-header {
  padding: 16px 20px 12px;
  text-align: center;
}

.modal-header h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  color: #1a1d23;
}

.modal-message {
  font-size: 14px;
  color: #666;
  text-align: center;
  margin: 0;
  padding: 0 20px 16px;
  line-height: 1.6;
}

.modal-actions {
  display: flex;
}

.modal-btn {
  flex: 1;
  height: 44px;
  border: none;
  cursor: pointer;
  font-size: 16px;
  font-weight: 500;
  transition: all 0.2s;
}

.modal-cancel {
  background: #fff;
  color: #1a1d23;
}

.modal-confirm {
  background: #fff;
  color: #d63b58;
}

.modal-btn:active {
  background: #f5f5f5;
}