/* ============================================================
   ios.css - 城辉后台 · 简易版 iOS 设计系统
   所有 admin 页面共用。仅负责外观，不改变任何功能。
   ============================================================ */

:root {
    --ios-blue: #007aff;
    --ios-green: #34c759;
    --ios-red: #ff3b30;
    --ios-orange: #ff9500;
    --ios-purple: #af52de;
    --ios-teal: #5ac8fa;
    --ios-bg: #f2f2f7;
    --ios-card: #ffffff;
    --ios-label: #1c1c1e;
    --ios-gray: #8e8e93;
    --ios-gray2: #aeaeb2;
    --ios-fill: #f2f2f7;
    --ios-sep: rgba(60, 60, 67, 0.1);
    --ios-radius: 14px;
    --ios-nav-h: 56px;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'PingFang SC', 'Helvetica Neue', 'Microsoft YaHei', sans-serif;
    background: var(--ios-bg);
    color: var(--ios-label);
    min-height: 100vh;
    padding-top: var(--ios-nav-h);
    -webkit-font-smoothing: antialiased;
    font-size: 15px;
    line-height: 1.45;
}

a { color: var(--ios-blue); text-decoration: none; }
img { vertical-align: middle; }

/* ==================== 顶部导航栏（毛玻璃） ==================== */
.ios-nav {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--ios-nav-h);
    background: rgba(255, 255, 255, 0.82);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 0.5px solid var(--ios-sep);
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 12px;
    z-index: 1100;
}
.ios-nav .nav-btn {
    width: 38px; height: 38px;
    background: none; border: none;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    color: var(--ios-label);
    cursor: pointer;
    transition: background 0.15s;
    flex-shrink: 0;
}
.ios-nav .nav-btn:active { background: rgba(0, 0, 0, 0.06); }
.ios-nav .nav-btn svg { width: 22px; height: 22px; display: block; }
.ios-nav .nav-brand {
    flex: 1;
    display: flex; align-items: center; justify-content: center;
    gap: 8px;
    min-width: 0;
    text-decoration: none;
}
.ios-nav .nav-brand img {
    width: 28px; height: 28px;
    border-radius: 7px;
    object-fit: cover;
    border: 0.5px solid var(--ios-sep);
}
.ios-nav .nav-brand span {
    font-size: 17px; font-weight: 600;
    color: var(--ios-label);
    letter-spacing: -0.2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ios-nav .nav-right { margin-left: auto; display: flex; align-items: center; gap: 4px; }

/* ==================== 抽屉菜单（iOS 分组列表风） ==================== */
.ios-drawer-mask {
    position: fixed;
    top: var(--ios-nav-h); left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.25);
    z-index: 1040;
    opacity: 0; pointer-events: none;
    transition: opacity 0.28s;
}
.ios-drawer-mask.show { opacity: 1; pointer-events: auto; }

.ios-drawer {
    position: fixed;
    top: var(--ios-nav-h); left: 0; bottom: 0;
    width: 290px;
    background: var(--ios-bg);
    border-right: 0.5px solid var(--ios-sep);
    z-index: 1050;
    transform: translateX(-102%);
    transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 18px 16px 30px;
}
.ios-drawer.open { transform: translateX(0); box-shadow: 8px 0 30px rgba(0, 0, 0, 0.12); }
.ios-drawer::-webkit-scrollbar { width: 0; }

.ios-drawer .drawer-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--ios-gray);
    letter-spacing: 0.4px;
    padding: 14px 12px 6px;
    user-select: none;
}
.ios-drawer .drawer-group {
    background: var(--ios-card);
    border-radius: var(--ios-radius);
    overflow: hidden;
}
.ios-drawer a.drawer-cell {
    display: flex; align-items: center; gap: 11px;
    padding: 10px 14px;
    min-height: 46px;
    text-decoration: none;
    color: var(--ios-label);
    font-size: 15px;
    position: relative;
    transition: background 0.12s;
}
.ios-drawer a.drawer-cell:active { background: var(--ios-fill); }
.ios-drawer a.drawer-cell:not(:last-child)::after {
    content: '';
    position: absolute;
    left: 60px; right: 0; bottom: 0;
    height: 0.5px;
    background: var(--ios-sep);
}
.ios-drawer a.drawer-cell .cell-icon {
    width: 30px; height: 30px;
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    background: var(--ios-fill);
}
.ios-drawer a.drawer-cell .cell-icon img { width: 19px; height: 19px; object-fit: contain; }
.ios-drawer a.drawer-cell .cell-txt { flex: 1; min-width: 0; }
.ios-drawer a.drawer-cell .chev {
    width: 8px; height: 14px;
    flex-shrink: 0;
    color: #c7c7cc;
}
.ios-drawer a.drawer-cell.active { background: rgba(0, 122, 255, 0.08); }
.ios-drawer a.drawer-cell.active .cell-txt { color: var(--ios-blue); font-weight: 600; }
.ios-drawer a.drawer-cell.active .cell-icon { background: rgba(0, 122, 255, 0.12); }

