:root {
  --bg: #1e1f22;
  --sidebar-bg: #2b2d31;
  --panel-bg: #313338;
  --text: #dbdee1;
  --muted: #949ba4;
  --accent: #5865f2;
  --accent-hover: #4752c4;
  --border: #404249;
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen,
    Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
  background: var(--bg);
  color: var(--text);
}

.app {
  display: flex;
  height: 100%;
}

.app.hidden {
  display: none;
}

.login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100%;
  padding: 20px;
  background: var(--bg);
}

.login-screen.hidden {
  display: none;
}

.login-box {
  width: 100%;
  max-width: 360px;
  padding: 28px;
  background: var(--sidebar-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-align: center;
}

.login-box h1 {
  margin: 0 0 8px;
  font-size: 1.5rem;
}

.login-box p {
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 0.9375rem;
}

.login-input {
  width: 100%;
  padding: 12px;
  margin-bottom: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel-bg);
  color: var(--text);
  font-size: 1rem;
  outline: none;
}

.login-input:focus {
  border-color: var(--accent);
}

.login-button {
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  font-size: 1rem;
  cursor: pointer;
}

.login-button:hover {
  background: var(--accent-hover);
}

.login-error {
  margin: 12px 0 0;
  color: #fa777c;
  font-size: 0.875rem;
}

.login-error.hidden {
  display: none;
}

.sidebar {
  width: 320px;
  min-width: 260px;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}

.sidebar-header {
  padding: 20px;
  border-bottom: 1px solid var(--border);
}

.sidebar-header h1 {
  margin: 0 0 6px;
  font-size: 1.25rem;
}

.sidebar-header p {
  margin: 0;
  color: var(--muted);
  font-size: 0.875rem;
}

.search {
  margin: 16px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel-bg);
  color: var(--text);
  font-size: 0.9375rem;
  outline: none;
}

.search:focus {
  border-color: var(--accent);
}

.log-list {
  flex: 1;
  overflow-y: auto;
  padding: 0 12px 12px;
}

.status {
  color: var(--muted);
  font-size: 0.875rem;
  padding: 12px;
}

.status.error {
  color: #fa777c;
}

.log-item {
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  border-radius: var(--radius);
  color: var(--text);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px;
  transition: background 0.15s ease;
}

.log-item:hover {
  background: rgba(88, 101, 242, 0.1);
}

.log-item.active {
  background: var(--accent);
}

.log-title {
  font-size: 0.9375rem;
  line-height: 1.3;
  word-break: break-word;
}

.log-id {
  font-size: 0.75rem;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.log-item.active .log-id {
  color: rgba(255, 255, 255, 0.75);
}

.viewer {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  min-width: 0;
}

.viewer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--panel-bg);
}

.viewer-header h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.open-link {
  color: var(--text);
  text-decoration: none;
  font-size: 0.8125rem;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  white-space: nowrap;
}

.open-link:hover {
  background: var(--accent);
  border-color: var(--accent);
}

.open-link.hidden {
  display: none;
}

.log-frame {
  flex: 1;
  width: 100%;
  border: none;
  background: #fff;
}

.log-frame.hidden {
  display: none;
}

.empty-state {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
}

.empty-state.hidden {
  display: none;
}

@media (max-width: 700px) {
  .sidebar {
    width: 100%;
    position: absolute;
    inset: 0;
    z-index: 10;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
  }

  .sidebar.open {
    transform: translateX(0);
  }
}
