/* ============================================================
   GPU 平台 · AWS Cloud 锐利风格
   直角/小圆角 · 高对比文字 · 纯色实底 · 无柔和渐变
   ============================================================ */
:root {
  --aws-navy: #232f3e;
  --aws-orange: #ec7211;
  --aws-blue: #0073bb;
  --bg: #f2f3f3;
  --panel: #ffffff;
  --border: #cbd5e1;
  --border-soft: #dde5ea;
  --text: #111827;
  --muted: #4b5563;
  --green: #0f7a3d;
  --green-bg: #e6f4ea;
  --red: #b42318;
  --red-bg: #fdecea;
  --amber: #b45309;
  --amber-bg: #fef3c7;
  --gray-bg: #f3f4f6;
  --blue-bg: #e7f1fa;
  --radius: 2px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Amazon Ember", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.hidden { display: none !important; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #b6c2cf; border-radius: 0; border: 2px solid var(--bg); }
::-webkit-scrollbar-track { background: transparent; }

/* ============ 登录页(锐利) ============ */
.center-box {
  display: flex; align-items: center; justify-content: center; min-height: 100vh;
  background: var(--aws-navy);
}
.auth-card {
  width: 400px; text-align: center;
  background: var(--panel);
  border: 1px solid #37475a;
  border-radius: 2px;
  padding: 40px 38px 34px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .4);
  animation: fadeUp .25s ease;
}
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.auth-card .logo-aws { display: inline-flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.auth-card .logo-aws .smile {
  width: 38px; height: 38px; border-radius: 2px;
  background: var(--aws-orange);
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 800; font-size: 1.25rem;
}
.auth-card h1 { font-size: 1.3rem; font-weight: 700; color: var(--aws-navy); text-align: left; letter-spacing: .2px; }
.subtitle { color: var(--muted); font-size: .78rem; margin-bottom: 26px; text-align: left; font-weight: 500; }
.auth-card input { width: 100%; margin-bottom: 12px; padding: 11px 12px; border-radius: 2px; }
.auth-error {
  background: var(--red-bg); color: var(--red); border: 1px solid #f3c6c0;
  border-radius: 2px; padding: 10px 12px; margin-bottom: 12px; font-size: .82rem; text-align: left;
}
.auth-card .row { justify-content: center; margin-top: 10px; gap: 12px; }
.auth-card button { flex: 1; padding: 10px; }

/* ============ 布局 ============ */
#app-view { display: flex; flex-direction: column; min-height: 100vh; }

/* 顶部导航(纯色,无渐变) */
nav {
  display: flex; align-items: center; gap: 18px;
  background: var(--aws-navy); color: #fff;
  padding: 0 24px; height: 52px; flex-shrink: 0;
  border-bottom: 1px solid #1a2530;
  position: sticky; top: 0; z-index: 50;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.05rem; }
.brand .logo-aws {
  width: 30px; height: 30px; border-radius: 2px;
  background: var(--aws-orange);
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 1rem; color: #fff;
}
.brand em { font-style: normal; font-weight: 400; color: #94a3b8; margin-left: 2px; font-size: .92rem; }
.nav-right { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.balance-pill {
  background: #1c2b3a; border: 1px solid #3b4d61;
  padding: 5px 14px; border-radius: 2px; font-size: .82rem; color: #7dce94;
  font-variant-numeric: tabular-nums; font-weight: 600;
}
.whoami { color: #94a3b8; font-size: .82rem; font-weight: 500; }
button.ghost {
  background: transparent; border: 1px solid #4b5d72;
  color: #cbd5e1; padding: 6px 14px; border-radius: 2px; font-weight: 500;
}
button.ghost:hover { background: #1c2b3a; color: #fff; }

/* 主体:侧边栏 + 内容 */
.layout { display: flex; flex: 1; }
.sidebar {
  width: 224px; flex-shrink: 0;
  background: #fafbfc;
  border-right: 1px solid var(--border);
  padding: 16px 12px;
  position: sticky; top: 52px; align-self: flex-start;
  height: calc(100vh - 52px); overflow-y: auto;
}
.sidebar .section-label {
  font-size: .66rem; text-transform: uppercase; letter-spacing: .8px;
  color: #7c8794; padding: 10px 14px 7px; font-weight: 700;
}
.sidebar .tab {
  position: relative;
  display: flex; align-items: center; gap: 11px; width: 100%;
  background: transparent; border: none; border-radius: 2px;
  color: #334155; padding: 10px 14px; margin-bottom: 2px;
  cursor: pointer; font-size: .88rem; font-weight: 500; text-align: left;
}
.sidebar .tab::before {
  content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px;
  background: var(--aws-orange); opacity: 0;
}
.sidebar .tab:hover { background: #eef1f4; color: var(--text); }
.sidebar .tab.active { background: var(--aws-blue); color: #fff; font-weight: 600; }
.sidebar .tab.active::before { opacity: 1; }
.sidebar .tab .ico { width: 18px; text-align: center; font-size: .92rem; }

.main { flex: 1; padding: 24px 28px 60px; min-width: 0; }
.view { max-width: 1120px; animation: fadeUp .2s ease; }

/* ============ 卡片(锐利) ============ */
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  margin-bottom: 18px;
  box-shadow: 0 1px 1px rgba(17, 24, 39, .04);
}
.card-head {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 16px; padding-bottom: 12px;
  border-bottom: 1px solid var(--border-soft);
}
.card-head h2 { font-size: 1rem; font-weight: 700; color: var(--aws-navy); }
.hint { color: var(--muted); font-size: .74rem; font-weight: 500; }

/* ============ 表单 ============ */
input, select, textarea {
  width: 100%;
  background: #fff;
  border: 1px solid #94a3b8;
  padding: 9px 11px;
  border-radius: 2px;
  font-size: .88rem;
  color: var(--text);
  outline: none;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--aws-blue);
  box-shadow: 0 0 0 1px var(--aws-blue);
}
textarea { resize: vertical; font-family: inherit; }
label { display: block; font-size: .76rem; color: #475569; margin-bottom: 12px; font-weight: 600; }
label input, label select { margin-top: 5px; }
.form-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.form-actions { display: flex; align-items: flex-end; }
.row { display: flex; gap: 10px; align-items: center; }

/* ============ 按钮(纯色实底) ============ */
button {
  background: var(--aws-blue); color: #fff; border: none;
  padding: 8px 16px; border-radius: 2px; cursor: pointer; font-size: .86rem;
  font-weight: 600;
}
button:hover { background: #005d99; }
button:active { background: #004d7f; }
button.orange { background: var(--aws-orange); }
button.orange:hover { background: #dd6b10; }
button.orange:active { background: #c95f0c; }
button.secondary { background: #fff; color: var(--aws-blue); border: 1px solid var(--aws-blue); }
button.secondary:hover { background: var(--blue-bg); }
button.danger { background: #fff; color: var(--red); border: 1px solid #c0392b; }
button.danger:hover { background: var(--red-bg); }
button.small { padding: 5px 12px; font-size: .78rem; border-radius: 2px; }
button:disabled { opacity: .5; cursor: not-allowed; }

/* ============ GPU 卡片 ============ */
.gpu-section { margin-top: 18px; border-top: 1px solid var(--border-soft); padding-top: 16px; }
.gpu-label {
  font-size: .76rem; font-weight: 700; color: var(--aws-navy);
  text-transform: uppercase; letter-spacing: .6px; margin-bottom: 12px;
  display: flex; align-items: center; gap: 8px;
}
.gpu-label::after { content: ""; flex: 1; height: 1px; background: var(--border-soft); }
.gpu-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 10px;
}
.gpu-card {
  background: #fff; border: 1px solid var(--border); border-radius: 2px;
  padding: 13px 15px; cursor: pointer; position: relative; text-align: left;
}
.gpu-card:hover { border-color: #7c98b3; }
.gpu-card.selected {
  border-color: var(--aws-orange);
  background: #fff8f0;
  box-shadow: 0 0 0 1px var(--aws-orange);
}
.gpu-card .gpu-check {
  position: absolute; top: 10px; right: 12px;
  width: 18px; height: 18px; border-radius: 2px;
  border: 1px solid #c6cdd3; display: none;
  align-items: center; justify-content: center;
  font-size: .66rem; font-weight: 800; color: #fff;
}
.gpu-card.selected .gpu-check {
  display: inline-flex; background: var(--aws-orange); border-color: var(--aws-orange);
}
.gpu-card .gpu-name { font-size: .88rem; font-weight: 700; color: var(--aws-navy); padding-right: 22px; line-height: 1.3; }
.gpu-card .gpu-mem {
  display: inline-block; margin-top: 8px; padding: 2px 8px;
  background: var(--gray-bg); border: 1px solid var(--border-soft); border-radius: 2px;
  font-size: .68rem; font-weight: 700; color: #475569;
}
.gpu-card .gpu-price { margin-top: 9px; font-size: 1.1rem; font-weight: 800; color: var(--aws-orange); font-variant-numeric: tabular-nums; }
.gpu-card .gpu-price small { font-size: .68rem; font-weight: 500; color: var(--muted); margin-left: 5px; }
.gpu-card .gpu-sub { margin-top: 3px; font-size: .7rem; font-weight: 500; color: var(--muted); }

/* ============ 实例卡片 ============ */
.list { display: flex; flex-direction: column; gap: 12px; }
.item {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  box-shadow: 0 1px 1px rgba(17, 24, 39, .04);
}
.item-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.item-title { font-weight: 700; color: var(--aws-navy); font-size: .95rem; }
.item-meta { color: var(--muted); font-size: .78rem; margin-top: 7px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-weight: 500; }
.item-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.status-line {
  color: var(--muted); font-size: .78rem; margin-top: 11px;
  display: flex; align-items: center; gap: 7px; font-weight: 500;
}
.status-line::before {
  content: ""; width: 7px; height: 7px; background: #94a3b8; border-radius: 1px;
}
.error-line { color: var(--red); font-size: .8rem; margin-top: 6px; word-break: break-all; font-weight: 500; }
.error-line::before { content: "⚠ "; }

/* 状态徽章(锐利,方形) */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 2px; font-size: .68rem; font-weight: 700;
  letter-spacing: .5px; text-transform: uppercase;
}
.badge::before { content: ""; width: 6px; height: 6px; background: currentColor; border-radius: 1px; }
.badge.RUNNING, .badge.SUCCEEDED { background: var(--green-bg); color: var(--green); }
.badge.STOPPED, .badge.TERMINATED { background: var(--gray-bg); color: #64748b; }
.badge.CREATING, .badge.PENDING, .badge.STOPPING, .badge.TERMINATING {
  background: var(--amber-bg); color: var(--amber);
}
.badge.CREATING::before, .badge.PENDING::before, .badge.STOPPING::before, .badge.TERMINATING::before {
  animation: pulse 1.2s infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }
.badge.ERROR, .badge.FAILED { background: var(--red-bg); color: var(--red); }

/* ============ 账单 ============ */
.balance-card { text-align: center; }
.balance-num {
  font-size: 2.7rem; font-weight: 800; color: var(--aws-navy);
  margin-bottom: 2px; font-variant-numeric: tabular-nums;
}
.balance-sub { color: var(--muted); font-size: .76rem; margin-bottom: 18px; font-weight: 500; }
.balance-card .row { justify-content: center; margin-bottom: 10px; }
.balance-card input { width: 180px; }

/* ============ 用量统计 ============ */
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 18px; }
.stat-card {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; text-align: center;
}
.stat-num { font-size: 1.5rem; font-weight: 800; color: var(--aws-navy); font-variant-numeric: tabular-nums; }
.stat-label { margin-top: 5px; font-size: .72rem; font-weight: 600; color: var(--muted); }
.chart {
  display: flex; align-items: flex-end; gap: 2px; height: 110px;
  padding-top: 8px;
}
.chart-bar {
  flex: 1; min-width: 4px; background: var(--aws-blue);
}
.chart-bar:hover { background: var(--aws-orange); }

/* ============ 通知铃铛 ============ */
.bell-wrap { position: relative; }
.bell { position: relative; font-size: .95rem; padding: 6px 10px; }
.bell-count {
  position: absolute; top: -6px; right: -6px;
  background: var(--red); color: #fff; font-size: .62rem; font-weight: 700;
  border-radius: 2px; padding: 1px 5px; min-width: 16px; text-align: center;
}
.bell-drop {
  position: absolute; right: 0; top: calc(100% + 8px); width: 340px; max-height: 380px;
  overflow-y: auto; background: #fff; border: 1px solid var(--border);
  border-radius: 2px; box-shadow: 0 4px 12px rgba(17, 24, 39, .15);
  z-index: 60; padding: 8px;
}
.bell-item { padding: 10px 12px; border-bottom: 1px solid var(--border-soft); }
.bell-item:last-child { border-bottom: none; }
.bell-item.unread { background: var(--blue-bg); }
.bell-msg { font-size: .82rem; font-weight: 500; color: var(--text); }
.bell-time { font-size: .7rem; color: var(--muted); margin-top: 4px; font-weight: 500; }
.bell-empty { color: var(--muted); font-size: .8rem; text-align: center; padding: 14px 0; }

/* ============ 表格(锐利) ============ */
.usage-table { width: 100%; border-collapse: collapse; font-size: .84rem; }
.usage-table th {
  text-align: left; padding: 9px 12px; color: #475569; font-weight: 700;
  background: #fafbfc; border-bottom: 1px solid var(--border);
  font-size: .7rem; text-transform: uppercase; letter-spacing: .5px;
}
.usage-table td { padding: 10px 12px; border-bottom: 1px solid var(--border-soft); font-weight: 500; }
.usage-table tbody tr:hover { background: #f7f9fb; }
.usage-table tr:last-child td { border-bottom: none; }

/* ============ 模态框 ============ */
.modal {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(15, 23, 42, .6);
  display: flex; align-items: center; justify-content: center;
}
.modal-card {
  width: 360px; background: #fff; border: 1px solid var(--border); border-radius: 2px;
  padding: 22px 24px; box-shadow: 0 12px 40px rgba(15, 23, 42, .35);
}
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.modal-head h2 { font-size: 1rem; font-weight: 700; color: var(--aws-navy); }
.modal-close { background: transparent; border: none; color: var(--muted); font-size: 1.3rem; padding: 0 6px; }
.modal-close:hover { color: var(--text); }
.modal-card input { margin-bottom: 12px; }
.modal-error {
  background: var(--red-bg); color: var(--red); border: 1px solid #f3c6c0;
  border-radius: 2px; padding: 9px 12px; margin-bottom: 12px; font-size: .8rem;
}
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* 空状态 */
.empty {
  color: var(--muted); font-size: .84rem; font-weight: 500; padding: 14px 0;
  display: flex; align-items: center; gap: 8px;
}
.empty::before { content: "·"; font-weight: 900; }
