:root{
  --bg: #f7f7f5;
  --panel: #ffffff;
  --border: #e5e7eb;
  --text: #1f2937;
  --muted: #6b7280;
  --primary: #16a34a;
  --success: #22c55e;
  --warn: #d97706;
  --danger: #ef4444;
  --tile: #f2fbf6;
}
*{box-sizing:border-box}
html,body{height:100%;background:var(--bg);color:var(--text);font:14px/1.5 -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"PingFang SC","Noto Sans CJK SC","Microsoft YaHei",sans-serif}
a{text-decoration:none;color:inherit}

.layout{display:flex;height:100%}
.sidebar{width:220px;background:#fafaf8;border-right:1px solid var(--border);display:flex;flex-direction:column}
.brand{padding:16px;border-bottom:1px solid var(--border);display:flex;align-items:center;gap:8px}
.brand-name{font-weight:600;color:#111827}
.badge{font-size:12px;padding:2px 6px;border-radius:10px;background:#e8f5e9;color:#118f3f;border:1px solid #cce9d5}
.menu{display:flex;flex-direction:column;padding:8px}
.menu-item{padding:10px 12px;border-radius:8px;color:#374151}
.menu-item.active{background:#e6f5ea;color:#0f5132;border:1px solid #cae9d6}
.menu-item:hover{background:#f1f5f9;color:#111827}

.main{flex:1;display:flex;flex-direction:column;min-width:0}
.header{height:64px;display:flex;align-items:center;justify-content:space-between;padding:0 16px;background:var(--panel);border-bottom:1px solid var(--border);gap:12px}
.header-left{display:flex;align-items:center;gap:8px}
.header-center{display:flex;align-items:center;gap:16px}
.header-right{display:flex;align-items:center;gap:12px}
.input{height:36px;padding:0 10px;border:1px solid var(--border);border-radius:8px;background:#fff;color:var(--text);min-width:260px}
.btn{height:36px;padding:0 12px;border:1px solid var(--border);border-radius:8px;background:#f8fafc;color:#0f5132}
.btn:hover{border-color:#bcd7c7;background:#eef7f0}
.btn:focus-visible,.input:focus-visible,select:focus-visible,textarea:focus-visible{outline:2px solid #9ec2ff;outline-offset:2px}
.user{display:flex;align-items:center;gap:10px}
.avatar{width:32px;height:32px;border-radius:50%;border:1px solid var(--border);background:#fff}
.balance{display:flex;align-items:center;gap:8px}
.progress{width:120px;height:8px;background:#f1f5f9;border:1px solid var(--border);border-radius:10px;overflow:hidden}
.progress-bar{height:100%;background:var(--success)}
.progress-bar.warn{background:var(--warn)}
.balance-value.warn{color:var(--warn)}
.content{flex:1;display:flex;min-height:0}
#content-frame{flex:1;border:0}

/* Panels & cards */
.panel{background:var(--panel);border:1px solid var(--border);border-radius:12px;padding:16px;box-shadow:0 1px 2px rgba(17,24,39,.05)}
.panel-title{font-weight:600;margin-bottom:8px}
.muted{color:var(--muted)}
.breadcrumb{display:flex;align-items:center;gap:6px;margin-left:12px;color:var(--muted)}
.breadcrumb a{color:#0f5132}
.crumb-current{font-weight:600;color:#374151}
.crumb-sep{color:#9ca3af}
.grid{display:grid;gap:12px}
.grid-3{grid-template-columns:repeat(3,1fr)}
.grid-4{grid-template-columns:repeat(4,1fr)}
.grid-5{grid-template-columns:repeat(5,1fr)}
.metric{display:flex;align-items:center;justify-content:space-between;background:var(--panel);border:1px solid var(--border);border-radius:16px;padding:18px;box-shadow:0 2px 6px rgba(17,24,39,.06)}
.metric .label{color:var(--muted)}
.metric .value{font-size:24px;font-weight:700;color:#0f5132}
.tag{display:inline-block;padding:2px 6px;border-radius:10px;border:1px solid var(--border);background:#1a2028;color:#b7c3cf;font-size:12px}
.tag{background:#f8fafc;color:#374151}
.status-active{color:#34d399}
.status-sleep{color:#9aa4af}
.status-ban{color:#ef4444}

/* tables */
table{width:100%;border-collapse:separate;border-spacing:0 8px}
th,td{padding:12px 14px;background:#ffffff;border:1px solid var(--border)}
th{color:#374151;text-align:left}
td:first-child,th:first-child{border-top-left-radius:10px;border-bottom-left-radius:10px}
td:last-child,th:last-child{border-top-right-radius:10px;border-bottom-right-radius:10px}
.actions{display:flex;gap:8px}
.btn-link{color:#0f5132}

/* Forms */
.form-row { display: grid; grid-template-columns: 110px 1fr; gap: 16px; margin-bottom: 16px; align-items: center; }
.form-row label { font-weight: 500; color: var(--text); font-size: 14px; }
.input {
  width: 100%; border: 1px solid #cbd5e1; padding: 10px 14px; border-radius: 8px;
  font-size: 14px; outline: none; transition: all 0.2s; box-sizing: border-box; background: #fff;
  color: #1e293b;
}
.input:focus { border-color: #3b82f6; box-shadow: 0 0 0 3px rgba(59,130,246,0.1); background: #fff; }
.input::placeholder { color: #94a3b8; }
.form-row textarea.input { height: auto; min-height: 80px; resize: vertical; }

/* Vertical Form for narrow spaces */
.form-stacked .form-row { display: flex; flex-direction: column; align-items: stretch; gap: 6px; margin-bottom: 16px; }
.form-stacked .form-row label { margin-bottom: 0; }
/* Steps */
.steps { display: flex; gap: 4px; margin-bottom: 24px; background: #f1f5f9; padding: 4px; border-radius: 12px; }
.step {
  flex: 1; padding: 10px 16px; border-radius: 8px; text-align: center; color: #64748b; font-weight: 600; font-size: 14px;
  transition: all 0.3s; cursor: default;
}
.step.active { background: #fff; color: #3b82f6; box-shadow: 0 2px 8px rgba(0,0,0,0.05); }

/* Make Cards */
.tpl-card {
  background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 16px; text-align: center;
  transition: all 0.2s; cursor: pointer; position: relative; overflow: hidden;
}
.tpl-card:hover { border-color: #3b82f6; box-shadow: 0 8px 16px -4px rgba(59,130,246,0.15); transform: translateY(-2px); }
.tpl-card .preview { height: 120px; background: #f8fafc; margin: -16px -16px 16px; display: flex; align-items: center; justify-content: center; color: #cbd5e1; }
.tpl-card.selected { border: 2px solid #3b82f6; background: #eff6ff; }
.tpl-card.selected::after {
  content: '✓'; position: absolute; top: 8px; right: 8px; width: 20px; height: 20px; background: #3b82f6; color: white; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-size: 12px;
}
.btn-primary { background: #3b82f6; color: white; border: none; padding: 10px 24px; border-radius: 8px; font-weight: 600; cursor: pointer; transition: all 0.2s; }
.btn-primary:hover { background: #2563eb; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(37,99,235,0.3); }
.btn-secondary { background: #fff; border: 1px solid var(--border); color: #64748b; padding: 10px 24px; border-radius: 8px; font-weight: 600; cursor: pointer; }
.btn-secondary:hover { background: #f8fafc; color: #475569; }
/* flow helpers */
.flow .panel{margin:0}
.flow .form{margin:0}

/* svg charts */
.chart{height:200px;background:#f8fafc;border:1px solid var(--border);border-radius:12px}

/* responsive */
@media (max-width: 1024px){
  .sidebar{width:200px}
  .header-center{display:none}
}
@media (max-width: 768px){
  .sidebar{position:fixed;left:0;top:60px;bottom:0;transform:translateX(-100%);transition:.2s}
  .sidebar.open{transform:translateX(0)}
  .header{position:sticky;top:0;z-index:10}
  .main{padding-left:0}
  .input{min-width:160px}
}

/* Dashboard Tiles */
.tiles { display: grid; grid-template-columns: repeat(6, 1fr); gap: 16px; padding: 16px; }
.stat-tile {
  background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 16px;
  display: flex; align-items: center; gap: 12px;
  position: relative; overflow: hidden;
}
.stat-icon {
  width: 48px; height: 48px; border-radius: 50%; background: #dcfce7; color: #16a34a;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.stat-info { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.stat-title { font-size: 13px; color: var(--text-light); margin-bottom: 4px; white-space: nowrap; }
.stat-value { font-size: 20px; font-weight: 700; color: var(--text); line-height: 1.2; }
.progress-sm { height: 4px; background: #f3f4f6; border-radius: 2px; margin-top: 8px; overflow: hidden; }
.progress-sm .bar { height: 100%; background: #16a34a; border-radius: 2px; width: 0; transition: width 0.5s; }
.progress-sm .bar.warn { background: #d97706; }

/* Status Badges */
.badge { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 12px; }
.badge.success { background: #dcfce7; color: #16a34a; }
.badge.pending { background: #fef9c3; color: #d97706; }
.badge.error { background: #fee2e2; color: #dc2626; }

@media (max-width: 1200px) { .tiles { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 768px) { .tiles { grid-template-columns: repeat(2, 1fr); } }

/* soft table style */
.table-soft{width:100%;border-collapse:separate;border-spacing:0;background:var(--tile);border-radius:16px;overflow:hidden}
.table-soft thead th{
  background: linear-gradient(#eaf6f0, #e2f3eb);
  color:#0f5132;
  font-weight:700;
  border:1px solid var(--border);
  padding:12px 14px;
}
.table-soft tbody td{
  background:#ffffff;
  border:1px solid var(--border);
  padding:12px 14px;
}
.table-soft tbody tr:hover td{background:#f7fbf8}
.table-soft th:first-child,.table-soft td:first-child{border-left:1px solid var(--border)}
.table-soft th:last-child,.table-soft td:last-child{border-right:1px solid var(--border)}
.table-soft .sum-row td{background:#eaf6ef;font-weight:600}
.table-soft td,.table-soft th{white-space:nowrap}
.table-soft td:first-child{text-align:left}
.table-soft td:not(:first-child),.table-soft th:not(:first-child){text-align:center}

/* video cards */
.video-card .cover{
  width:100%;
  height:160px;
  border-radius:12px;
  object-fit:cover;
  margin-bottom:8px;
  border:1px solid var(--border);
}

/* modal */
.modal{position:fixed;inset:0;display:none;align-items:center;justify-content:center;background:rgba(0,0,0,.35);z-index:100}
.modal.show{display:flex}
.modal-panel{width:720px;max-width:92vw;background:#ffffff;border:1px solid var(--border);border-radius:16px;box-shadow:0 12px 28px rgba(17,24,39,.15);overflow:hidden}
.modal-header{padding:14px 16px;border-bottom:1px solid var(--border);font-weight:700;color:#0f5132;background:#eaf6f0}
.modal-body{padding:16px}
.modal-actions{display:flex;justify-content:flex-end;gap:8px;padding:12px 16px;border-top:1px solid var(--border);background:#f8fafc}
.modal .form-row{grid-template-columns:180px 1fr}
.divider{height:1px;background:var(--border);margin:12px 0}

/* Modal Clean Style */
.modal {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.4); display: flex; align-items: center; justify-content: center;
  z-index: 1000; opacity: 0; pointer-events: none; transition: opacity 0.3s;
  backdrop-filter: blur(2px);
}
.modal.show { opacity: 1; pointer-events: auto; }
.modal-panel-clean {
  background: #fff; border-radius: 24px; padding: 40px 32px; width: 440px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.1); text-align: center;
  transform: scale(0.95); transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.modal.show .modal-panel-clean { transform: scale(1); }

.input-clean {
  width: 100%; border: 1px solid #e2e8f0; background: #f8fafc;
  padding: 14px 16px; border-radius: 12px; margin-bottom: 12px;
  font-size: 15px; transition: all 0.2s; outline: none;
}
.input-clean:focus { background: #fff; border-color: #3b82f6; box-shadow: 0 0 0 3px rgba(59,130,246,0.1); }
.btn-clean {
  width: 100%; background: #10b981; color: white; padding: 14px;
  border-radius: 12px; font-weight: 600; font-size: 16px; border: none; cursor: pointer;
  margin-top: 12px; transition: all 0.2s;
}
.btn-clean:hover { background: #059669; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(16,185,129,0.2); }
.btn-clean-cancel {
  margin-top: 16px; color: #94a3b8; font-size: 14px; cursor: pointer; display: inline-block; padding: 4px 8px;
}
.btn-clean-cancel:hover { color: #64748b; }
.staff-card {
  background: #dcfce7; border-radius: 12px; padding: 32px 24px; text-align: center;
  cursor: pointer; transition: all 0.3s; border: 1px solid transparent;
  display: flex; flex-direction: column; align-items: center; justify-content: center; height: 240px;
}
.staff-card:hover { transform: translateY(-4px); box-shadow: 0 10px 20px rgba(0,0,0,0.05); background: #bbf7d0; }
.staff-card.add { border: 2px dashed #cbd5e1; background: #f8fafc; }
.staff-card.add:hover { border-color: #ef4444; background: #fef2f2; }
.staff-icon { width: 64px; height: 64px; margin-bottom: 16px; }

/* Animation & Hover */
.fade-in { animation: fadeIn 0.4s ease-out; }
@keyframes fadeIn { from{opacity:0;transform:translateY(10px)} to{opacity:1;transform:translateY(0)} }

.hover-lift { transition: transform 0.2s, box-shadow 0.2s; }
.hover-lift:hover { transform: translateY(-4px); box-shadow: 0 8px 16px -4px rgba(0,0,0,0.1); }

.card-cover {
  width: 100%; height: 160px; object-fit: cover; border-radius: 6px; margin-bottom: 8px;
  background: #f3f4f6; border: 1px solid #e5e7eb;
}
.icon-btn { display:inline-flex; align-items:center; gap:4px; }
.icon-svg { width:16px; height:16px; fill:currentColor; }
