/* Viides.ai–inspired: deep space blue, crisp cyan accent, calm typography */
:root {
  --bg: #070d14;
  --bg-elev: #0f1729;
  --bg-card: #121c30;
  --border: #db0eb7;
  --text: #e8eef7;
  --muted: #94a3b8;
  --accent: #22d3ee;
  --accent-soft: rgba(34, 211, 238, 0.14);
  --accent-2: #818cf8;
  --danger: #f87171;
  --ok: #4ade80;
  --radius: 0;
  --font: "Outfit", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 16px;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  background: radial-gradient(1200px 600px at 10% -10%, rgba(34, 211, 238, 0.08), transparent),
    radial-gradient(900px 500px at 100% 0%, rgba(129, 140, 248, 0.1), transparent), var(--bg);
  color: var(--text);
  line-height: 1.55;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.shell {
  max-width: 100%;
  width: 100%;
  margin: 0 auto;
  padding: 1.25rem 1.25rem 2.5rem;
}

.brand-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 1rem;
}

.brand-viides {
  font-weight: 800;
  letter-spacing: 0.04em;
  font-size: 0.95rem;
  color: var(--text);
  text-decoration: none;
  padding: 0.35rem 0.65rem;
  border-radius: var(--radius);
  background: linear-gradient(120deg, var(--accent-soft), rgba(129, 140, 248, 0.12));
  border: 1px solid var(--border);
}

.brand-viides:hover {
  border-color: #f472d8;
  text-decoration: none;
}

.brand-sep {
  width: 1px;
  height: 1.1rem;
  background: var(--border);
}

.brand-sub {
  color: var(--muted);
  font-size: 0.9rem;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  padding: 0.35rem 0.5rem;
  background: var(--bg-elev);
  border: none;
  border-radius: var(--radius);
}

.nav-primary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  flex: 1;
  min-width: 200px;
}

.nav-user {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-left: auto;
}

.nav-user-name {
  font-size: 0.88rem;
}

a.nav-logout:hover {
  text-decoration: none;
}

.nav-link {
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius);
  color: var(--muted);
  font-weight: 500;
  font-size: 0.92rem;
}

.nav-link:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
  text-decoration: none;
}

