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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #0f172a;
  color: #e2e8f0;
  min-height: 100vh;
}

.screen {
  display: none;
}

.screen.active {
  display: flex;
}

#login-screen {
  justify-content: center;
  align-items: center;
  min-height: 100vh;
}

.login-box {
  background: #1e293b;
  padding: 40px;
  border-radius: 12px;
  text-align: center;
  width: 360px;
  border: 1px solid #334155;
}

.login-box h1 {
  margin-bottom: 8px;
  font-size: 24px;
  color: #f8fafc;
}

.login-box p {
  margin-bottom: 20px;
  color: #94a3b8;
  font-size: 14px;
}

.input-group {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
}

.input-group input {
  flex: 1;
  margin-bottom: 0;
}

.input-group input[type="password"],
.input-group input[type="text"] {
  margin-bottom: 0;
}

.btn-toggle {
  padding: 10px 12px;
  background: #334155;
  border: 1px solid #475569;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  color: #94a3b8;
  flex-shrink: 0;
}

.btn-toggle:hover {
  background: #475569;
  color: #e2e8f0;
}

input[type="password"],
input[type="text"],
input[type="url"],
input[type="email"],
textarea {
  width: 100%;
  padding: 10px 14px;
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 6px;
  color: #e2e8f0;
  font-size: 14px;
  margin-bottom: 16px;
  outline: none;
}

input:focus,
textarea:focus {
  border-color: #3b82f6;
}

button {
  padding: 10px 20px;
  background: #3b82f6;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
}

button:hover {
  background: #2563eb;
}

.error {
  color: #ef4444 !important;
  font-size: 13px !important;
  min-height: 20px;
}

#dashboard-screen {
  flex-direction: column;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 32px;
  background: #1e293b;
  border-bottom: 1px solid #334155;
}

header h1 {
  font-size: 20px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-badge {
  background: #334155;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 12px;
  color: #93c5fd;
  border: 1px solid #475569;
}

#logout-btn {
  background: #475569;
}

#logout-btn:hover {
  background: #64748b;
}

main {
  padding: 32px;
  max-width: 1000px;
  margin: 0 auto;
  width: 100%;
}

.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 24px;
  border-bottom: 1px solid #334155;
}

.tab-btn {
  background: transparent;
  color: #94a3b8;
  border-radius: 0;
  padding: 10px 20px;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.tab-btn:hover {
  background: transparent;
  color: #e2e8f0;
}

.tab-btn.active {
  background: transparent;
  color: #3b82f6;
  border-bottom-color: #3b82f6;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.toolbar h2 {
  font-size: 18px;
}

.provider-card,
.credential-card,
.user-card {
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 16px;
}

.provider-header,
.credential-header,
.user-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.provider-name,
.credential-title,
.user-code {
  font-size: 16px;
  font-weight: 600;
  color: #f8fafc;
}

.provider-actions button,
.credential-actions button,
.user-actions button {
  margin-left: 8px;
  padding: 6px 12px;
  font-size: 12px;
}

.btn-delete {
  background: #dc2626;
}

.btn-delete:hover {
  background: #b91c1c;
}

.btn-edit {
  background: #475569;
}

.btn-edit:hover {
  background: #64748b;
}

.provider-detail,
.credential-detail {
  font-size: 13px;
  color: #94a3b8;
  margin-bottom: 6px;
  word-break: break-all;
}

.provider-detail span,
.credential-detail span {
  color: #cbd5e1;
}

.secret-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.secret-value {
  font-family: monospace;
  font-size: 13px;
  color: #cbd5e1;
}

.secret-hidden {
  color: #64748b;
}

.btn-icon {
  background: transparent;
  border: 1px solid #475569;
  border-radius: 4px;
  padding: 4px 8px;
  cursor: pointer;
  font-size: 12px;
  color: #94a3b8;
  flex-shrink: 0;
}

.btn-icon:hover {
  background: #334155;
  color: #e2e8f0;
}

.btn-copy:hover {
  background: #1e3a5f;
  border-color: #3b82f6;
  color: #93c5fd;
}

.btn-toggle-card:hover {
  background: #1e3a5f;
  border-color: #3b82f6;
  color: #93c5fd;
}

.models-list {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.model-tag {
  background: #334155;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 12px;
  color: #93c5fd;
}

.notes {
  margin-top: 10px;
  font-size: 13px;
  color: #64748b;
  font-style: italic;
}

.user-detail {
  font-size: 13px;
  color: #94a3b8;
  margin-bottom: 6px;
}

.user-detail span {
  color: #cbd5e1;
}

.badge-admin {
  background: #7c3aed;
  color: white;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  margin-left: 8px;
}

.badge-user {
  background: #334155;
  color: #93c5fd;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  margin-left: 8px;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: #94a3b8;
  cursor: pointer;
  margin-bottom: 16px;
}

.checkbox-label input[type="checkbox"] {
  width: auto;
  margin-bottom: 0;
  accent-color: #3b82f6;
}

#modal-overlay,
#cred-modal-overlay,
#user-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 100;
}

#modal-overlay.hidden,
#cred-modal-overlay.hidden,
#user-modal-overlay.hidden {
  display: none;
}

.modal {
  background: #1e293b;
  padding: 32px;
  border-radius: 12px;
  width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  border: 1px solid #334155;
}

.modal h2 {
  margin-bottom: 20px;
  font-size: 18px;
}

.modal label {
  display: block;
  font-size: 13px;
  color: #94a3b8;
  margin-bottom: 6px;
}

.form-actions {
  display: flex;
  gap: 10px;
  margin-top: 8px;
}

.form-actions button:last-child {
  background: #475569;
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: #64748b;
}

.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  background: #334155;
  color: #f8fafc;
  padding: 10px 24px;
  border-radius: 8px;
  font-size: 13px;
  border: 1px solid #475569;
  z-index: 200;
  transition: opacity 0.3s;
}

.toast.hidden {
  opacity: 0;
  pointer-events: none;
}

.search-bar {
  margin-bottom: 20px;
}

.search-bar input {
  width: 100%;
  padding: 10px 14px;
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 6px;
  color: #e2e8f0;
  font-size: 14px;
  outline: none;
}

.search-bar input:focus {
  border-color: #3b82f6;
}

.settings-panel {
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 10px;
  padding: 24px;
}

.settings-panel h2 {
  font-size: 18px;
  margin-bottom: 20px;
  color: #f8fafc;
}

.setting-row {
  margin-bottom: 16px;
}

.setting-row label {
  display: block;
  font-size: 13px;
  color: #94a3b8;
  margin-bottom: 8px;
}

.grid-header {
  display: grid;
  grid-template-columns: 60px 1fr 140px 140px;
  padding: 12px 16px;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 8px;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 600;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.grid-row {
  display: grid;
  grid-template-columns: 60px 1fr 140px 140px;
  padding: 14px 16px;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 8px;
  margin-bottom: 8px;
  align-items: center;
  transition: border-color 0.2s;
}

.grid-row:hover {
  border-color: #3b82f6;
}

.grid-cell {
  font-size: 14px;
  color: #e2e8f0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
}

.grid-cell .secret-row,
.grid-cell .btn-icon {
  display: inline-block;
  vertical-align: middle;
}

.grid-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}
