:root {
  --ms-bg: #0f172a;
  --ms-card: #1e293b;
  --ms-text: #e2e8f0;
  --ms-muted: #94a3b8;
  --ms-accent: #22c55e;
  --ms-accent-hover: #16a34a;
  --ms-danger: #ef4444;
  --ms-hairline: rgba(148,163,184,.15);
  --ms-radius: 1rem;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--ms-bg);
  color: var(--ms-text);
  line-height: 1.6;
  min-height: 100vh;
}
a { color: var(--ms-accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Layout */
.ms-container { max-width: 960px; margin: 0 auto; padding: 0 1rem; }
.ms-top {
  position: sticky; top: 0; z-index: 50;
  background: rgba(15,23,42,.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--ms-hairline);
  padding: .75rem 1rem;
  display: flex; align-items: center; justify-content: space-between;
}
.ms-logo { font-weight: 900; font-size: 1.2rem; letter-spacing: -0.02em; }
.ms-logo span { color: var(--ms-accent); }

.ms-nav { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.ms-nav a, .ms-nav button {
  padding: .4rem .8rem; border-radius: 8px; font-size: .85rem; font-weight: 600;
  border: 1px solid var(--ms-hairline); background: transparent; color: var(--ms-text);
  cursor: pointer; transition: all .15s;
}
.ms-nav a:hover, .ms-nav button:hover { background: rgba(255,255,255,.06); text-decoration: none; }
.ms-nav .active { background: rgba(34,197,94,.12); border-color: rgba(34,197,94,.3); color: var(--ms-accent); }

/* Cards */
.ms-card {
  background: var(--ms-card); border: 1px solid var(--ms-hairline);
  border-radius: var(--ms-radius); padding: 1.25rem; margin-bottom: 1rem;
}
.ms-card h2 { font-size: 1.1rem; font-weight: 800; margin-bottom: .6rem; }
.ms-card h3 { font-size: .95rem; font-weight: 700; margin-bottom: .4rem; }

/* Buttons */
.ms-btn {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .55rem 1rem; border-radius: 10px; font-weight: 700; font-size: .85rem;
  border: 1px solid var(--ms-hairline); background: var(--ms-card); color: var(--ms-text);
  cursor: pointer; transition: all .15s;
}
.ms-btn:hover { filter: brightness(1.05); transform: translateY(-1px); }
.ms-btn-primary {
  background: linear-gradient(180deg, #22c55e, #16a34a);
  color: #0a1a0f; border-color: rgba(34,197,94,.4);
  font-weight: 850;
}
.ms-btn-danger { background: #991b1b; border-color: #dc2626; color: #fecaca; }
.ms-btn-sm { padding: .35rem .7rem; font-size: .8rem; }

/* Inputs */
.ms-input, .ms-select, .ms-textarea {
  width: 100%; padding: .55rem .8rem; border-radius: 10px;
  border: 1px solid var(--ms-hairline); background: rgba(30,41,59,.7);
  color: var(--ms-text); font-size: .9rem; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.ms-input:focus, .ms-select:focus, .ms-textarea:focus {
  border-color: rgba(34,197,94,.4);
  box-shadow: 0 0 0 3px rgba(34,197,94,.1);
}
.ms-input::placeholder { color: var(--ms-muted); }
.ms-textarea { resize: vertical; min-height: 80px; }
.ms-label { display: block; font-size: .85rem; font-weight: 600; margin-bottom: .3rem; color: var(--ms-muted); }

/* Grid */
.ms-grid { display: grid; gap: 1rem; }
.ms-grid-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.ms-grid-3 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }

/* List items */
.ms-list-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: .6rem .8rem; border-radius: 10px; border: 1px solid var(--ms-hairline);
  background: rgba(30,41,59,.5); margin-bottom: .4rem;
  transition: background .15s;
}
.ms-list-item:hover { background: rgba(30,41,59,.8); }
.ms-list-item .name { font-weight: 600; }
.ms-list-item .meta { font-size: .8rem; color: var(--ms-muted); }

/* Badges */
.ms-badge {
  display: inline-flex; padding: .2rem .5rem; border-radius: 999px;
  font-size: .75rem; font-weight: 800; letter-spacing: .02em;
  border: 1px solid var(--ms-hairline); background: rgba(30,41,59,.7);
}
.ms-badge-green { background: rgba(34,197,94,.15); color: #22c55e; border-color: rgba(34,197,94,.3); }
.ms-badge-yellow { background: rgba(234,179,8,.15); color: #eab308; border-color: rgba(234,179,8,.3); }
.ms-badge-red { background: rgba(239,68,68,.15); color: #ef4444; border-color: rgba(239,68,68,.3); }

/* Mats tips */
.ms-mats-tip {
  background: rgba(34,197,94,.08); border: 1px solid rgba(34,197,94,.2);
  border-radius: var(--ms-radius); padding: .8rem 1rem;
  font-size: .9rem; margin-bottom: .6rem;
}
.ms-mats-tip strong { color: var(--ms-accent); }

/* Tabs */
.ms-tabs { display: flex; gap: .3rem; margin-bottom: 1rem; border-bottom: 1px solid var(--ms-hairline); padding-bottom: .4rem; }
.ms-tab {
  padding: .4rem .8rem; border-radius: 8px 8px 0 0; font-size: .85rem; font-weight: 600;
  border: none; background: transparent; color: var(--ms-muted); cursor: pointer;
}
.ms-tab.active { color: var(--ms-accent); border-bottom: 2px solid var(--ms-accent); }

/* Utilities */
.ms-muted { color: var(--ms-muted); }
.ms-text-sm { font-size: .85rem; }
.ms-text-xs { font-size: .75rem; }
.ms-mt-1 { margin-top: .5rem; }
.ms-mt-2 { margin-top: 1rem; }
.ms-mb-1 { margin-bottom: .5rem; }
.ms-flex { display: flex; }
.ms-flex-between { display: flex; justify-content: space-between; align-items: center; }
.ms-gap-1 { gap: .5rem; }
.ms-gap-2 { gap: 1rem; }
.ms-hidden { display: none !important; }
.ms-center { text-align: center; }

/* Checkbox as toggle */
.ms-check {
  width: 1.1rem; height: 1.1rem; accent-color: var(--ms-accent);
  cursor: pointer;
}

/* Responsive */
@media (max-width: 640px) {
  .ms-nav { gap: .25rem; }
  .ms-nav a, .ms-nav button { padding: .3rem .55rem; font-size: .75rem; }
  .ms-grid-2, .ms-grid-3 { grid-template-columns: 1fr; }
}

/* Login page specific */
.ms-login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 2rem 1rem;
}
.ms-login-card {
  width: 100%; max-width: 400px;
  background: var(--ms-card); border: 1px solid var(--ms-hairline);
  border-radius: var(--ms-radius); padding: 2rem;
}
.ms-login-card h1 { font-size: 1.5rem; font-weight: 900; text-align: center; margin-bottom: .4rem; }
.ms-login-card .subtitle { text-align: center; color: var(--ms-muted); font-size: .9rem; margin-bottom: 1.5rem; }
.ms-error {
  background: rgba(239,68,68,.12); border: 1px solid rgba(239,68,68,.3);
  color: #fca5a5; padding: .6rem .8rem; border-radius: 10px;
  font-size: .85rem; margin-bottom: 1rem;
}