.nav-link.is-active {
  color: var(--bg);
  background: linear-gradient(135deg, var(--accent), #67e8f9);
}

.main {
  min-height: 40vh;
}

h1 {
  font-size: 1.65rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 0.5rem;
}

h2 {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0 0 0.75rem;
}

.muted {
  color: var(--muted);
  font-size: 0.95rem;
}

.card {
  background: var(--bg-card);
  border: none;
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  margin-bottom: 1rem;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.75rem;
}

.stat {
  text-align: left;
}

.stat-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.stat-val {
  font-size: 1.35rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  margin-top: 0.2rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.55rem 1rem;
  font-family: var(--font);
  font-weight: 600;
  font-size: 0.92rem;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  background: linear-gradient(135deg, var(--accent), #38bdf8);
  color: #042f2e;
  box-sizing: border-box;
  max-width: 100%;
}

.btn:hover {
  filter: brightness(1.05);
}

.btn-secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

.flash {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  border: 1px solid var(--border);
}

.flash-ok {
  border-color: var(--border);
  background: rgba(74, 222, 128, 0.08);
  color: #bbf7d0;
}

.flash-err {
  border-color: var(--border);
  background: rgba(248, 113, 113, 0.08);
  color: #fecaca;
}

table.data {
  width: 100%;
  max-width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  border: 1px solid var(--border);
}

table.data th,
table.data td {
  padding: 0.55rem 0.5rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

table.data th {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.sort-link {
  color: inherit;
  text-decoration: none;
}

.sort-link:hover {
  text-decoration: underline;
  color: var(--accent);
}

.sort-ind {
  color: var(--accent);
  font-size: 0.85em;
  white-space: nowrap;
}

table.data tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.mono {
  font-family: var(--mono);
  font-size: 0.86em;
}

.pager {
  margin-top: 1rem;
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.footer {
  margin-top: 2.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
  color: var(--muted);
}

.footer p {
  margin: 0.25rem 0;
}

.footer-muted {
  opacity: 0.75;
}

.upload-box {
  border: 1px dashed var(--border);
  background: var(--accent-soft);
  border-radius: var(--radius);
  padding: 1.25rem;
}

label.file-label input {
  margin-top: 0.5rem;
}

.input-text {
  width: 100%;
  max-width: 22rem;
  padding: 0.5rem 0.65rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-elev);
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
}

.input-text--sm {
  max-width: 11rem;
  width: auto;
  min-width: 0;
}

.btn-sm {
  padding: 0.35rem 0.65rem;
  font-size: 0.82rem;
}

.login-form label {
  display: block;
}

/* --- Asiakas-dashboard --- */
.shell.shell-wide {
  max-width: 100%;
}

.dash-header h1 {
  margin-bottom: 0.25rem;
}

.dash-meta {
  margin: 0 0 0.5rem;
  color: var(--muted);
}

.dash-kpis {
  margin-bottom: 1rem;
}

.dash-compare-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  margin-top: 0.75rem;
}

.dash-big {
  font-size: 1.35rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  margin-top: 0.25rem;
}

.dash-trend-up {
  color: var(--ok);
}

.dash-trend-down {
  color: var(--danger);
}

.dash-charts {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

@media (min-width: 900px) {
  .dash-charts {
    grid-template-columns: 1fr 1fr;
    align-items: stretch;
  }
}

.chart-box {
  position: relative;
  height: 240px;
  margin-top: 0.5rem;
}

.chart-box--tall {
  height: 320px;
}

.dash-pills {
  list-style: none;
  margin: 0.5rem 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.dash-pills li {
  padding: 0.35rem 0.65rem;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.9rem;
}

.dash-row-up td:last-child {
  color: var(--ok);
}

.dash-row-down td:last-child {
  color: var(--danger);
}

.dash-list {
  margin: 0.5rem 0 0;
  padding-left: 1.2rem;
}

.dash-list li {
  margin-bottom: 0.35rem;
}

.small {
  font-size: 0.85rem;
}

a.dash-cust-link {
  color: var(--text);
  font-weight: 600;
}

a.dash-cust-link:hover {
  color: var(--accent);
}

.opp-filters {
  margin-bottom: 1rem;
}

.opp-form {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.25rem;
  align-items: flex-end;
}

.opp-form-row {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 12rem;
  flex: 1 1 14rem;
}

.opp-form-row label {
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 500;
}

.opp-form-row--btn {
  flex: 0 0 auto;
  min-width: auto;
}

.opp-hint {
  margin-top: 1rem;
  margin-bottom: 0;
}

.opp-periods--side {
  margin-bottom: 1rem;
}

@media (min-width: 900px) {
  .opp-periods--side {
    width: 50%;
    max-width: 50%;
    margin-left: auto;
  }
}

.opp-panel-title {
  margin: 0 0 0.5rem;
  font-size: 1.05rem;
}

.opp-panel-lead {
  margin: 0 0 0.5rem;
  line-height: 1.45;
}

.opp-periods {
  margin-bottom: 0;
}

.opp-periods-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}

@media (min-width: 720px) {
  .opp-periods-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.opp-period-block {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.65rem 0.75rem;
  background: var(--bg-elev);
  border: 1px solid var(--border);
}

.opp-period-block--now {
  border-color: var(--accent);
}

.opp-period-label {
  font-size: 0.8rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.opp-period-dates {
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.35;
}

.opp-period-meta {
  line-height: 1.35;
}

.opp-period-notes {
  margin: 0.85rem 0 0;
  padding-left: 1.15rem;
}

.opp-period-notes li {
  margin-bottom: 0.35rem;
  line-height: 1.45;
}

/* th: flex ei aina toimi — block + margin varmistaa rivinvaihdon ilman CSS-flexiä */
table.data th .opp-th-wrap {
  display: block;
  text-transform: none;
  letter-spacing: normal;
  font-weight: 400;
  white-space: normal;
}

table.data th .opp-th-label {
  display: block;
  margin: 0 0 0.3rem;
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  line-height: 1.3;
}

table.data th .opp-th-dates {
  display: block;
  font-weight: 500;
  font-size: 0.8rem;
  color: var(--text);
  line-height: 1.35;
  white-space: nowrap;
  text-transform: none;
  letter-spacing: 0;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.chat-examples {
  margin-bottom: 1rem;
}

.chat-examples-title {
  margin: 0 0 0.25rem;
  font-size: 1.05rem;
}

.chat-examples-list {
  list-style: none;
  margin: 0.5rem 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.chat-examples-list li {
  margin: 0;
}

.chat-layout {
  display: flex;
  flex-direction: column;
  min-height: 28rem;
}

.chat-messages {
  flex: 1;
  min-height: 16rem;
  max-height: 50vh;
  overflow-y: auto;
  padding: 0.5rem 0;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.chat-bubble {
  margin-bottom: 0.85rem;
  max-width: 92%;
}

.chat-bubble--user {
  margin-left: auto;
}

.chat-bubble-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 0.2rem;
}

.chat-bubble--user .chat-bubble-label {
  text-align: right;
}

.chat-bubble-body {
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  line-height: 1.5;
  font-size: 0.95rem;
}

.chat-bubble-body a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}

.chat-bubble-body a:hover {
  text-decoration: underline;
}

.chat-bubble--user .chat-bubble-body {
  background: var(--accent-soft);
  border-color: var(--accent);
}

.chat-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: flex-end;
}

.chat-input {
  flex: 1 1 16rem;
  min-height: 3rem;
  resize: vertical;
}

.chat-disclaimer {
  margin: 0.75rem 0 0;
}

.chat-example {
  display: block;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  color: var(--accent);
  cursor: pointer;
  text-align: left;
  padding: 0.45rem 0.65rem;
  font: inherit;
  font-size: 0.85rem;
  line-height: 1.35;
  max-width: 100%;
}

.chat-example:hover {
  border-color: var(--accent);
  text-decoration: none;
}

/* --- Viides Tunnit (mobile) --- */
.shell {
  max-width: 32rem;
}

.shell--login {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 100dvh;
  padding-top: 10vh;
}

.shell .input-text,
.shell .input-textarea,
.shell select.input-text {
  max-width: 100%;
  width: 100%;
  min-height: 2.75rem;
  font-size: 1rem;
}

.input-textarea {
  min-height: 6rem;
  resize: vertical;
  padding: 0.65rem;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  color: var(--text);
  font-family: inherit;
  border-radius: var(--radius);
}

.form label {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 500;
  margin-bottom: 0.35rem;
}

.form {
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.form .field {
  margin-bottom: 1rem;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.form .field--submit {
  margin-bottom: 0;
}

.shell .form select.input-text {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  display: block;
  box-sizing: border-box;
}

.shell .form .btn-block {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  display: flex;
  box-sizing: border-box;
}

.btn-block {
  width: 100%;
  min-height: 2.75rem;
  font-size: 1rem;
}

.quick-hours {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.quick-hours .btn {
  min-height: 2.75rem;
  width: 100%;
}

@media (min-width: 400px) {
  .quick-hours {
    grid-template-columns: repeat(4, 1fr);
  }
}

.row-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--border);
}

.customer-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.customer-list li {
  min-height: 2.75rem;
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--border);
}

.customer-list li:last-child {
  border-bottom: none;
}

.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.pin-input {
  max-width: 100%;
  font-size: 1.4rem;
  letter-spacing: 0.3em;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.sr-only,
.hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.panel {
  display: none;
}

.panel.is-active {
  display: block;
}

.nav-link {
  min-height: 2.75rem;
  display: inline-flex;
  align-items: center;
}

a.nav-logout {
  font-size: 0.78rem;
  color: var(--muted);
  padding: 0.35rem 0.5rem;
}
