:root {
  /* CIQ brand greens (sampled from www.ciq.com / portal.ciq.com) */
  --brand-25:  #e9fdf1;
  --brand-50:  #cbfce1;
  --brand-100: #52fbb2;
  --brand-200: #2be099;
  --brand-300: #17c484;
  --brand-400: #12a66f;  /* primary */
  --brand-500: #0b8759;  /* hover */
  --brand-600: #097049;
  --brand-700: #045134;  /* deep accent */
  --brand-800: #053722;
  --brand-900: #052315;

  /* Light-mode surface palette */
  --bg:        #f6f8f7;
  --surface:   #ffffff;
  --border:    #e2e8f0;
  --text:      #0f1a14;
  --muted:     #5b6b62;
  --primary:        var(--brand-400);
  --primary-hover:  var(--brand-500);
  --primary-soft:   var(--brand-25);
  --primary-ring:   rgba(18, 166, 111, 0.18);
  --success:        var(--brand-500);
  --success-soft:   var(--brand-50);
  --danger:         #991b1b;
  --danger-hover:   #7f1d1d;
  --danger-soft:    #fee2e2;
  --warning:        #b45309;
  --warning-soft:   #fef3c7;
  --info-soft:      #e0e7ff;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.07);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* --- Header / navigation ----------------------------------------------- */
header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0.85rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
}
header::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 3px;
  background: linear-gradient(90deg, var(--brand-300) 0%, var(--brand-500) 100%);
}
header h1 {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 0;
  letter-spacing: -0.01em;
  color: var(--text);
}
header h1 a {
  color: inherit;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.85rem;
}
.logo-ciq {
  display: inline-flex;
  align-items: center;
  color: var(--brand-500);
  padding-right: 0.85rem;
  border-right: 1px solid var(--border);
}
.logo-ciq svg { display: block; }
.brand-text { font-weight: 600; letter-spacing: -0.01em; }
header nav {
  display: flex;
  gap: 1.5rem;
  align-items: center;
  font-size: 0.9rem;
}
header nav span { color: var(--muted); }
header nav a { color: var(--brand-500); font-weight: 500; }
header nav a:hover { color: var(--brand-600); text-decoration: none; }

/* --- Main layout ------------------------------------------------------- */
main {
  max-width: 1100px;
  margin: 2.5rem auto;
  padding: 0 2rem;
}

section {
  background: var(--surface);
  padding: 1.75rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.75rem;
}
section h2 {
  font-size: 1.15rem;
  margin: 0 0 1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}
section h3 {
  font-size: 0.78rem;
  margin: 1.5rem 0 0.75rem;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
section p { margin: 0 0 1rem; color: var(--muted); }

/* --- Login screen ------------------------------------------------------ */
.login-box {
  max-width: 380px;
  margin: 5rem auto;
  background: var(--surface);
  padding: 2.5rem 2.25rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  border-top: 4px solid var(--brand-400);
}
.login-box h2 {
  text-align: center;
  margin-top: 0;
  margin-bottom: 1.75rem;
  font-size: 1.25rem;
}
.login-box form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.login-box button { margin-top: 0.5rem; }

/* --- Forms ------------------------------------------------------------- */
label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 0.6rem;
}
label input[type="text"], label input[type="password"], label select,
label input:not([type]), textarea {
  display: block;
  width: 100%;
  padding: 0.55rem 0.75rem;
  margin-top: 0.3rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.95rem;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  transition: border-color 0.15s, box-shadow 0.15s;
}
label input:focus, label select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-ring);
}
textarea {
  font-family: "SFMono-Regular", "Menlo", "Consolas", "Liberation Mono", monospace;
  font-size: 0.85rem;
  resize: vertical;
}
label input[type="checkbox"] {
  width: auto;
  margin: 0 0.4rem 0 0;
  vertical-align: middle;
}

form {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  align-items: stretch;
}
form.inline-form { flex-direction: row; align-items: flex-end; gap: 0.75rem; flex-wrap: wrap; }
form.inline-form > * { flex: 1; }
form.inline-form > button { flex: 0 0 auto; }

