@import url("./app-titlebar.css");

*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  --brand-blue: #6da3d4;
  --brand-blue-dark: #5892c4;
  --brand-color: #404040;
  --brand-color-dark: #2d2d2d;
  --brand-color-deep: #1a1a1a;
  --brand-focus: #cbd5e1;
  --brand-highlight: rgba(175, 171, 171, 0.45);
  --brand-highlight-strong: rgba(175, 171, 171, 0.62);
  --brand-highlight-soft: rgba(231, 230, 230, 0.85);
}

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, sans-serif;
  background: var(--app-page-bg);
  color: #0f172a;
  line-height: 1.5;
}

a {
  color: var(--brand-color-dark);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: var(--app-page-bg);
}

.card {
  width: 100%;
  max-width: 420px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 2rem;
  box-shadow: 0 1px 3px rgb(15 23 42 / 8%);
}

.card-wide {
  max-width: none;
}

.brand {
  text-align: center;
  margin-bottom: 1.5rem;
}

.brand-logo {
  display: block;
  margin: 0 auto 0.75rem;
  object-fit: contain;
}

.brand h1 {
  margin: 0;
  color: var(--brand-color-deep);
  font-size: 1.75rem;
}

.brand p {
  margin: 0.5rem 0 0;
  color: #64748b;
  font-size: 0.9rem;
}

label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: #334155;
}

input,
textarea {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font: inherit;
  margin-bottom: 1rem;
}

input:focus,
textarea:focus {
  outline: 2px solid var(--brand-focus);
  border-color: var(--brand-color);
}

button,
.btn {
  display: inline-block;
  border: none;
  border-radius: 8px;
  padding: 0.65rem 1rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  background: var(--brand-color);
  color: #fff;
}

button:hover,
.btn:hover {
  background: var(--brand-color-dark);
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

button.secondary {
  background: #fff;
  color: #334155;
  border: 1px solid #cbd5e1;
}

button.secondary:hover {
  background: #f8fafc;
}

button.danger-link {
  background: none;
  color: #dc2626;
  padding: 0;
  font-weight: 500;
}

.error {
  background: #fef2f2;
  color: #b91c1c;
  padding: 0.65rem 0.75rem;
  border-radius: 8px;
  font-size: 0.875rem;
  margin-bottom: 1rem;
}

.success {
  background: #ecfdf5;
  color: #047857;
  padding: 0.65rem 0.75rem;
  border-radius: 8px;
  font-size: 0.875rem;
  margin-bottom: 1rem;
}

.center-note {
  text-align: center;
  margin-top: 1.25rem;
  color: #64748b;
  font-size: 0.875rem;
}

.top-bar {
  height: 28px;
  min-height: 28px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  font-size: 10px;
  line-height: 1;
  user-select: none;
}

.top-bar-brand {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-weight: 700;
  letter-spacing: 0.3px;
  text-decoration: none;
  padding: 4px 3px;
  border-radius: 6px;
}

.top-bar-logo {
  display: block;
  flex-shrink: 0;
  object-fit: contain;
}

.top-bar-brand-text {
  line-height: 1;
}

.top-bar-sep {
  color: var(--app-titlebar-border);
  font-size: 11px;
}

.top-bar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 2px;
  min-width: 0;
  max-width: 60%;
}

.top-bar-user {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
  padding: 4px 8px;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 500;
}

.top-bar-logout {
  margin-left: 0;
  flex-shrink: 0;
  border: none;
  padding: 4px 12px;
  border-radius: 6px;
  font: inherit;
  font-size: 10px;
  font-weight: 500;
  cursor: pointer;
}

.profile-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.profile-header h2 {
  margin: 0;
}

.profile-info {
  margin: 0;
}

.profile-row {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 0.75rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid #f1f5f9;
}

.profile-row:last-child {
  border-bottom: none;
}

.profile-row dt {
  margin: 0;
  font-size: 0.875rem;
  font-weight: 600;
  color: #64748b;
}

.profile-row dd {
  margin: 0;
  font-size: 0.9375rem;
  color: #0f172a;
}

.plan-badge {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  color: #475569;
}

