/* ===== Google / Material Design — 安静工具站 ===== */

:root {
  color-scheme: light;
  --bg: #f8f9fa;
  --panel: #ffffff;
  --line: #dadce0;
  --text: #202124;
  --text-secondary: #5f6368;
  --accent: #1a73e8;
  --accent-hover: #1557b0;
  --accent-light: #e8f0fe;
  --danger: #d93025;
  --success: #1e8e3e;
  --success-light: #e6f4ea;
  --warning: #f9ab00;
  --radius: 16px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(60,64,67,0.1), 0 1px 3px rgba(60,64,67,0.08);
  --shadow: 0 1px 3px rgba(60,64,67,0.12), 0 1px 2px rgba(60,64,67,0.08);
  --shadow-hover: 0 4px 12px rgba(60,64,67,0.18), 0 2px 6px rgba(60,64,67,0.12);
  --transition: 200ms ease;
}

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

html { min-height: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: 'Inter', 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: inherit;
  text-decoration: none;
}

/* ---- Top bar ---- */

.top-bar {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 24px;
  background: var(--panel);
  border-bottom: 1px solid #e8eaed;
  position: sticky;
  top: 0;
  z-index: 100;
}

.site-title {
  display: inline-flex;
  align-items: center;
  gap: 1px;
  font-size: 23px;
  font-weight: 500;
  letter-spacing: 0;
  color: var(--text-secondary);
  transition: color var(--transition);
}

.site-title:hover {
  color: var(--text);
}

