:root {
  --orange: #f58109;
  --orange-dark: #a35608;
  --black: #111111;
  --gray-text: #5f5e5a;
  --gray-muted: #888780;
  --border: #e4e2da;
  --surface: #ffffff;
  --surface-1: #f7f6f2;
  --radius: 8px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--black);
  background: var(--surface);
  line-height: 1.6;
}

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

.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 24px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 0;
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 18px;
}
.brand img { height: 34px; width: auto; display: block; }
.brand span.accent { color: var(--orange); }

.btn {
  display: inline-block;
  border-radius: var(--radius);
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--black);
  cursor: pointer;
  text-align: center;
}
.btn:hover { background: var(--surface-1); text-decoration: none; }

.btn-primary {
  background: var(--orange);
  border-color: var(--orange);
  color: #fff;
}
.btn-primary:hover { background: var(--orange-dark); }

.btn-block { width: 100%; }

.hero {
  text-align: center;
  max-width: 620px;
  margin: 64px auto;
}
.hero h1 {
  font-size: 34px;
  margin: 0 0 14px;
  line-height: 1.25;
}
.hero p {
  color: var(--gray-text);
  font-size: 16px;
  margin: 0 0 28px;
}
.hero-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin: 40px 0;
}
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin: 40px 0;
  text-align: center;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
}
.card h3 { margin: 12px 0 6px; font-size: 17px; }
.card p { margin: 0; color: var(--gray-text); font-size: 14px; }
.card-icon { color: var(--orange); font-size: 26px; }

.card-link {
  display: block;
  cursor: pointer;
}
.card-link:hover { border-color: var(--orange); text-decoration: none; }

.callout {
  background: var(--surface-1);
  border-radius: 12px;
  padding: 32px;
  text-align: center;
  margin: 48px 0;
}
.callout p.title { font-weight: 600; margin: 0 0 6px; font-size: 16px; }
.callout p.sub { color: var(--gray-text); font-size: 14px; margin: 0 0 18px; }

footer {
  border-top: 1px solid var(--border);
  margin-top: 60px;
  padding: 24px 0;
  text-align: center;
  color: var(--gray-muted);
  font-size: 13px;
}

/* Auth pages */
.auth-wrap {
  max-width: 360px;
  margin: 60px auto;
}
.auth-logo {
  text-align: center;
  margin-bottom: 24px;
}
.auth-logo img { height: 56px; margin-bottom: 10px; }
.auth-logo .name { font-weight: 600; font-size: 16px; }

.tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}
.tab {
  flex: 1;
  text-align: center;
  padding: 10px 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-text);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  background: none;
  border-top: none; border-left: none; border-right: none;
}
.tab.active {
  color: var(--orange);
  border-bottom-color: var(--orange);
}

.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-size: 13px;
  color: var(--gray-text);
  margin-bottom: 5px;
}
.field input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
}
.field input:focus {
  outline: none;
  border-color: var(--orange);
}

.forgot {
  text-align: right;
  font-size: 12px;
  margin: -8px 0 16px;
}

.terms {
  text-align: center;
  font-size: 12px;
  color: var(--gray-muted);
  margin-top: 18px;
}

/* Dashboard */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 0;
  border-bottom: 1px solid var(--border);
}
.user-chip {
  font-size: 13px;
  color: var(--gray-text);
  display: flex;
  align-items: center;
  gap: 6px;
}
.intro {
  color: var(--gray-text);
  font-size: 14px;
  margin: 24px 0 16px;
}

/* Cycle list */
.back-link {
  display: inline-block;
  margin: 24px 0 4px;
  font-size: 14px;
  color: var(--gray-text);
}
.cycle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 10px;
}
.cycle-left { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.badge {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 4px;
  background: #faeeda;
  color: #854f0b;
}
.badge-free {
  background: #eaf3de;
  color: #3b6d11;
}

/* Tool page */
.tool-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin: 24px 0;
}
.tool-grid .field input, .tool-grid .field select {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
}
canvas#preview {
  width: 100%;
  height: 200px;
  background: var(--surface-1);
  border-radius: var(--radius);
  margin: 20px 0;
}
textarea#gcode-output {
  width: 100%;
  height: 260px;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-1);
  resize: vertical;
}
.tool-actions { display: flex; gap: 10px; margin-bottom: 10px; }

@media (max-width: 640px) {
  .grid-2, .grid-3, .tool-grid { grid-template-columns: 1fr; }
  .hero h1 { font-size: 26px; }
}
