.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
}

.auth-card {
    background: var(--bg-card);
    padding: 3rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    width: 90%;
    max-width: 440px;
    text-align: center;
    box-shadow: var(--shadow);
}

.auth-brand { margin-bottom: 2rem; }

.auth-brand h1 {
    font-size: 1.6rem;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.auth-brand p {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.auth-info p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

.btn-drive-login {
    display: inline-block;
    padding: 0.85rem 2.5rem;
    text-decoration: none;
    font-size: 1rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    transition: all 0.2s;
}

.btn-drive-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.auth-divider {
    margin: 1.5rem 0;
    border: none;
    border-top: 1px solid var(--border);
}

.auth-footnote {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0;
}

.auth-footnote a {
    color: var(--accent-light);
}

/* Login form */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.auth-form input {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.95rem;
    transition: border-color 0.2s;
}

.auth-form input:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.auth-form input::placeholder {
    color: var(--text-muted);
}

.auth-error {
    color: #e85d5d;
    font-size: 0.85rem;
    text-align: center;
}

.auth-form .btn-primary {
    margin-top: 0.5rem;
    padding: 0.75rem;
    font-size: 1rem;
}

.btn-link {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.85rem;
    cursor: pointer;
    margin-top: 0.25rem;
    transition: color 0.2s;
}
.btn-link:hover { color: var(--accent-light); }

.sheets-page { min-height: 100vh; background: var(--bg-primary); }
.sheets-header { display: flex; justify-content: space-between; align-items: center; padding: 1rem 2rem; background: var(--bg-secondary); border-bottom: 1px solid var(--border); }
.sheets-header h1 { font-size: 1.3rem; }
.header-right { display: flex; gap: 0.75rem; }
.sheets-content { max-width: 1100px; margin: 0 auto; padding: 2rem; }
.sheets-empty { text-align: center; padding: 4rem 2rem; }
.sheets-empty .empty-icon { font-size: 3rem; margin-bottom: 1rem; }
.sheets-empty h3 { color: var(--text-primary); margin-bottom: 0.5rem; }
.sheets-empty p { color: var(--text-muted); margin-bottom: 1.5rem; }

.sheets-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 1.25rem; }

.sheet-card {
    background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 1.25rem; cursor: pointer; transition: all 0.2s; position: relative;
}
.sheet-card:hover { border-color: var(--accent-primary); transform: translateY(-2px); box-shadow: var(--shadow); }
.sheet-icon { font-size: 2rem; margin-bottom: 0.75rem; }
.sheet-title { font-weight: 600; font-size: 0.95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 0.35rem; }
.sheet-meta { font-size: 0.8rem; color: var(--text-muted); }
.sheet-delete {
    position: absolute; top: 0.5rem; right: 0.5rem; background: none; border: none;
    color: var(--text-muted); font-size: 1rem; cursor: pointer; opacity: 0; transition: opacity 0.2s;
}
.sheet-card:hover .sheet-delete { opacity: 1; }
.sheet-delete:hover { color: var(--accent-light); }

.sheet-editor-page { min-height: 100vh; background: var(--bg-primary); display: flex; flex-direction: column; }

.sheet-editor-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 0.75rem 1.5rem; background: var(--bg-secondary); border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.header-left { display: flex; align-items: center; gap: 1rem; flex: 1; }
.header-right { display: flex; align-items: center; gap: 1rem; }
.btn-back { background: none; border: none; color: var(--text-muted); font-size: 0.9rem; cursor: pointer; }
.btn-back:hover { color: var(--accent-light); }
.title-input {
    background: transparent; border: none; color: var(--text-primary);
    font-size: 1.1rem; font-weight: 600; font-family: var(--font); outline: none;
    max-width: 300px; width: 100%; padding: 0.3rem 0.5rem; border-radius: var(--radius-sm);
}
.title-input:focus { background: var(--bg-hover); }
.save-status { font-size: 0.8rem; color: var(--text-muted); }
.cell-ref { font-size: 0.85rem; color: var(--accent-light); font-weight: 600; }

/* Formula bar */
.formula-bar {
    display: flex; align-items: center; gap: 0.75rem;
    padding: 0.4rem 1.5rem; background: var(--bg-card); border-bottom: 1px solid var(--border);
    font-size: 0.85rem;
}
.formula-cell-ref { color: var(--accent-light); font-weight: 600; min-width: 40px; }
.formula-value { color: var(--text-secondary); }

/* Spreadsheet */
.spreadsheet-wrapper { flex: 1; overflow: auto; }

.spreadsheet {
    border-collapse: collapse; width: max-content; min-width: 100%;
}

.spreadsheet th, .spreadsheet td {
    border: 1px solid var(--border); padding: 0; text-align: left;
}

.spreadsheet th {
    background: var(--bg-secondary); color: var(--text-muted);
    font-size: 0.75rem; font-weight: 600; text-align: center;
    padding: 0.35rem 0.5rem; position: sticky; top: 0; z-index: 2;
    user-select: none;
}

.row-header {
    background: var(--bg-secondary) !important; color: var(--text-muted) !important;
    font-size: 0.75rem !important; font-weight: 600 !important; text-align: center !important;
    width: 40px; min-width: 40px; position: sticky; left: 0; z-index: 1;
    padding: 0.35rem 0.5rem !important; user-select: none;
}

.cell {
    min-width: 100px; height: 30px; cursor: cell; position: relative;
}

.cell.selected {
    outline: 2px solid var(--accent-primary);
    outline-offset: -1px;
    z-index: 1;
}

.cell-display {
    display: block; padding: 0.25rem 0.4rem;
    font-size: 0.85rem; color: var(--text-primary);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    min-height: 100%; line-height: 1.5;
}

.cell-input {
    width: 100%; height: 100%; padding: 0.25rem 0.4rem;
    border: none; outline: none; font-size: 0.85rem;
    font-family: var(--font); background: var(--bg-primary);
    color: var(--text-primary); position: absolute; inset: 0;
}

:root {
  /* Atlas Sheets — Green accent */
  --bg-primary: #0f0f0f;
  --bg-secondary: #151a16;
  --bg-card: #1a221b;
  --bg-hover: #202a22;
  --accent-primary: #10b981;
  --accent-soft: #059669;
  --accent-dark: #047857;
  --accent-muted: #065f46;
  --accent-light: #34d399;
  --text-primary: #e6f5ee;
  --text-secondary: #a8c4b0;
  --text-muted: #708a78;
  --border: #2a3d2e;
  --success: #2d8a5e;
  --warning: #d97706;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
  --font: 'DM Sans', -apple-system, sans-serif;
}

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

body {
  font-family: var(--font);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.5;
}

a { color: var(--accent-soft); text-decoration: none; }
a:hover { color: var(--accent-light); }
button { font-family: var(--font); cursor: pointer; }
input, textarea { font-family: var(--font); }
#root { min-height: 100vh; }

.loading-screen {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; color: var(--text-secondary); font-size: 1.1rem;
}

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-secondary); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