.site-title span:nth-child(1) { color: #4285f4; }
.site-title span:nth-child(2) { color: #ea4335; }
.site-title span:nth-child(3) { color: #fbbc05; }
.site-title span:nth-child(4) { color: #34a853; }
.site-title span:nth-child(n+5) { color: var(--text-secondary); }

.auth-logo span:nth-child(1) { color: #4285f4; }
.auth-logo span:nth-child(2) { color: #ea4335; }
.auth-logo span:nth-child(3) { color: #fbbc05; }
.auth-logo span:nth-child(4) { color: #34a853; }
.auth-logo span:nth-child(n+5) { color: var(--text-secondary); }

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ---- Layout ---- */

.layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: calc(100vh - 64px);
}

.layout.home-layout {
  display: block;
}

.layout.home-layout > .sidebar {
  display: none;
}

/* ---- Sidebar ---- */

.sidebar {
  background: var(--panel);
  border-right: 1px solid var(--line);
  padding: 18px 12px 18px 0;
  overflow: auto;
}

.user-menu {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 12px 12px 24px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 12px;
}

.user-avatar {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 500;
}

.user-info {
  flex: 1;
  min-width: 0;
}

.user-email {
  font-size: 14px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.logout-form {
  margin: 0;
  flex: 0 0 auto;
}

.icon-button {
  width: 36px;
  min-width: 36px;
  height: 36px;
  min-height: 36px;
  padding: 0;
  border-radius: 50%;
  box-shadow: none;
  color: var(--text-secondary);
}

.icon-button:hover {
  background: var(--accent-light);
  color: var(--accent);
  box-shadow: none;
}

.icon-button .material-icons,
.icon-button .material-icons-outlined {
  font-size: 20px;
}

.sidebar-title {
  margin: 0 12px 14px 24px;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.tool-nav {
  display: grid;
  gap: 2px;
}

.tool-nav-item {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 12px;
  align-items: center;
  min-height: 44px;
  padding: 8px 18px 8px 24px;
  border-radius: 0 999px 999px 0;
  color: var(--text);
  text-decoration: none;
  transition: background var(--transition), color var(--transition);
}

.tool-nav-item:hover {
  background: rgba(26,115,232,0.06);
}

.tool-nav-item.active {
  background: #d3e3fd;
  color: #001d35;
  font-weight: 500;
}

.tool-nav-icon {
  font-size: 22px;
  line-height: 1;
}

.tool-nav-item strong,
.tool-nav-item small {
  display: block;
}

.tool-nav-item strong {
  font-size: 14px;
  line-height: 1.35;
  font-weight: 500;
}

.tool-nav-item small {
  margin-top: 1px;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 400;
}

/* ---- Content area ---- */

.content {
  padding: 24px;
  overflow: auto;
  background: var(--bg);
}

/* ---- Buttons ---- */

button,
.button {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 20px;
  border: none;
  border-radius: 24px;
  background: var(--panel);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition), background var(--transition), color var(--transition), transform var(--transition);
  letter-spacing: 0.2px;
}

button:hover,
.button:hover {
  box-shadow: var(--shadow-hover);
  background: #f1f3f4;
}

button:active,
.button:active {
  box-shadow: var(--shadow-sm);
}

button.primary,
.button.primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 1px 3px rgba(26,115,232,0.3);
}

button.primary:hover,
.button.primary:hover {
  background: var(--accent-hover);
  box-shadow: 0 0 0 6px rgba(26,115,232,0.12), 0 3px 8px rgba(26,115,232,0.32);
  color: #fff;
}

button.primary:active,
.button.primary:active {
  background: #12489b;
}

button:disabled,
.button:disabled {
  cursor: not-allowed;
  opacity: 1;
  box-shadow: none;
  background: #f1f3f4;
  color: #9aa0a6;
  border: 1px solid #eceff1;
}

/* ---- Form actions row ---- */

.actions,
.form-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* ---- Material form fields ---- */

.form-group {
  position: relative;
  margin: 20px 0;
  text-align: left;
}

.form-input {
  width: 100%;
  min-height: 56px;
  padding: 16px 16px 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel);
  color: var(--text);
  font-size: 16px;
  font-family: inherit;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.form-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(26,115,232,0.12);
}

.form-label {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-secondary);
  font-size: 16px;
  transition: all var(--transition);
  pointer-events: none;
  background: var(--panel);
  padding: 0 4px;
}

.form-input:focus ~ .form-label,
.form-input:not(:placeholder-shown) ~ .form-label {
  top: 8px;
  font-size: 12px;
  color: var(--accent);
}

/* ---- Auth pages ---- */

.auth-shell {
  min-height: 100vh;
  background: var(--bg);
}

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

.auth-card {
  width: 100%;
  max-width: 440px;
  padding: 48px 40px 36px;
  background: var(--panel);
  border: 1px solid #e8eaed;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-align: center;
}

.auth-logo {
  display: inline-flex;
  align-items: center;
  gap: 1px;
  margin-bottom: 28px;
  font-size: 28px;
  font-weight: 500;
  line-height: 1;
}

.auth-card h1 {
  margin: 0 0 8px;
  font-size: 24px;
  font-weight: 500;
  line-height: 1.3;
}

.auth-card .subtitle {
  color: var(--text-secondary);
  font-size: 14px;
  margin: 0 0 32px;
}

.auth-error {
  background: #fce8e6;
  color: var(--danger);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  margin-bottom: 20px;
  text-align: left;
}

.auth-error[hidden] {
  display: none;
}

.auth-submit {
  width: 100%;
  margin-top: 4px;
  min-height: 44px;
}

.auth-footer {
  margin: 24px 0 0;
  font-size: 14px;
  color: var(--text-secondary);
}

.auth-footer a {
  color: var(--accent);
  font-weight: 500;
}

/* ---- Home hero ---- */

.home-hero {
  max-width: 1040px;
  margin: 64px auto 0;
  padding: 32px 32px 12px;
  text-align: center;
}

.home-hero h1 {
  margin: 0 0 16px;
  font-size: clamp(34px, 6vw, 56px);
  font-weight: 500;
  letter-spacing: 0;
  line-height: 1.12;
  color: var(--text);
}

.home-hero p {
  max-width: 640px;
  margin: 0 auto;
  padding: 16px 28px;
  border: 1px solid #e8eaed;
  border-radius: 999px;
  background: var(--panel);
  box-shadow: 0 1px 6px rgba(32,33,36,0.12);
  color: var(--text-secondary);
  font-size: 16px;
  transition: box-shadow var(--transition), border-color var(--transition);
}

.home-hero p:hover {
  border-color: transparent;
  box-shadow: 0 2px 8px rgba(32,33,36,0.16), 0 1px 2px rgba(32,33,36,0.08);
}

/* ---- Tool cards grid ---- */

.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 22px;
  max-width: 1040px;
  margin: 40px auto;
  padding: 0 24px;
}

.tool-card {
  display: flex;
  flex-direction: column;
  min-height: 180px;
  padding: 24px;
  border: 1px solid #e8eaed;
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--text);
  text-decoration: none;
  box-shadow: var(--shadow);
  transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
}

.tool-card:hover {
  border-color: rgba(26,115,232,0.35);
  box-shadow: var(--shadow-hover);
  transform: translateY(-4px);
}

.tool-card .icon {
  width: 56px;
  height: 56px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  border-radius: 50%;
  background: #e8f0fe;
  font-size: 30px;
  line-height: 1;
}

.tool-card:nth-child(4n+2) .icon { background: #fce8e6; }
.tool-card:nth-child(4n+3) .icon { background: #fef7e0; }
.tool-card:nth-child(4n+4) .icon { background: #e6f4ea; }

.tool-card .name {
  margin-bottom: 8px;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

.tool-card .desc {
  flex: 1;
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.6;
}

/* ---- Status badge ---- */

.status-badge {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  margin-top: 16px;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.2px;
}

.status-badge.available {
  color: var(--success);
  background: var(--success-light);
}

.status-badge.coming_soon {
  color: var(--text-secondary);
  background: #f1f3f4;
}

/* ---- Coming soon card ---- */

.coming-soon {
  max-width: 640px;
  margin: 48px auto;
  padding: 32px;
  border: 1px solid rgba(0,0,0,0.05);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
  text-align: center;
}

.coming-soon h1 {
  margin: 0 0 12px;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.3px;
  color: var(--text);
}

.coming-soon p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 15px;
}

/* ---- Responsive ---- */

@media (max-width: 900px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 12px 0;
  }

  .sidebar-title {
    margin-left: 16px;
    margin-right: 16px;
  }

  .tool-nav-item {
    padding: 8px 16px;
    border-radius: 0 999px 999px 0;
  }

  .home-hero {
    margin-top: 32px;
    padding: 24px 16px 8px;
  }

  .home-hero h1 {
    font-size: 28px;
  }

  .tool-grid {
    margin-top: 24px;
    padding: 0 16px;
  }

  .content {
    padding: 16px;
  }

  .auth-page {
    align-items: flex-start;
    padding: 24px 16px;
  }

  .auth-card {
    padding: 36px 24px 28px;
  }
}
