/* TED Visual Tokens */
:root {
  --navy: #1B3A4B;
  --gold: #C4A35A;
  --text: #1A1A1A;
  --light-bg: #F8F9FA;
  --white: #FFFFFF;
  --error: #D32F2F;
  --border: #E0E0E0;
  --success: #388E3C;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
  background: var(--light-bg);
  color: var(--text);
  line-height: 1.6;
}

.view {
  min-height: 100vh;
}

/* Auth View */
.auth-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 2rem;
}

.logo {
  text-align: center;
  margin-bottom: 2rem;
}

.logo-icon {
  font-size: 3rem;
  margin-bottom: 0.5rem;
}

.logo h1 {
  color: var(--navy);
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

.tagline {
  color: var(--gold);
  font-size: 0.9rem;
}

.auth-form {
  background: var(--white);
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  padding: 2rem;
  width: 100%;
  max-width: 400px;
}

.tabs {
  display: flex;
  margin-bottom: 1.5rem;
  border-bottom: 2px solid var(--border);
}

.tab {
  flex: 1;
  padding: 0.75rem;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 1rem;
  color: var(--text);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
}

.tab.active {
  color: var(--navy);
  border-bottom-color: var(--navy);
  font-weight: 600;
}

.form-content {
  display: none;
}

.form-content.active {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

input, textarea {
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 1rem;
  font-family: inherit;
}

input:focus, textarea:focus {
  outline: none;
  border-color: var(--navy);
}

textarea {
  min-height: 120px;
  resize: vertical;
}

button {
  cursor: pointer;
  font-family: inherit;
}

.btn-primary {
  background: var(--navy);
  color: var(--white);
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 4px;
  font-size: 1rem;
  font-weight: 600;
}

.btn-primary:hover {
  background: #0f2530;
}

.btn-secondary {
  background: var(--white);
  color: var(--navy);
  border: 2px solid var(--navy);
  padding: 0.75rem 1.5rem;
  border-radius: 4px;
  font-size: 1rem;
  font-weight: 600;
}

.btn-secondary:hover {
  background: var(--light-bg);
}

.btn-danger {
  background: var(--error);
  color: var(--white);
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 4px;
  font-size: 1rem;
  font-weight: 600;
}

.btn-danger:hover {
  background: #b71c1c;
}

.error {
  color: var(--error);
  font-size: 0.9rem;
  margin-top: 1rem;
}

.demo-hint {
  margin-top: 1.5rem;
  padding: 1rem;
  background: var(--light-bg);
  border-radius: 4px;
  font-size: 0.85rem;
  text-align: center;
}

/* Main View */
header {
  background: var(--navy);
  color: var(--white);
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

header h1 {
  font-size: 1.5rem;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

main {
  padding: 2rem;
  max-width: 1200px;
  margin: 0 auto;
}

.section {
  background: var(--white);
  border-radius: 8px;
  padding: 2rem;
  margin-bottom: 2rem;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.section h2 {
  color: var(--navy);
  margin-bottom: 1.5rem;
}

.upload-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
}

.upload-card {
  border: 2px dashed var(--border);
  border-radius: 8px;
  padding: 2rem;
  text-align: center;
}

.upload-card h3 {
  margin-bottom: 1rem;
  color: var(--navy);
}

#paste-text {
  width: 100%;
  margin-bottom: 1rem;
}

/* Invoices List */
#invoices-list {
  display: grid;
  gap: 1rem;
}

.invoice-card {
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1rem;
  cursor: pointer;
  transition: box-shadow 0.2s;
}

.invoice-card:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.invoice-card h3 {
  color: var(--navy);
  margin-bottom: 0.5rem;
}

.invoice-meta {
  font-size: 0.85rem;
  color: #666;
}

/* Invoice Detail */
.detail-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 2rem;
}

.detail-header h2 {
  flex: 1;
  margin: 0;
}

.detail-actions {
  display: flex;
  gap: 1rem;
}

.line-items-header {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr 80px;
  gap: 1rem;
  padding: 0.75rem;
  background: var(--light-bg);
  border-radius: 4px;
  font-weight: 600;
  margin-bottom: 1rem;
}

.line-item {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr 80px;
  gap: 1rem;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  margin-bottom: 0.5rem;
  align-items: center;
}

.line-item input {
  padding: 0.5rem;
  border: 1px solid var(--border);
  border-radius: 4px;
}

.line-item-actions {
  display: flex;
  gap: 0.5rem;
}

.btn-small {
  padding: 0.25rem 0.5rem;
  font-size: 0.85rem;
}

#add-item-btn {
  margin-top: 1rem;
}

#loading {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--navy);
  color: var(--white);
  padding: 2rem 3rem;
  border-radius: 8px;
  font-size: 1.2rem;
  font-weight: 600;
  z-index: 1000;
}

@media (max-width: 768px) {
  .line-items-header,
  .line-item {
    grid-template-columns: 1fr;
  }
  
  .line-items-header span:nth-child(n+2) {
    display: none;
  }
  
  .upload-options {
    grid-template-columns: 1fr;
  }
}
