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

body {
  font-family: system-ui, -apple-system, sans-serif;
  background: #0f1117;
  color: #e1e4e8;
  display: flex;
  min-height: 100vh;
  width: 100%;
}

#app {
  display: flex;
  width: 100%;
}

/* NAV */
nav {
  width: 220px;
  background: #161b22;
  padding: 20px 0;
  border-right: 1px solid #30363d;
  flex-shrink: 0;
  position: fixed;
  top: 0; bottom: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

nav h1 { font-size: 16px; padding: 0 20px 16px; border-bottom: 1px solid #30363d; margin-bottom: 12px; color: #58a6ff; }
nav a { display: block; padding: 8px 20px; color: #8b949e; text-decoration: none; font-size: 14px; border-left: 3px solid transparent; }
nav a:hover { color: #e1e4e8; background: #1c2128; }
nav a.active { color: #58a6ff; border-left-color: #58a6ff; background: #1c2128; }

.nav-group { margin: 0; }
.nav-group-title { display: block; padding: 8px 20px; color: #e1e4e8; font-size: 13px; font-weight: 600; text-decoration: none; cursor: default; border-left: 3px solid transparent; }
.nav-sub { padding-left: 34px !important; font-size: 13px !important; }

.nav-footer { margin-top: auto; padding: 12px 20px; border-top: 1px solid #30363d; }
.nav-footer a { display: block; padding: 6px 0; color: #8b949e; text-decoration: none; font-size: 13px; }
.nav-footer a:hover { color: #e1e4e8; }
.nav-footer a.logout { color: #f85149; }

/* MAIN */
main { margin-left: 220px; padding: 24px 32px; flex: 1; }
h2 { font-size: 20px; margin-bottom: 16px; }

/* CARDS */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }

.card { background: #161b22; border: 1px solid #30363d; border-radius: 8px; padding: 12px; }
.card .thumb { width: 100%; aspect-ratio: 9/16; background: #0d1117; border-radius: 4px; margin-bottom: 8px; overflow: hidden; }
.card .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card .portal-id { font-weight: 600; font-size: 13px; margin-bottom: 4px; }
.card .status { font-size: 12px; display: inline-flex; align-items: center; gap: 6px; }
.card .meta { font-size: 11px; color: #8b949e; margin-top: 2px; }

.status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.status-dot.online { background: #3fb950; }
.status-dot.offline { background: #f85149; }
.status-dot.unknown { background: #8b949e; }

.on { color: #3fb950; font-weight: 600; }
.off { color: #8b949e; }

.dash-row { cursor: pointer; }
.dash-row:hover { background: #1c2128; }

.detail-table { max-width: 500px; }
.detail-table .label { color: #8b949e; font-weight: 500; width: 140px; }

h3 { font-size: 16px; margin-bottom: 10px; color: #e1e4e8; }

/* SWITCH */
.switch { position: relative; display: inline-block; width: 40px; height: 22px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute; cursor: pointer; inset: 0;
  background: #30363d; border-radius: 22px; transition: 0.3s;
}
.slider::before {
  content: ""; position: absolute; height: 16px; width: 16px;
  left: 3px; bottom: 3px; background: #e1e4e8;
  border-radius: 50%; transition: 0.3s;
}
.switch input:checked + .slider { background: #238636; }
.switch input:checked + .slider::before { transform: translateX(18px); }

/* SLOT ROWS */
.slot-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  margin-bottom: 6px;
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 6px;
  flex-wrap: wrap;
}

.slot-row input[type="time"],
.slot-row select {
  width: auto;
}

.slot-row label {
  font-size: 12px;
  color: #8b949e;
  margin: 0 4px;
}

/* FORM */
input, select, textarea {
  background: #0d1117; border: 1px solid #30363d; color: #e1e4e8;
  padding: 8px 12px; border-radius: 6px; font-size: 13px; font-family: inherit; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: #58a6ff; }

textarea {
  min-height: 300px; font-family: 'SF Mono', 'Menlo', monospace;
  font-size: 12px; line-height: 1.5; resize: vertical;
}

.form { }
.form label { display: block; font-size: 13px; color: #8b949e; margin: 12px 0 4px; }
.form label:first-child { margin-top: 0; }
.form-actions { display: flex; gap: 8px; margin-top: 16px; }

/* BUTTONS */
button {
  background: #21262d; color: #e1e4e8; border: 1px solid #30363d;
  padding: 6px 14px; border-radius: 6px; cursor: pointer; font-size: 13px;
}
button:hover { background: #30363d; }

.btn-primary { background: #238636; border-color: #2ea043; color: #fff; }
.btn-primary:hover { background: #2ea043; }

.btn-danger { background: #da3633; border-color: #f85149; color: #fff; }
.btn-danger:hover { background: #f85149; }

/* TABLE */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 8px 12px; text-align: left; border-bottom: 1px solid #21262d; }
th { color: #8b949e; font-weight: 500; }
td button { margin-right: 4px; }

.empty { color: #8b949e; font-size: 13px; padding: 16px 0; }

/* TOOLBAR */
.toolbar { margin-bottom: 12px; display: flex; gap: 8px; }

/* VARIANT TABS */
.variant-tabs { margin-bottom: 16px; display: flex; gap: 4px; }
.variant-tabs button.active { background: #58a6ff; color: #0d1117; border-color: #58a6ff; }

/* TOAST */
.toast {
  position: fixed; bottom: 24px; right: 24px; background: #238636; color: #fff;
  padding: 10px 20px; border-radius: 6px; font-size: 14px;
  opacity: 0; transition: opacity 0.3s; pointer-events: none;
}
.toast.show { opacity: 1; }
.toast.error { background: #da3633; }

/* LOGIN */
.login-screen { display: flex; align-items: center; justify-content: center; min-height: 100vh; width: 100%; }
.login-box { background: #161b22; border: 1px solid #30363d; border-radius: 12px; padding: 32px; width: 340px; text-align: center; }
.login-box h1 { font-size: 18px; color: #58a6ff; margin-bottom: 24px; }
.login-box input { display: block; margin-bottom: 12px; padding: 10px 12px; font-size: 14px; }
.login-box .btn-primary { width: 100%; margin-top: 4px; padding: 10px; font-size: 14px; }
.login-link { display: block; margin-top: 12px; font-size: 13px; color: #58a6ff; text-decoration: none; }
.login-link:hover { text-decoration: underline; }
.login-error { margin-top: 10px; font-size: 13px; color: #f85149; min-height: 18px; }
.login-hint { font-size: 13px; color: #8b949e; margin-bottom: 12px; }

/* MODAL */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,0.7); display: flex; align-items: center; justify-content: center; z-index: 100; }
.modal-box { background: #161b22; border: 1px solid #30363d; border-radius: 12px; padding: 24px; width: 380px; }
.modal-box h3 { margin-bottom: 12px; font-size: 16px; }
.modal-box p { font-size: 14px; color: #8b949e; margin-bottom: 16px; }
.modal-box input { display: block; margin-bottom: 12px; padding: 10px 12px; font-size: 14px; }
.modal-actions { display: flex; gap: 8px; }
.modal-actions button { flex: 1; padding: 8px; }
