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

:root {
  --green: #06c755;
  --green-dark: #05a847;
  --text: #1a1a1a;
  --muted: #6b7280;
  --border: #e5e7eb;
  --bg: #f9fafb;
  --white: #ffffff;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ---- Card ---- */

.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 40px 36px;
  width: 100%;
  max-width: 420px;
}

/* ---- Wordmark ---- */

.wordmark {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--text);
  margin-bottom: 4px;
}

.tagline {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 32px;
}

/* ---- LINE login button ---- */

.btn-line {
  display: block;
  width: 100%;
  padding: 13px 20px;
  background: var(--green);
  color: var(--white);
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  transition: background 0.15s;
}

.btn-line:hover {
  background: var(--green-dark);
}

/* ---- Error banner ---- */

.error-banner {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
  border-radius: 6px;
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 20px;
}

/* ---- Dashboard layout ---- */

body.dashboard {
  align-items: flex-start;
  justify-content: flex-start;
  padding: 0;
}

.dashboard-shell {
  width: 100%;
  min-height: 100vh;
}

.topbar {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.topbar-workspace {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  border-left: 1px solid var(--border);
  padding-left: 16px;
}

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

.topbar-name {
  font-size: 13px;
  color: var(--muted);
}

.topbar .wordmark {
  margin: 0;
  font-size: 18px;
}

.btn-logout {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  color: var(--text);
  transition: border-color 0.15s;
}

.btn-logout:hover {
  border-color: #9ca3af;
}

/* ---- Dashboard two-column body ---- */

.dashboard-body {
  display: flex;
  height: calc(100vh - 56px);
  overflow: hidden;
}

.sidebar {
  width: 200px;
  background: var(--white);
  border-right: 1px solid var(--border);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.sidebar-main {
  flex: 1;
  padding: 8px 0;
}

.sidebar-bottom {
  border-top: 1px solid var(--border);
  padding: 8px 0;
}

.nav-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 9px 16px;
  font-size: 14px;
  color: var(--muted);
  background: none;
  border: none;
  border-left: 2px solid transparent;
  cursor: pointer;
  transition: color 0.1s, background 0.1s;
}

.nav-item:hover {
  color: var(--text);
  background: var(--bg);
}

.nav-item.active {
  color: var(--text);
  font-weight: 500;
  background: var(--bg);
  border-left-color: var(--text);
}

.content-area {
  flex: 1;
  overflow-y: auto;
  padding: 32px 24px;
}

.content-area > * {
  max-width: 720px;
}

/* ---- Page title (used inside content-area) ---- */

.page-title {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 20px;
}

/* ---- Stub module views ---- */

.stub-description {
  font-size: 14px;
  color: var(--muted);
  margin-top: 4px;
}

.stub-account-id {
  font-size: 11px;
  color: var(--border);
  margin-top: 16px;
  font-family: monospace;
}

/* ---- Legacy: kept for onboarding page compatibility ---- */

.main {
  padding: 32px 24px;
  max-width: 640px;
}

.dash-page-title {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 20px;
}

/* ---- Profile block ---- */

.profile-block {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 28px;
}

.avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--border);
  flex-shrink: 0;
}

.avatar-placeholder {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--border);
  flex-shrink: 0;
}

.profile-name {
  font-size: 18px;
  font-weight: 600;
}

.profile-label {
  font-size: 13px;
  color: var(--muted);
  margin-top: 2px;
}

/* ---- Info table ---- */

.info-section {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 20px;
}

.info-section-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.info-row {
  display: flex;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

.info-row:last-child {
  border-bottom: none;
}

.info-key {
  color: var(--muted);
  width: 140px;
  flex-shrink: 0;
}

.info-val {
  color: var(--text);
  word-break: break-all;
}

/* ---- Loading state ---- */

.loading {
  color: var(--muted);
  font-size: 14px;
  padding: 16px 0;
}

/* ---- Onboarding form ---- */

.onboarding-context {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 28px;
}

.field {
  margin-bottom: 22px;
}

.field-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.field-optional {
  font-weight: 400;
  color: var(--muted);
}

.field-input {
  display: block;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 7px;
  font-size: 14px;
  color: var(--text);
  background: var(--white);
  outline: none;
  transition: border-color 0.15s;
}

.field-input:focus {
  border-color: #9ca3af;
}

.field-hint {
  font-size: 12px;
  color: var(--muted);
  margin-top: 5px;
}

.radio-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.radio-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.15s;
}

.radio-option:has(input:checked) {
  border-color: var(--green);
  background: #f0fdf4;
}