.btn-primary {
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-soft));
  color: white; border: none; padding: 0.6rem 1.2rem;
  border-radius: var(--radius-sm); font-weight: 600; font-size: 0.9rem; transition: all 0.2s;
}
.btn-primary:hover { opacity: 0.9; transform: translateY(-1px); }

.btn-secondary {
  background: var(--bg-hover); color: var(--text-primary);
  border: 1px solid var(--border); padding: 0.6rem 1.2rem;
  border-radius: var(--radius-sm); font-weight: 500; font-size: 0.9rem; transition: all 0.2s;
}
.btn-secondary:hover { border-color: var(--text-muted); }

.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.6);
  display: flex; align-items: center; justify-content: center; z-index: 100;
}
.modal-card {
  background: var(--bg-card); padding: 1.5rem; border-radius: var(--radius);
  border: 1px solid var(--border); width: 90%; max-width: 420px;
}
.modal-card h3 { margin-bottom: 1rem; font-size: 1.1rem; }
.modal-card input {
  width: 100%; padding: 0.6rem; border-radius: var(--radius-sm);
  background: var(--bg-primary); border: 1px solid var(--border);
  color: var(--text-primary); font-size: 0.95rem; margin-bottom: 1rem;
}
.modal-actions { display: flex; gap: 0.75rem; justify-content: flex-end; }

