* { box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  margin: 0;
  background: #f5f5f7;
  color: #222;
}

/* Login */
.login-page { display: flex; justify-content: center; align-items: center; min-height: 100vh; }
.login-form { background: white; padding: 2rem; border-radius: 8px; box-shadow: 0 2px 8px rgba(0,0,0,0.08); width: 320px; }
.login-form h1 { margin-top: 0; font-size: 1.25rem; }
.login-form label { display: block; margin: 0.75rem 0; }
.login-form input { width: 100%; padding: 0.5rem; border: 1px solid #ccc; border-radius: 4px; margin-top: 0.25rem; }
.login-form button { width: 100%; padding: 0.6rem; background: #0070f3; color: white; border: 0; border-radius: 4px; font-weight: 600; cursor: pointer; }
.login-form .error { color: #c00; }

/* Header */
.app-header { display: flex; justify-content: space-between; align-items: center; padding: 1rem 1.5rem; background: white; border-bottom: 1px solid #e5e5e5; }
.app-header h1 { margin: 0; font-size: 1.1rem; }
.app-header .actions button { margin-left: 0.5rem; padding: 0.4rem 0.8rem; border-radius: 4px; border: 1px solid #ccc; background: white; cursor: pointer; }

/* Toolbar */
.toolbar { display: flex; gap: 0.5rem; align-items: center; padding: 1rem 1.5rem; background: white; border-bottom: 1px solid #e5e5e5; }
.toolbar input[type=text] { padding: 0.4rem 0.6rem; border: 1px solid #ccc; border-radius: 4px; min-width: 240px; }
.toolbar button { padding: 0.4rem 0.8rem; border: 1px solid #ccc; background: white; border-radius: 4px; cursor: pointer; }
.toolbar button:disabled { opacity: 0.5; cursor: not-allowed; }

/* Table */
table { width: 100%; border-collapse: collapse; background: white; }
th, td { padding: 0.6rem 1rem; text-align: left; border-bottom: 1px solid #f0f0f0; font-size: 0.9rem; }
th { background: #fafafa; font-weight: 600; }
.url-cell { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status-pill { display: inline-block; padding: 0.15rem 0.5rem; border-radius: 999px; font-size: 0.75rem; font-weight: 600; }
.status-pill.ACTIVE { background: #dcfce7; color: #166534; }
.status-pill.PAUSED { background: #fef3c7; color: #92400e; }

/* Modal */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.4); display: none; justify-content: center; align-items: center; z-index: 100; }
.modal-backdrop.open { display: flex; }
.modal { background: white; padding: 1.5rem; border-radius: 8px; min-width: 480px; max-width: 90vw; }
.modal h2 { margin-top: 0; font-size: 1.05rem; }
.modal .current-url { background: #f5f5f7; padding: 0.5rem; border-radius: 4px; font-family: monospace; font-size: 0.85rem; word-break: break-all; }
.modal label { display: block; margin: 1rem 0 0.25rem; }
.modal input[type=text] { width: 100%; padding: 0.5rem; border: 1px solid #ccc; border-radius: 4px; }
.modal .macros-hint { font-size: 0.8rem; color: #666; margin-top: 0.5rem; font-family: monospace; }
.modal .macro-warning { background: #fef3c7; padding: 0.5rem; border-radius: 4px; margin-top: 0.5rem; font-size: 0.85rem; display: none; }
.modal .macro-warning.show { display: block; }
.modal .actions { display: flex; gap: 0.5rem; justify-content: flex-end; margin-top: 1.25rem; }
.modal button { padding: 0.5rem 1rem; border-radius: 4px; cursor: pointer; }
.modal .cancel { border: 1px solid #ccc; background: white; }
.modal .confirm { border: 0; background: #0070f3; color: white; font-weight: 600; }
.modal .error-inline { color: #c00; margin-top: 0.5rem; font-size: 0.85rem; }

/* Toasts */
.toast-stack { position: fixed; top: 1rem; right: 1rem; display: flex; flex-direction: column; gap: 0.5rem; z-index: 200; }
.toast { padding: 0.6rem 1rem; border-radius: 6px; box-shadow: 0 2px 8px rgba(0,0,0,0.15); font-size: 0.9rem; min-width: 240px; }
.toast.green { background: #dcfce7; color: #166534; }
.toast.yellow { background: #fef3c7; color: #92400e; }
.toast.red { background: #fee2e2; color: #991b1b; }