.radio-option input[type="radio"] {
  margin-top: 2px;
  flex-shrink: 0;
  accent-color: var(--green);
}

.radio-label {
  font-size: 14px;
  font-weight: 600;
  display: block;
  line-height: 1.3;
}

.radio-sub {
  font-size: 12px;
  color: var(--muted);
  display: block;
  margin-top: 2px;
}

.btn-submit {
  display: block;
  width: 100%;
  padding: 13px 20px;
  background: var(--text);
  color: var(--white);
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
  margin-top: 4px;
}

.btn-submit:hover:not(:disabled) {
  opacity: 0.85;
}

.btn-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ---- Module views (lists + detail panels) ---- */

.tomo-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 16px;
}

.tomo-input,
.tomo-select {
  font-family: inherit;
  font-size: 13px;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--white);
  color: var(--text);
  outline: none;
}

.tomo-input:focus,
.tomo-select:focus {
  border-color: var(--green);
}

.tomo-input {
  min-width: 220px;
}

.tomo-table-wrap {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-x: auto;
  margin-bottom: 16px;
}

.tomo-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.tomo-table thead th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  white-space: nowrap;
}

.tomo-table tbody td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.tomo-table tbody tr:last-child td {
  border-bottom: none;
}

.tomo-table tr.tomo-clickable {
  cursor: pointer;
}

.tomo-table tr.tomo-clickable:hover td {
  background: #fafafa;
}

.tomo-mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
}

.tomo-empty {
  font-size: 13px;
  color: var(--muted);
  padding: 28px 14px;
  text-align: center;
}

.tomo-error {
  font-size: 13px;
  color: #991b1b;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 6px;
  padding: 8px 12px;
  margin-bottom: 12px;
}

.tomo-loading {
  font-size: 13px;
  color: var(--muted);
  padding: 18px 0;
}

.tomo-pill {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--bg);
  color: var(--muted);
  border: 1px solid var(--border);
  white-space: nowrap;
}

.tomo-pill-green   { background: #ecfdf5; color: #047857; border-color: #a7f3d0; }
.tomo-pill-red     { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }
.tomo-pill-amber   { background: #fffbeb; color: #b45309; border-color: #fde68a; }
.tomo-pill-blue    { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }

.tomo-btn {
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  padding: 7px 12px;
  border-radius: 6px;
  border: 1px solid var(--green);
  background: var(--green);
  color: var(--white);
  cursor: pointer;
  transition: background 0.15s;
}

.tomo-btn:hover:not(:disabled) {
  background: var(--green-dark);
}

.tomo-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.tomo-btn-ghost {
  background: var(--white);
  color: var(--text);
  border: 1px solid var(--border);
}

.tomo-btn-ghost:hover:not(:disabled) {
  background: var(--bg);
}

.tomo-btn-danger {
  background: #dc2626;
  border-color: #dc2626;
}

.tomo-btn-danger:hover:not(:disabled) {
  background: #b91c1c;
}

.tomo-btn-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.tomo-detail {
  margin-bottom: 16px;
}

.tomo-detail-back {
  font-size: 13px;
  color: var(--muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  margin-bottom: 12px;
}

.tomo-detail-back:hover {
  color: var(--text);
}

.tomo-textarea {
  width: 100%;
  font-family: inherit;
  font-size: 13px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  resize: vertical;
  min-height: 60px;
  outline: none;
}

.tomo-textarea:focus {
  border-color: var(--green);
}

.content-area > .tomo-page-wide {
  max-width: 960px;
}

.tomo-page-wide > * {
  max-width: 960px;
}

/* ---- Form sections (Upload page, Create-export modal) ---- */

.tomo-form-section {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 20px;
}

.tomo-form-section-title {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 4px;
}

.tomo-form-section-desc {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 14px;
}

.tomo-form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 12px;
}

.tomo-form-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1 1 200px;
}

.tomo-form-field label {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.tomo-form-field input,
.tomo-form-field select {
  font-family: inherit;
  font-size: 13px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--white);
  outline: none;
}

.tomo-form-field input:focus,
.tomo-form-field select:focus {
  border-color: var(--green);
}

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

.tomo-success {
  font-size: 13px;
  color: #047857;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  border-radius: 6px;
  padding: 8px 12px;
  margin-bottom: 12px;
}

.tomo-copy-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 8px;
}

.tomo-copy-row input {
  flex: 1;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
}

.tomo-file-input {
  font-family: inherit;
  font-size: 13px;
}

.tomo-file-preview {
  max-width: 200px;
  max-height: 200px;
  margin-top: 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
}
