:root {
  --text: #1a1a1a;
  --muted: #6b6b6b;
  --border: #e3e3e3;
  --accent: #3b5bdb;
  --error: #c92a2a;
  --background: #fff;
  --radius: 6px;

  font-family:
    system-ui,
    -apple-system,
    'Segoe UI',
    sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--background);
}

* {
  box-sizing: border-box;
}

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

button {
  font: inherit;
  padding: 8px 14px;
  border: 0;
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  cursor: pointer;
}

button:disabled {
  opacity: 0.5;
  cursor: default;
}

button.secondary {
  background: none;
  border: 1px solid var(--border);
  color: var(--text);
}

button.link {
  background: none;
  color: var(--accent);
  padding: 4px 0;
}

.message {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  margin: 0;
  padding: 16px;
  color: var(--muted);
  text-align: center;
}

.error {
  color: var(--error);
}

/* Dashboard zone */

.zone {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.zone-header {
  display: flex;
  gap: 8px;
  align-items: baseline;
  padding: 12px 12px 0;
  white-space: nowrap;
  color: var(--muted);
  font-size: 12px;
}

.zone-header strong {
  color: var(--text);
}

.zone-header span {
  overflow: hidden;
  text-overflow: ellipsis;
}

.zone .gallery,
.zone .message {
  flex: 1;
  min-height: 0;
  height: auto;
}

/* Fixed tile size whatever the count: one image is one tile at the top, not a stretched hero. */
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  align-content: start;
  gap: 8px;
  height: 100%;
  padding: 12px;
  overflow: auto;
}

.gallery a {
  display: block;
}

/* Equal tiles cropped to centre, as in Playbook's own grid. */
.gallery img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 4px;
}

/* Configure dialog */

.dialog {
  display: flex;
  flex-direction: column;
  gap: 12px;
  height: 100%;
  padding: 20px;
}

.dialog header,
.dialog footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.dialog footer {
  justify-content: flex-end;
}

.dialog h1 {
  margin: 0;
  font-size: 18px;
}

.dialog label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: var(--muted);
}

.dialog select,
.dialog input {
  font: inherit;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.modes {
  display: flex;
  gap: 16px;
  margin: 0;
  padding: 0;
  border: 0;
}

.dialog .modes label {
  flex-direction: row;
  align-items: center;
  gap: 6px;
  color: var(--text);
}

.tabs {
  display: flex;
  gap: 4px;
}

.tab {
  background: none;
  color: var(--muted);
  font-size: 16px;
  font-weight: 600;
  padding: 4px 8px;
}

.tab.active {
  color: var(--text);
  box-shadow: inset 0 -2px 0 var(--accent);
  border-radius: 0;
}

.dialog h2 {
  margin: 8px 0 0;
  font-size: 15px;
}

.hint {
  margin: 0;
  color: var(--muted);
}

.connect,
.save {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  overflow: auto;
}

.syncs {
  margin: 0;
  padding: 0;
  list-style: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.syncs li {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
}

.syncs li + li {
  border-top: 1px solid var(--border);
}

.syncs .actions {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: 12px;
}

.syncs a {
  color: var(--accent);
  text-decoration: none;
}

.steps {
  margin: 0;
  padding-left: 20px;
}

button.wide {
  width: 100%;
}

.warning {
  margin: 0;
  padding: 8px 10px;
  border-radius: var(--radius);
  background: #fff8e6;
  color: #7a5200;
}

.site {
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.manage {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-wrap: anywhere;
}

.boards {
  flex-shrink: 0;
  max-height: 140px;
  margin: 0;
  padding: 0;
  overflow: auto;
  list-style: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.board {
  display: block;
  width: 100%;
  background: none;
  color: var(--text);
  text-align: left;
  border-radius: 0;
}

.board.active {
  background: #eef1fd;
}

.assets {
  display: grid;
  flex: 1;
  min-height: 0;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  grid-auto-rows: 110px;
  gap: 8px;
  align-content: start;
  overflow: auto;
}

.asset {
  position: relative;
  padding: 0;
  background: #f4f4f4;
  overflow: hidden;
}

.asset.selected {
  outline: 3px solid var(--accent);
  outline-offset: -3px;
}

.asset.selected::after {
  content: '✓';
  position: absolute;
  top: 6px;
  right: 6px;
  width: 22px;
  height: 22px;
  line-height: 22px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 13px;
}

.asset img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
