/* Base layout and shared components */

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  font-family: "Segoe UI", Arial, Helvetica, sans-serif;
  background: #ebebeb;
  color: black;
  margin: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Form controls do not inherit the page font: without this every button falls
   back to the browser default instead of the interface family. */
button,
input[type="button"],
input[type="submit"] {
  font-family: inherit;
}

.wrap {
  max-width: 1200px;
  margin: 40px auto;
  background: whitesmoke;
  border: 1px solid lightgray;
  border-radius: 16px;
  padding: 24px;
  box-shadow:
    0 2px 4px rgba(0, 0, 0, 0.05),
    0 16px 40px rgba(0, 0, 0, 0.08);
}

.wrap.auth-wrap {
  max-width: 480px;
  margin: 60px auto;
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
}

h1 {
  margin: 0 0 6px 0;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.muted {
  color: dimgray;
  font-size: 14px;
  margin-bottom: 16px;
}

label {
  font-weight: 600;
  font-size: 13px;
  color: darkslategray;
  margin: 10px 0 6px 0;
  display: block;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.input-inline {
  display: flex;
  align-items: center;
  gap: 8px;
}

.input-inline .ka-input {
  flex: 1;
}

.color-input {
  width: 44px;
  height: 44px;
  padding: 4px;
  border-radius: 10px;
  border: 1px solid gainsboro;
  background: white;
  cursor: pointer;
}

input[type="text"],
input[type="password"],
input[type="url"],
input[type="email"],
input[type="number"],
input[type="date"],
input[type="file"],
select,
textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid gainsboro;
  background: white;
  color: black;
  outline: none;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    background 0.15s ease;
}

select.ka-input {
  height: 37.5px;
}

.smooth-input {
  background: #f8fafc;
  border-color: #dbe1ea;
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.06);
}

.smooth-input:focus {
  background: #ffffff;
}

input::placeholder,
textarea::placeholder {
  color: gray;
}

textarea {
  min-height: 100px;
  line-height: 1.5;
  resize: vertical;
  white-space: pre-wrap;
}

input:focus,
select:focus,
textarea:focus {
  border-color: steelblue;
  box-shadow: 0 0 0 4px rgba(70, 130, 180, 0.25);
}

.card {
  background: white;
  border: 1px solid lightgray;
  border-radius: 12px;
  padding: 16px;
  margin: 12px 0;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.actions.right {
  justify-content: flex-end;
}

.actions.start {
  justify-content: flex-start;
}

.btn {
  appearance: none;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid lightgray;
  background: aliceblue;
  color: black;
  font-weight: 600;
  font-size: 14px;
  line-height: 1.3;
  cursor: pointer;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    transform 0.02s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn:hover {
  background: lightsteelblue;
  border-color: lightslategray;
}

.btn:active {
  transform: translateY(1px);
}

.btn.primary {
  background: midnightblue;
  color: white;
  border-color: midnightblue;
}

.btn.primary:hover {
  background: navy;
}

.btn.small {
  padding: 8px 12px;
  font-size: 13px;
}

.btn.icon-only {
  padding: 8px;
  width: 44px;
  height: 44px;
  justify-content: center;
  border-radius: 50%;
}

.btn.icon-only img {
  width: 22px;
  height: 22px;
  display: block;
}

.spinner {
  display: none;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: darkslategray;
}

.spinner::before {
  content: "";
  width: 14px;
  height: 14px;
  border: 2px solid lightsteelblue;
  border-top-color: midnightblue;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.msg {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid gainsboro;
  background: lavender;
  color: dimgrey;
  margin: 8px 0;
}

.auth-card {
  position: relative;
  padding: 24px;
  text-align: left;
}

.auth-note {
  font-size: 12px;
  margin-top: 6px;
}

.auth-card .field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.auth-card .msg {
  margin-top: 0;
}

.auth-card form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.headerbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.list {
  background: white;
  border: 1px solid lightgray;
  border-radius: 12px;
  padding: 8px;
}

.rowi {
  display: grid;
  grid-template-columns: 180px 1fr 200px;
  gap: 8px;
  align-items: center;
  padding: 10px;
  border-bottom: 1px solid lightgray;
}

.rowi:last-child {
  border-bottom: none;
}

.rowi .id {
  font-family: "Courier New", Courier, monospace;
  font-size: 12px;
  color: dimgray;
}

.rowi a {
  text-decoration: none;
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.preview {
  background: whitesmoke;
  border: 1px solid lightgray;
  border-radius: 12px;
  padding: 12px;
  margin-top: 10px;
  display: none;
}