/* --- Buttons ----------------------------------------------------------- */
button, .button {
  background: var(--primary);
  color: white;
  border: none;
  padding: 0.55rem 1.1rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.92rem;
  font-weight: 500;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, transform 0.05s, box-shadow 0.15s;
  font-family: inherit;
}
button:hover, .button:hover {
  background: var(--primary-hover);
  text-decoration: none;
  box-shadow: 0 4px 10px rgba(11, 135, 89, 0.18);
}
button:active, .button:active { transform: translateY(1px); }
button.danger, .button.danger { background: var(--danger); }
button.danger:hover, .button.danger:hover {
  background: var(--danger-hover);
  box-shadow: 0 4px 10px rgba(153, 27, 27, 0.22);
}
button.secondary, .button.secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: none;
}
button.secondary:hover, .button.secondary:hover {
  background: var(--bg);
  box-shadow: none;
}
button:disabled, .button:disabled {
  background: var(--border);
  color: var(--muted);
  cursor: not-allowed;
  box-shadow: none;
}
button.small, .button.small {
  padding: 0.3rem 0.6rem;
  font-size: 0.8rem;
}

/* --- Tables ------------------------------------------------------------ */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}
thead { border-bottom: 1px solid var(--border); }
th {
  text-align: left;
  padding: 0.6rem 0.75rem;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 600;
}
td {
  padding: 0.85rem 0.75rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--brand-25); }
table form { display: inline; margin: 0; }

td.actions {
  text-align: right;
  white-space: nowrap;
}
td.actions form {
  display: inline-block;
  margin-left: 0.35rem;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  gap: 1rem;
}
.section-head h2 { margin: 0; }
.section-head form { margin: 0; flex-direction: row; gap: 0; }

.input-group {
  display: flex;
  gap: 0.4rem;
  align-items: stretch;
  margin-top: 0.3rem;
}
.input-group > input {
  flex: 1;
  margin-top: 0 !important;
  font-family: "SFMono-Regular", "Menlo", "Consolas", monospace;
  letter-spacing: 0.04em;
}
.input-group > button { flex: 0 0 auto; }

/* --- Status pills ------------------------------------------------------ */
.status {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 500;
}
.status::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
}
.status-pending      { background: var(--warning-soft); color: var(--warning); }
.status-pending::before      { background: var(--warning); }
.status-provisioning { background: var(--info-soft); color: #3730a3; }
.status-provisioning::before { background: #6366f1; animation: pulse 1.4s ease-in-out infinite; }
.status-ready        { background: var(--success-soft); color: var(--brand-600); }
.status-ready::before        { background: var(--brand-400); }
.status-failed       { background: var(--danger-soft); color: var(--danger); }
.status-failed::before       { background: var(--danger); }
.status-terminated   { background: var(--border); color: var(--muted); }
.status-terminated::before   { background: var(--muted); }
.status-stopped      { background: var(--border); color: var(--muted); }
.status-stopped::before      { background: var(--muted); }
.status-starting     { background: var(--info-soft); color: #3730a3; }
.status-starting::before     { background: #6366f1; animation: pulse 1.4s ease-in-out infinite; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.35; }
}

/* --- Flash messages ---------------------------------------------------- */
.flashes { list-style: none; padding: 0; margin: 0 0 1.5rem; }
.flash {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  margin-bottom: 0.5rem;
  font-size: 0.92rem;
  border: 1px solid transparent;
}
.flash-success { background: var(--success-soft); color: var(--brand-600); border-color: rgba(18, 166, 111, 0.2); }
.flash-error   { background: var(--danger-soft);  color: var(--danger);    border-color: rgba(220, 38, 38, 0.2); }

/* --- VM card grid (student view) -------------------------------------- */
.vm-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1rem;
  margin-top: 0.5rem;
}
.vm-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.1s;
}
.vm-card:hover {
  border-color: var(--brand-300);
  box-shadow: 0 4px 14px rgba(18, 166, 111, 0.12);
  transform: translateY(-1px);
}
.vm-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}
.vm-card-title {
  font-weight: 600;
  font-size: 1rem;
  margin: 0;
}
.vm-card-meta {
  font-size: 0.85rem;
  color: var(--muted);
  font-family: "SFMono-Regular", "Menlo", "Consolas", monospace;
}
.vm-card-actions {
  margin-top: 0.25rem;
  display: flex;
  gap: 0.5rem;
}
.vm-card-actions .button { width: 100%; }

.empty-state {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--muted);
  font-size: 0.95rem;
}
