:root {
  --color-text: #333;
  --color-bg: #f4f4f4;
  --color-white: #fff;

  --color-primary: #1976d2;
  --color-primary-hover: #135ba1;
  --color-primary-disabled: #777777;

  --color-readonly: #e0e0e0;

  --color-success: #4caf50;
  --color-success-hover: #388e3c;

  --color-error: #f44336;

  --border-radius: 6px;
  --box-shadow: 0 0 10px rgba(0, 0, 0, 0.05);
}

/* === Base layout === */
body {
  font-family: system-ui, sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  margin: 0;
  padding: 0;
  transition: background 0.3s, color 0.3s;
}

h2 {
  margin-top: 0;
  text-align: center;
}

label {
  display: block;
  margin-top: 15px;
  font-weight: bold;
}

input[type="text"],
input[type="password"],
input[type="email"] {
  width: 100%;
  padding: 8px 10px;
  margin-top: 5px;
  border: 1px solid #ccc;
  border-radius: 4px;
  box-sizing: border-box;
  background: var(--color-white);
  color: #000;
}

input[readonly] {
    background-color: var(--color-readonly);
}

.container {
  max-width: 640px;
  margin: 40px auto;
  background: var(--color-white);
  border: 1px solid #ddd;
  border-radius: var(--border-radius);
  padding: 20px 30px;
  box-shadow: var(--box-shadow);
}

/* === Password field === */
.password-wrapper {
  display: flex;
  align-items: center;
  gap: 5px;
}

.password-wrapper input {
  flex: 1;
}

.password-wrapper button {
  padding: 8px;
  border: none;
  background: #eee;
  cursor: pointer;
  border-radius: 4px;
}

/* === Buttons === */
.button-row {
  margin-top: 20px;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.button-row.center {
  justify-content: center;
  align-items: center;
  text-align: center;
}

.btn {
  flex-grow: 1;
  padding: 10px 20px;
  border: none;
  color: white;
  font-weight: bold;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.btn:disabled,
.btn[disabled]{
  background: var(--color-primary-disabled);
}

.btn-primary {
  background: var(--color-primary);
}

.btn-primary:hover {
  background: var(--color-primary-hover);
}

.btn-success {
  background: var(--color-success);
}

.btn-success:hover {
  background: var(--color-success-hover);
}

/* === Progress bar === */
.progress-bar {
  display: flex;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.progress-bar div {
  flex: 1;
  padding: 10px;
  text-align: center;
  background: #eee;
  cursor: pointer;
  border-right: 1px solid #ccc;
  font-weight: bold;
  min-width: 100px;
}

.progress-bar div:last-child {
  border-right: none;
}

.progress-bar div.active {
  background: var(--color-primary);
  color: white;
}

.progress-bar div.verified {
  background: var(--color-success);
  color: white;
}

.progress-bar div.error,
.progress-bar div.cancelled {
  background: var(--color-error);
  color: white;
}

/* === Install progress list === */
.install-progress {
  list-style: none;
  padding: 0;
  margin-top: 20px;
  font-size: 0.95em;
}

.install-progress li {
  padding: 8px 10px;
  border-left: 5px solid #ccc;
  background: #f9f9f9;
  margin-bottom: 6px;
  cursor: pointer;
  transition: background 0.3s ease;
  border-radius: 4px;
  white-space: pre-wrap;
  word-break: break-word;
}

.install-progress li.done,
.install-progress li.ok {
  border-color: var(--color-success);
}

.install-progress li.error,
.install-progress li.cancelled {
  border-color: var(--color-error);
}

.install-progress li:hover {
  background: #e9e9e9;
}

.install-progress li.expanded {
  background: #e3f2fd;
}

/* === Status === */
.status-text {
  font-weight: bold;
  min-height: 1.5em;
  display: inline-block;
  min-width: 100px;
  vertical-align: middle;
  line-height: 1.5em;
  text-align: left;
  transition: color 0.2s ease;
}

.status-text.error,
.status-text.cancelled {
  color: var(--color-error);
}

.version-info {
  margin-top: 20px;
  font-size: 0.85em;
  color: #666;
  text-align: center;
  opacity: 0.7;
  user-select: none;
}

.version-info a {
  color: #666;
  text-decoration: underline;
  transition: color 0.2s ease;
}

.version-info a:hover {
  color: var(--color-primary-hover);
}

/* === Hidden === */
.hidden {
  display: none !important;
}

/* === Mobile === */
@media screen and (max-width: 600px) {
  .container {
    margin: 20px 10px;
    padding: 15px;
  }

  .progress-bar div {
    flex: 1 1 100%;
    border-bottom: 1px solid #ccc;
    border-right: none;
  }

  .button-row {
    flex-direction: column;
  }

  .btn {
    width: 100%;
  }

  .status-text {
    width: 100%;
    text-align: center;
  }
}

/* === Dark mode === */
@media (prefers-color-scheme: dark) {
  :root {
    --color-bg: #121212;
    --color-text: #ddd;
    --color-white: #1e1e1e;
  }

  body {
    background: var(--color-bg);
    color: var(--color-text);
  }

  input[type="text"],
  input[type="password"],
  input[type="email"] {
    background: #2c2c2c;
    color: #fff;
    border-color: #444;
  }

  .container {
    background: var(--color-white);
    border-color: #333;
    box-shadow: none;
  }

  .progress-bar div {
    background: #2c2c2c;
    color: #ccc;
    border-color: #444;
  }

  .progress-bar div.active {
    background: #2196f3;
    color: #fff;
  }

  .progress-bar div.verified {
    background: var(--color-success);
    color: white;
  }

  .progress-bar div.error,
  .progress-bar div.cancelled {
    background: var(--color-error);
    color: white;
  }

  .install-progress li {
    background: #2a2a2a;
  }

  .install-progress li:hover {
    background: #333;
  }

  .password-wrapper button {
    background: #3a3a3a;
    color: #ccc;
  }

  .status-text.error,
  .status-text.cancelled {
    color: var(--color-error);
  }
}