.ios-drawer .drawer-foot { margin-top: 22px; }
.ios-drawer .drawer-foot a {
    display: flex; align-items: center; justify-content: center; gap: 7px;
    background: var(--ios-card);
    border-radius: var(--ios-radius);
    padding: 13px;
    color: var(--ios-red);
    font-size: 15px; font-weight: 500;
    text-decoration: none;
    transition: opacity 0.15s;
}
.ios-drawer .drawer-foot a:active { opacity: 0.6; }

/* ==================== 页面容器 ==================== */
.ios-wrap {
    max-width: 700px;
    margin: 0 auto;
    padding: 20px 16px 46px;
}
.ios-wrap.wide { max-width: 960px; }

/* 大标题（iOS Large Title 简化版） */
.ios-title { margin: 4px 4px 16px; }
.ios-title h1 { font-size: 26px; font-weight: 700; letter-spacing: -0.4px; }
.ios-title p { font-size: 13px; color: var(--ios-gray); margin-top: 3px; }

/* ==================== 提示条 ==================== */
.ios-alert {
    display: flex; align-items: flex-start; gap: 9px;
    padding: 12px 14px;
    border-radius: 12px;
    margin-bottom: 16px;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.5;
}
.ios-alert .a-icon { flex-shrink: 0; font-size: 15px; line-height: 1.4; }
.ios-alert.ok { background: rgba(52, 199, 89, 0.12); color: #1e7b34; }
.ios-alert.err { background: rgba(255, 59, 48, 0.1); color: #c62c23; }
.ios-alert.info { background: rgba(0, 122, 255, 0.1); color: #0556b3; }
.ios-alert.warn { background: rgba(255, 149, 0, 0.12); color: #9a5b00; }

/* ==================== 分组列表（iOS 核心组件） ==================== */
.ios-group { margin-bottom: 26px; }
.ios-group > .g-label {
    font-size: 13px;
    color: var(--ios-gray);
    padding: 0 14px 6px;
    display: flex; align-items: center; gap: 6px;
    user-select: none;
}
.ios-group > .g-label img { width: 16px; height: 16px; object-fit: contain; }
.ios-group > .g-body {
    background: var(--ios-card);
    border-radius: var(--ios-radius);
    overflow: hidden;
}
.ios-group > .g-foot {
    font-size: 12px;
    color: var(--ios-gray);
    padding: 7px 14px 0;
    line-height: 1.55;
}

/* 列表单元格 */
.ios-cell {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 14px;
    min-height: 48px;
    position: relative;
    color: var(--ios-label);
    text-decoration: none;
    background: var(--ios-card);
    width: 100%;
    border: none;
    font-family: inherit;
    font-size: 15px;
    text-align: left;
    cursor: pointer;
}
.ios-cell:not(:last-child)::after {
    content: '';
    position: absolute;
    left: 14px; right: 0; bottom: 0;
    height: 0.5px;
    background: var(--ios-sep);
    pointer-events: none;
}
.ios-cell.has-icon:not(:last-child)::after { left: 56px; }
a.ios-cell:active, button.ios-cell:active { background: var(--ios-fill); }

.ios-cell .c-icon {
    width: 30px; height: 30px;
    border-radius: 8px;
    background: var(--ios-fill);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    font-size: 15px;
}
.ios-cell .c-icon img { width: 19px; height: 19px; object-fit: contain; }
.ios-cell .c-main { flex: 1; min-width: 0; }
.ios-cell .c-title { font-size: 15px; display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.ios-cell .c-sub { font-size: 12.5px; color: var(--ios-gray); margin-top: 2px; line-height: 1.45; word-break: break-all; }
.ios-cell .c-detail {
    font-size: 14px;
    color: var(--ios-gray);
    flex-shrink: 0;
    max-width: 46%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: right;
}
.ios-cell .c-chev {
    width: 8px; height: 14px;
    color: #c7c7cc;
    flex-shrink: 0;
}
.ios-cell.destructive .c-title, .ios-cell.destructive { color: var(--ios-red); }
.ios-cell.center { justify-content: center; color: var(--ios-blue); font-weight: 500; }
.ios-cell.center.destructive { color: var(--ios-red); }

/* ==================== iOS 开关 ==================== */
.ios-switch { position: relative; display: inline-block; flex-shrink: 0; width: 51px; height: 31px; }
.ios-switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 2; }
.ios-switch .sw-track {
    position: absolute; inset: 0;
    background: #e9e9ea;
    border-radius: 999px;
    transition: background 0.22s;
    pointer-events: none;
}
.ios-switch .sw-track::after {
    content: '';
    position: absolute;
    top: 2px; left: 2px;
    width: 27px; height: 27px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18), 0 0 1px rgba(0, 0, 0, 0.1);
    transition: transform 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}
.ios-switch input:checked + .sw-track { background: var(--ios-green); }
.ios-switch input:checked + .sw-track::after { transform: translateX(20px); }
.ios-switch.blue input:checked + .sw-track { background: var(--ios-blue); }

/* ==================== 表单 ==================== */
.ios-field { padding: 10px 14px; position: relative; background: var(--ios-card); }
.ios-field:not(:last-child)::after {
    content: '';
    position: absolute;
    left: 14px; right: 0; bottom: 0;
    height: 0.5px;
    background: var(--ios-sep);
}
.ios-field > label {
    display: block;
    font-size: 12.5px;
    color: var(--ios-gray);
    font-weight: 500;
    margin-bottom: 5px;
}
.ios-field input[type="text"],
.ios-field input[type="password"],
.ios-field input[type="number"],
.ios-field input[type="url"],
.ios-field input[type="email"],
.ios-field input[type="date"],
.ios-field select,
.ios-field textarea {
    width: 100%;
    border: none;
    outline: none;
    background: transparent;
    font-family: inherit;
    font-size: 15px;
    color: var(--ios-label);
    padding: 2px 0;
}
.ios-field textarea { resize: vertical; min-height: 90px; line-height: 1.55; }
.ios-field select { appearance: none; -webkit-appearance: none; }
.ios-field .f-row { display: flex; align-items: center; gap: 10px; }
.ios-field .f-row > label { margin: 0; flex-shrink: 0; font-size: 15px; color: var(--ios-label); font-weight: 400; }
.ios-field .f-row > input, .ios-field .f-row > select { flex: 1; text-align: right; }
.ios-field .f-hint { font-size: 12px; color: var(--ios-gray2); margin-top: 5px; line-height: 1.5; }

/* 开关行 */
.ios-field.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 50px; }
.ios-field.switch-row > label { margin: 0; font-size: 15px; color: var(--ios-label); font-weight: 400; }
.ios-field.switch-row .sr-sub { font-size: 12px; color: var(--ios-gray); margin-top: 2px; }

/* ==================== 按钮 ==================== */
.ios-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    background: var(--ios-blue);
    color: #fff;
    border: none;
    border-radius: 12px;
    padding: 13px 20px;
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: opacity 0.15s, transform 0.1s;
    text-decoration: none;
    width: 100%;
    -webkit-tap-highlight-color: transparent;
}
.ios-btn:active { opacity: 0.75; transform: scale(0.985); }
.ios-btn.green { background: var(--ios-green); }
.ios-btn.red { background: var(--ios-red); }
.ios-btn.orange { background: var(--ios-orange); }
.ios-btn.gray { background: rgba(120, 120, 128, 0.16); color: var(--ios-blue); font-weight: 600; }
.ios-btn.gray.red-t { color: var(--ios-red); }
.ios-btn.sm { width: auto; padding: 7px 15px; font-size: 13.5px; border-radius: 9px; }
.ios-btn.xs { width: auto; padding: 5px 11px; font-size: 12.5px; border-radius: 8px; font-weight: 500; }
.ios-btn:disabled { opacity: 0.45; pointer-events: none; }

.ios-btn-row { display: flex; gap: 10px; }
.ios-btn-row .ios-btn { flex: 1; }

/* 表单内提交区 */
.ios-actions { padding: 2px 0 0; display: flex; flex-direction: column; gap: 10px; }

/* ==================== 徽章 ==================== */
.ios-badge {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 2.5px 9px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 600;
    line-height: 1.5;
    white-space: nowrap;
}
.ios-badge::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.ios-badge.green { background: rgba(52, 199, 89, 0.14); color: #1e7b34; }
.ios-badge.red { background: rgba(255, 59, 48, 0.12); color: #c62c23; }
.ios-badge.orange { background: rgba(255, 149, 0, 0.14); color: #9a5b00; }
.ios-badge.blue { background: rgba(0, 122, 255, 0.12); color: #0556b3; }
.ios-badge.gray { background: rgba(120, 120, 128, 0.14); color: #6d6d72; }
.ios-badge.purple { background: rgba(175, 82, 222, 0.13); color: #7d2ea3; }
.ios-badge.plain::before { display: none; }

/* ==================== 统计卡片 ==================== */
.ios-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 26px;
}
.ios-stat {
    background: var(--ios-card);
    border-radius: var(--ios-radius);
    padding: 14px 15px;
}
.ios-stat .s-num { font-size: 24px; font-weight: 700; letter-spacing: -0.5px; line-height: 1.15; }
.ios-stat .s-num.blue { color: var(--ios-blue); }
.ios-stat .s-num.green { color: var(--ios-green); }
.ios-stat .s-num.orange { color: var(--ios-orange); }
.ios-stat .s-num.red { color: var(--ios-red); }
.ios-stat .s-num.purple { color: var(--ios-purple); }
.ios-stat .s-lb { font-size: 12px; color: var(--ios-gray); margin-top: 3px; }
@media (min-width: 640px) {
    .ios-stats.c3 { grid-template-columns: repeat(3, 1fr); }
    .ios-stats.c4 { grid-template-columns: repeat(4, 1fr); }
    .ios-stats.c5 { grid-template-columns: repeat(5, 1fr); }
}

/* ==================== 分段选择器 ==================== */
.ios-segment {
    display: flex;
    background: rgba(120, 120, 128, 0.12);
    border-radius: 9px;
    padding: 2px;
    gap: 2px;
    margin-bottom: 16px;
}
.ios-segment a, .ios-segment button {
    flex: 1;
    padding: 7px 10px;
    border: none;
    background: transparent;
    border-radius: 7px;
    font-size: 13.5px;
    font-weight: 500;
    font-family: inherit;
    color: var(--ios-label);
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    transition: background 0.15s, box-shadow 0.15s;
    white-space: nowrap;
}
.ios-segment .on {
    background: #fff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12), 0 0 1px rgba(0, 0, 0, 0.04);
    font-weight: 600;
}

/* ==================== 表格（卡片化） ==================== */
.ios-table-wrap { background: var(--ios-card); border-radius: var(--ios-radius); overflow: hidden; }
.ios-table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.ios-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.ios-table th {
    text-align: left;
    font-size: 11.5px;
    font-weight: 600;
    color: var(--ios-gray);
    letter-spacing: 0.3px;
    padding: 10px 12px;
    background: var(--ios-fill);
    white-space: nowrap;
}
table.ios-table td {
    padding: 10px 12px;
    border-top: 0.5px solid var(--ios-sep);
    vertical-align: middle;
    word-break: break-all;
}
table.ios-table tr:first-child td { border-top: none; }

/* ==================== 搜索栏 ==================== */
.ios-search { display: flex; gap: 8px; margin-bottom: 16px; }
.ios-search .s-box {
    flex: 1;
    display: flex; align-items: center; gap: 7px;
    background: rgba(120, 120, 128, 0.1);
    border-radius: 10px;
    padding: 0 10px;
    min-height: 38px;
}
.ios-search .s-box svg { width: 16px; height: 16px; color: var(--ios-gray); flex-shrink: 0; }
.ios-search .s-box input {
    flex: 1;
    border: none; outline: none;
    background: transparent;
    font-size: 15px;
    font-family: inherit;
    color: var(--ios-label);
    min-width: 0;
}
.ios-search .ios-btn { width: auto; padding: 0 16px; min-height: 38px; border-radius: 10px; }

/* ==================== 弹窗 ==================== */
dialog.ios-dlg {
    border: none;
    border-radius: 16px;
    padding: 20px;
    width: calc(100% - 48px);
    max-width: 340px;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.22);
    color: var(--ios-label);
    font-family: inherit;
    font-size: 14px;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(20px);
}
dialog.ios-dlg::backdrop { background: rgba(0, 0, 0, 0.35); }
dialog.ios-dlg h3 { font-size: 17px; font-weight: 600; text-align: center; margin-bottom: 8px; }
dialog.ios-dlg p { font-size: 13.5px; color: var(--ios-gray); line-height: 1.55; margin-bottom: 14px; text-align: center; }
dialog.ios-dlg .dlg-field { margin-bottom: 12px; }
dialog.ios-dlg .dlg-field span { display: block; font-size: 12.5px; color: var(--ios-gray); margin-bottom: 5px; }
dialog.ios-dlg .dlg-field input, dialog.ios-dlg .dlg-field textarea, dialog.ios-dlg .dlg-field select {
    width: 100%;
    padding: 10px 12px;
    border: 0.5px solid var(--ios-sep);
    border-radius: 10px;
    font-size: 15px;
    font-family: inherit;
    background: var(--ios-fill);
    outline: none;
    color: var(--ios-label);
}
dialog.ios-dlg .dlg-btns { display: flex; gap: 10px; margin-top: 16px; }
dialog.ios-dlg .dlg-btns .ios-btn { flex: 1; padding: 11px; }

/* ==================== 空状态 ==================== */
.ios-empty {
    padding: 38px 20px;
    text-align: center;
    color: var(--ios-gray);
    font-size: 14px;
    background: var(--ios-card);
    border-radius: var(--ios-radius);
}
.ios-empty .e-icon { font-size: 34px; display: block; margin-bottom: 10px; opacity: 0.55; }

/* ==================== 分页 ==================== */
.ios-pager { display: flex; justify-content: center; align-items: center; gap: 10px; margin: 4px 0 26px; }
.ios-pager a, .ios-pager span.cur {
    min-width: 34px; height: 34px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 9px;
    font-size: 14px;
    padding: 0 8px;
    background: var(--ios-card);
    color: var(--ios-blue);
    text-decoration: none;
}
.ios-pager span.cur { background: var(--ios-blue); color: #fff; font-weight: 600; }
.ios-pager span.gap { background: none; color: var(--ios-gray); }

/* ==================== 工具类 ==================== */
.text-muted { color: var(--ios-gray); }
.text-sm { font-size: 13px; }
.text-xs { font-size: 12px; }
.mono { font-family: ui-monospace, 'SF Mono', Menlo, monospace; }
.strong { font-weight: 600; }
.c-blue { color: var(--ios-blue); }
.c-green { color: var(--ios-green); }
.c-red { color: var(--ios-red); }
.c-orange { color: var(--ios-orange); }
.mt-1 { margin-top: 8px; } .mt-2 { margin-top: 14px; } .mt-3 { margin-top: 20px; }
.mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 14px; }
.flex { display: flex; align-items: center; gap: 8px; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.wrap-anywhere { word-break: break-all; }
pre.ios-pre {
    background: var(--ios-fill);
    border-radius: 10px;
    padding: 12px;
    font-size: 12px;
    font-family: ui-monospace, Menlo, monospace;
    overflow-x: auto;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-all;
}

/* 页脚 */
.ios-footer {
    text-align: center;
    padding: 26px 0 6px;
    color: var(--ios-gray2);
    font-size: 12px;
    line-height: 1.8;
}

/* 桌面端抽屉常显（可选增强）：宽屏时侧边固定 */
@media (min-width: 1100px) {
    body.drawer-pinned { padding-left: 290px; }
    body.drawer-pinned .ios-drawer { transform: translateX(0); box-shadow: none; }
    body.drawer-pinned .ios-drawer-mask { display: none; }
}

@media (max-width: 640px) {
    .ios-wrap { padding: 16px 14px 42px; }
    .ios-title h1 { font-size: 23px; }
}