.panel-compact {
  padding: 0.75rem 1rem;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.btn-compact {
  padding: 0.35rem 0.75rem;
  font-size: 0.8125rem;
  line-height: 1.2;
}

.tabs {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid #e2e8f0;
}

.tab {
  border: none;
  background: none;
  color: #64748b;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0.5rem 0.75rem;
  margin-bottom: -1px;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  border-radius: 0;
}

.tab:hover {
  color: var(--brand-color-dark);
  background: var(--brand-highlight-soft);
}

.tab.active {
  color: var(--brand-color-dark);
  border-bottom-color: var(--brand-color);
  background: transparent;
}

.tab.active:hover {
  background: transparent;
}

.tab-panel {
  display: block;
}

.tab-panel[hidden] {
  display: none;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 1000;
}

.modal-overlay[hidden] {
  display: none;
}

.modal-card {
  width: 100%;
  max-width: 420px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 1.25rem;
  box-shadow: 0 8px 24px rgb(15 23 42 / 12%);
}

.modal-card h2 {
  margin: 0 0 1rem;
  font-size: 1rem;
}

.modal-message {
  margin: 0 0 1.25rem;
  font-size: 0.9375rem;
  color: #334155;
  line-height: 1.5;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 0.25rem;
}

.modal-card input {
  margin-bottom: 0.75rem;
}

#project-modal input::placeholder {
  color: #94a3b8;
}

#project-modal input:hover::placeholder,
#project-modal input:focus::placeholder {
  opacity: 0;
}

.panel {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}

.panel h2 {
  margin: 0 0 1rem;
  font-size: 1rem;
}

.status-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

.badge {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge.ok {
  background: #dcfce7;
  color: #166534;
}

.badge.warn {
  background: #fef3c7;
  color: #92400e;
}

.badge.err {
  background: #fee2e2;
  color: #991b1b;
}

.progress {
  height: 8px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
  margin-top: 0.5rem;
}

.progress > span {
  display: block;
  height: 100%;
  background: var(--brand-color);
}

.grid-2 {
  display: grid;
  gap: 1rem;
}

@media (min-width: 640px) {
  .grid-2 {
    grid-template-columns: 1fr 1fr;
  }
}

.project-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.5rem;
}

.project-list li {
  position: relative;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
  padding-right: 4.5rem;
}

.project-delete {
  position: absolute;
  top: 0.4rem;
  right: 0.5rem;
  border: none;
  padding: 4px 10px;
  border-radius: 8px;
  font: inherit;
  font-size: 11px;
  font-weight: 500;
  color: #64748b;
  cursor: pointer;
  background: transparent;
}

.project-delete:hover {
  color: var(--brand-color-dark);
  background: var(--brand-highlight);
}

.project-delete:active {
  color: var(--brand-color-dark);
  background: var(--brand-highlight-strong);
}

.project-list h3 {
  margin: 0 0 0.15rem;
  font-size: 0.9375rem;
}

.project-list h3.project-open-title {
  cursor: pointer;
  user-select: none;
}

.project-list h3.project-open-title:hover {
  color: var(--brand-color-dark);
}

.project-list-head {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  min-width: 0;
}

.module-list-item .project-list-copy {
  flex: 1;
  min-width: 0;
}

.project-list-icon {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  margin-top: 1px;
  border-radius: 8px;
  background: var(--app-page-bg);
  border: 1px solid #e2e8f0;
}

.project-list-icon .tree-module-icon {
  width: 18px;
  height: 18px;
  display: block;
}

.project-list p {
  margin: 0;
  color: #475569;
  font-size: 0.8125rem;
  line-height: 1.3;
}

.project-list .meta {
  margin-top: 0.35rem;
  font-size: 0.6875rem;
  color: #94a3b8;
}

.project-list .item-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.35rem;
  flex-wrap: wrap;
  align-items: center;
}

.empty-compact {
  padding: 1rem;
}

.empty {
  text-align: center;
  color: #64748b;
  padding: 2rem;
  border: 1px dashed #cbd5e1;
  border-radius: 12px;
  background: #fff;
}

.modal-card-wide {
  max-width: 520px;
}

.module-type-label {
  margin: 0 0 1rem;
  font-size: 0.875rem;
  color: #64748b;
}

.module-picker-list {
  display: grid;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.module-picker-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.75rem 0.85rem;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: inherit;
}

.module-picker-item:hover {
  border-color: #cbd5e1;
  background: #f8fafc;
}

.module-picker-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}

.module-picker-icon .tree-module-icon {
  width: 20px;
  height: 20px;
}

.module-picker-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: #1a1a1a;
}

.hint { {
  font-size: 0.85rem;
  color: #64748b;
  margin-top: -0.5rem;
  margin-bottom: 1rem;
}

code {
  background: #f1f5f9;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  font-size: 0.85em;
}
