:root {
  --accent: #4BA3A3;
  --accent-700: #3d8686;
  --accent-50: #edf7f7;
  --gray-900: #1a1f24;
  --gray-600: #566069;
  --gray-400: #9aa3ac;
  --gray-200: #e4e8ec;
  --gray-100: #f1f4f6;
  --gray-50: #f8fafb;
  --white: #ffffff;
  --error: #ef4444;
  --success: #22c55e;
  --warning: #f59e0b;
  --radius: 16px;
  --radius-sm: 12px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,.08);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Inter, sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { background: var(--gray-50); color: var(--gray-900); font-size: 15px; line-height: 1.6; }
button { font-family: inherit; cursor: pointer; border: none; }
input, select, textarea { font-family: inherit; font-size: 15px; }
.hidden { display: none !important; }

/* Login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { background: var(--white); border: 1px solid var(--gray-200); border-radius: 20px;
  box-shadow: var(--shadow-md); padding: 40px; width: 100%; max-width: 420px; }
.login-card h1 { font-size: 28px; margin-bottom: 4px; }
.login-card p { color: var(--gray-600); margin-bottom: 24px; font-size: 14px; }

/* Layout */
.app { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.sidebar { background: var(--white); border-right: 1px solid var(--gray-200); padding: 24px 16px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 20px; padding: 0 8px 24px; }
.brand svg { color: var(--accent); }
.nav a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--radius-sm);
  color: var(--gray-600); text-decoration: none; font-weight: 500; margin-bottom: 4px; transition: all .2s; }
.nav a:hover { background: var(--gray-100); }
.nav a.active { background: var(--accent-50); color: var(--accent-700); }
.main { padding: 32px 40px; overflow-x: auto; }
.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.topbar h2 { font-size: 24px; }

/* Components */
.btn { background: var(--accent); color: #fff; font-weight: 600; padding: 10px 18px; border-radius: var(--radius-sm);
  transition: all .2s; display: inline-flex; align-items: center; gap: 8px; }
.btn:hover { background: var(--accent-700); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn.ghost { background: var(--gray-100); color: var(--gray-900); }
.btn.ghost:hover { background: var(--gray-200); }
.btn.danger { background: var(--error); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; font-weight: 600; color: var(--gray-600); margin-bottom: 6px; }
.field input, .field select, .field textarea { width: 100%; border: 2px solid var(--gray-200); border-radius: var(--radius-sm);
  padding: 12px 14px; transition: all .2s; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(75,163,163,.15); }
.card { background: var(--white); border: 1px solid var(--gray-200); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: 24px; margin-bottom: 20px; }
.row { display: flex; gap: 12px; align-items: center; }
.grow { flex: 1; }
.badge { padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge.on { background: #dcfce7; color: #15803d; }
.badge.off { background: var(--gray-100); color: var(--gray-600); }
.badge.pending { background: #fef3c7; color: #92400e; }
.badge.auto { background: var(--accent-50); color: var(--accent-700); }

/* Table */
table { width: 100%; border-collapse: collapse; background: var(--white); border-radius: var(--radius); overflow: hidden;
  border: 1px solid var(--gray-200); }
th { background: var(--gray-50); color: var(--gray-600); font-size: 12px; font-weight: 600; text-transform: uppercase;
  text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--gray-200); }
td { padding: 12px 16px; border-bottom: 1px solid var(--gray-100); vertical-align: top; }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--accent-50); }
.muted { color: var(--gray-400); font-size: 13px; }
.unread { font-weight: 700; }
.toast { position: fixed; bottom: 24px; right: 24px; background: var(--gray-900); color: #fff; padding: 14px 20px;
  border-radius: var(--radius-sm); box-shadow: var(--shadow-md); z-index: 100; }
.toast.err { background: var(--error); }
.checkbox { width: 18px; height: 18px; cursor: pointer; }
.toolbar { display: flex; gap: 12px; margin-bottom: 16px; align-items: center; flex-wrap: wrap; }
.empty { text-align: center; padding: 48px; color: var(--gray-400); }
