:root {
  --bg: #f5f5f7;
  --panel: #ffffff;
  --text: #111111;
  --muted: #6e6e73;
  --border: #d2d2d7;
  --sidebar: #111111;
  --sidebar-text: #ffffff;
  --accent: #8e8e93;
  --error: #b42318;
  --success: #027a48;
  --shadow: 0 10px 30px rgba(0,0,0,0.06);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
a { color: inherit; }
.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.auth-card {
  width: 100%;
  max-width: 560px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 32px;
}
.logo-slot {
  width: 140px;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 18px;
  font-size: 12px;
  letter-spacing: 0.1em;
}

.logo {
  max-height: 30px;
  width: auto;
}

.logo-login {
  max-height: 30px;
  width: auto;
}
.stack { display: grid; gap: 14px; }
label { display: grid; gap: 6px; font-size: 14px; }

input,
textarea,
select,
button {
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--border);
  padding: 12px 14px;
  font-size: 15px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
button {
  background: var(--text);
  color: white;
  cursor: pointer;
}
.links-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
}
.alert {
  margin: 12px 0;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
}
.alert-error { color: var(--error); background: #fef3f2; }
.alert-success { color: var(--success); background: #ecfdf3; }
.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px 1fr;
}
.sidebar {
  background: var(--sidebar);
  color: var(--sidebar-text);
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.sidebar-logo { color: var(--sidebar-text); border-color: rgba(255,255,255,0.4); }
.nav-links {
  display: grid;
  gap: 8px;
  margin-top: 24px;
}
.nav-links a {
  text-decoration: none;
  padding: 12px 14px;
  border-radius: 12px;
  color: var(--sidebar-text);
  background: rgba(255,255,255,0.05);
}
.nav-links a:hover { background: rgba(255,255,255,0.12); }
.content { padding: 28px; }
.page-header { margin-bottom: 20px; }
.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 24px;
}
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.muted { color: var(--muted); }
.small { font-size: 13px; }
@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { gap: 20px; }
  .grid-3 { grid-template-columns: 1fr; }
  .links-row { flex-direction: column; }
}

.form-container {
  max-width: 400px;
  width: 100%;
}

.error {
  color: #b00020;
  font-weight: 600;
  background: #fff1f2;
  border-left: 4px solid #b00020;
  padding: 10px 12px;
  border-radius: 4px;
  margin-bottom: 14px;
}

.ai-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ai-modal-content {
  background: #fff;
  width: 95%;
  max-width: 1000px;
  border-radius: 10px;
  padding: 24px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
}

.ai-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.ai-modal-header h2 {
  margin: 0;
}

.ai-close-btn {
  background: transparent;
  border: none;
  font-size: 28px;
  cursor: pointer;
  width: auto;
}

#aiTextModal .ai-modal-body {
  width: 100%;
}

#aiTextModal .form-group {
  width: 100%;
}

#aiTextModal #ai-template-type,
#aiTextModal #ai-prompt-input,
#aiTextModal #ai-result-text {
  width: 100%;
  max-width: none;
  box-sizing: border-box;
  display: block;
}

#ai-error-message,
#ai-success-message {
  font-size: 14px;
}