:root {
  --ink: #0f1111;
  --ink-soft: #565959;
  --ink-mute: #767676;
  --line: #d5d9d9;
  --line-soft: #e7e7e7;
  --bg: #ffffff;
  --bg-soft: #f7f7f7;
  --accent: #ffd814;
  --accent-hover: #f7ca00;
  --accent-active: #f0b800;
  --link: #007185;
  --link-hover: #c7511f;
  --danger: #b12704;
  --radius: 8px;
  --shadow-card: 0 0 0 1px var(--line);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--link); text-decoration: none; }
a:hover { color: var(--link-hover); text-decoration: underline; }

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

/* ---------- AUTH PAGE ---------- */

body.auth {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.auth-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 16px 48px;
}

.brand {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
  padding: 12px 16px;
  border-radius: 4px;
  margin-bottom: 8px;
}
.brand:hover { color: var(--ink); text-decoration: none; }

.card {
  width: 100%;
  max-width: 348px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 26px 22px;
  margin-top: 4px;
}

.card h1 {
  font-size: 28px;
  font-weight: 400;
  margin: 0 0 14px;
  letter-spacing: -0.01em;
}

.field {
  display: block;
  margin-bottom: 12px;
}
.field span {
  display: block;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 4px;
}
.field input {
  width: 100%;
  padding: 6px 7px;
  font-size: 14px;
  border: 1px solid #888c8c;
  border-top-color: #565959;
  border-radius: 3px;
  background: linear-gradient(to bottom, #f7f8fa, #fff);
  color: var(--ink);
  outline: none;
  transition: border-color .12s, box-shadow .12s;
}
.field input:focus {
  border-color: #e77600;
  box-shadow: 0 0 3px 2px rgba(228,121,17,.5);
}

.error {
  color: var(--danger);
  font-size: 12px;
  margin: -4px 0 10px;
}

.btn-primary {
  display: block;
  width: 100%;
  padding: 8px 10px;
  margin-top: 4px;
  font-size: 13px;
  font-weight: 400;
  color: var(--ink);
  background: var(--accent);
  border: 1px solid #fcd200;
  border-radius: 100px;
  box-shadow: 0 1px 0 rgba(255,255,255,0.4) inset;
  transition: background .12s;
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:active { background: var(--accent-active); }
.btn-primary:disabled { opacity: .6; cursor: not-allowed; }

.legal {
  color: var(--ink-mute);
  font-size: 12px;
  margin-top: 24px;
}

/* ---------- APP PAGE ---------- */

body.app {
  background: var(--bg);
}

.topbar {
  border-bottom: 1px solid var(--line-soft);
  background: var(--bg);
}
.topbar-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 24px;
}

.user-menu { position: relative; }
.user-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: 1px solid transparent;
  padding: 6px 10px;
  border-radius: 4px;
  color: var(--ink);
  font-size: 13px;
}
.user-btn:hover { border-color: var(--ink); }
.caret { font-size: 10px; color: var(--ink-soft); }

.dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  min-width: 160px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: 0 6px 16px rgba(0,0,0,0.08);
  padding: 4px;
  z-index: 10;
}
.dropdown-item {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  padding: 8px 12px;
  border-radius: 4px;
  font-size: 13px;
  color: var(--ink);
}
.dropdown-item:hover { background: var(--bg-soft); }

.app-wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 28px 24px 48px;
}
.page-title {
  font-size: 22px;
  font-weight: 400;
  margin: 0 0 18px;
  letter-spacing: -0.01em;
}

.tools-list {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
  overflow: hidden;
}

.tool-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line-soft);
}
.tool-row:last-child { border-bottom: 0; }

.tool-icon {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border-radius: 6px;
  background: var(--bg-soft);
  border: 1px solid var(--line-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: var(--ink-soft);
}
.tool-body { flex: 1; min-width: 0; }
.tool-name {
  font-size: 15px;
  font-weight: 700;
  margin: 0 0 2px;
  color: var(--ink);
}
.tool-desc {
  font-size: 13px;
  color: var(--ink-soft);
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tool-action {
  display: inline-block;
  padding: 6px 14px;
  font-size: 13px;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 100px;
  text-decoration: none;
  transition: background .12s, border-color .12s;
  white-space: nowrap;
}
.tool-action:hover {
  background: var(--bg-soft);
  border-color: var(--ink);
  color: var(--ink);
  text-decoration: none;
}

.empty, .loading {
  padding: 40px 20px;
  text-align: center;
  color: var(--ink-mute);
  font-size: 14px;
  margin: 0;
}

/* ---------- responsive ---------- */
@media (max-width: 540px) {
  .card { padding: 18px 18px 20px; }
  .topbar-inner, .app-wrap { padding-left: 16px; padding-right: 16px; }
  .tool-row { padding: 14px 14px; gap: 12px; }
  .tool-action { padding: 5px 10px; font-size: 12px; }
}
