/* =========================================================
   CS17 CALCULATOR WORKSHOP V1.3
   ========================================================= */

* {
  box-sizing: border-box;
}

.cw-app {
  --cw-blue: #1769aa;
  --cw-blue-dark: #0f568d;
  --cw-text: #173247;
  --cw-muted: #6c7d8a;
  --cw-line: #dce5eb;
  --cw-soft: #eef4f8;
  --cw-soft-blue: #e9f3fa;

  width: 100%;
  max-width: 980px;
  margin: 10px auto 25px;
  padding: 0 10px;

  font-family: Arial, Helvetica, sans-serif;
  color: var(--cw-text);
}

.cw-app button,
.cw-app input,
.cw-app select {
  font: inherit;
}


/* HEADER */

.cw-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding: 7px 3px 12px;
}

.cw-brand small,
.cw-title small {
  display: block;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--cw-blue);
}

.cw-brand h1 {
  margin: 2px 0;
  font-size: 27px;
  line-height: 1.08;
}

.cw-brand p {
  margin: 0;
  font-size: 12px;
  color: var(--cw-muted);
}

.cw-location {
  display: flex;
  align-items: flex-end;
  gap: 7px;
}

.cw-location label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  color: var(--cw-muted);
}

.cw-location select {
  display: block;
  min-width: 145px;
  height: 32px;
  margin-top: 3px;
  padding: 0 8px;

  border: 1px solid var(--cw-line);
  border-radius: 7px;
  background: #fff;
  color: var(--cw-text);
}


/* CATEGORY TABS */

.cw-tabs {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 3px;

  width: 100%;
  padding: 4px;

  background: #eaf0f4;
  border-radius: 9px;
}

.cw-tabs button {
  min-width: 0;
  height: 33px;
  padding: 0 5px;

  border: 0;
  border-radius: 6px;
  background: transparent;

  font-size: 12px;
  font-weight: 700;
  color: #607482;

  white-space: nowrap;
  cursor: pointer;
}

.cw-tabs button.active {
  background: #fff;
  color: var(--cw-blue);
  box-shadow: 0 1px 4px #cad5dc;
}


/* MAIN WORKSPACE */

.cw-workspace {
  min-height: 390px;
  margin-top: 9px;

  border: 1px solid var(--cw-line);
  border-radius: 12px;
  background: #fff;

  box-shadow: 0 6px 18px rgba(32, 62, 88, 0.07);
}

.cw-panel {
  display: none;
  padding: 15px;
}

.cw-panel.active {
  display: block;
}

.cw-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;

  margin-bottom: 10px;
}

.cw-title h2,
.cw-coming h2 {
  margin: 2px 0;
  font-size: 18px;
}

.cw-clear {
  border: 0;
  background: transparent;
  color: var(--cw-blue);
  font-weight: 700;
  cursor: pointer;
}


/* STANDARD CALCULATOR */

.cw-calculator {
  width: 300px;
  max-width: 100%;
  margin: 0 auto;
}

.cw-display {
  height: 69px;
  padding: 7px 12px;

  border-radius: 9px;
  background: #142635;

  color: #fff;
  text-align: right;
  overflow: hidden;
}

.cw-display small {
  display: block;
  height: 16px;

  color: #aab9c4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cw-display strong {
  display: block;

  font-size: 29px;
  line-height: 38px;

  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cw-keypad {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;

  margin-top: 6px;
}

.cw-keypad button {
  height: 43px;

  border: 1px solid var(--cw-line);
  border-radius: 7px;
  background: #fff;

  color: var(--cw-text);
  font-weight: 700;

  cursor: pointer;
}

.cw-keypad button:hover {
  background: #f7fafc;
}

.cw-keypad .soft {
  background: #eef3f6;
}

.cw-keypad .op {
  background: var(--cw-soft-blue);
  color: var(--cw-blue-dark);
}

.cw-keypad .equals {
  border-color: var(--cw-blue);
  background: var(--cw-blue);
  color: #fff;
}


/* TAX */

.cw-badge {
  padding: 5px 8px;

  border-radius: 20px;
  background: var(--cw-soft-blue);

  color: var(--cw-blue-dark);
  font-size: 10px;
}

.cw-tax {
  width: 100%;
  max-width: 620px;
  margin: 0 auto;
}

.cw-tax-rates {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;

  margin-bottom: 10px;
}

.cw-rate-card {
  min-height: 61px;
  padding: 8px 10px;

  border: 1px solid var(--cw-line);
  border-radius: 8px;
  background: #fbfdfe;
}

.cw-rate-card > span {
  display: block;
  margin-bottom: 6px;

  font-size: 10px;
  font-weight: 700;
  color: var(--cw-muted);
}

.cw-rate-card strong {
  display: block;
  font-size: 16px;
  color: var(--cw-text);
}

.cw-combined-card strong {
  color: var(--cw-blue);
}

.cw-rate-edit {
  display: flex;
  align-items: center;

  height: 28px;

  border: 1px solid var(--cw-line);
  border-radius: 6px;
  background: #fff;

  overflow: hidden;
}

.cw-rate-edit input {
  width: 100%;
  min-width: 0;
  height: 26px;
  padding: 0 7px;

  border: 0;
  outline: 0;
  background: transparent;
}

.cw-rate-edit b {
  padding-right: 8px;
  color: var(--cw-muted);
  font-size: 11px;
}

.cw-fields {
  display: grid;
  grid-template-columns: 1.4fr 0.8fr;
  gap: 9px;
}

.cw-fields label > span {
  display: block;
  margin-bottom: 3px;

  font-size: 10px;
  font-weight: 700;
  color: var(--cw-muted);
}

.cw-input-wrap {
  display: flex;
  align-items: center;

  height: 36px;

  border: 1px solid var(--cw-line);
  border-radius: 7px;
  background: #fff;

  overflow: hidden;
}

.cw-input-wrap b {
  padding: 0 8px;
  color: var(--cw-muted);
}

.cw-input-wrap input {
  width: 100%;
  min-width: 0;
  height: 34px;
  padding: 0 7px;

  border: 0;
  outline: 0;
  background: transparent;
}

.cw-modes {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3px;

  margin: 9px 0;
  padding: 3px;

  border-radius: 8px;
  background: #edf2f5;
}

.cw-modes button {
  height: 30px;

  border: 0;
  border-radius: 5px;
  background: transparent;

  font-size: 11px;
  font-weight: 700;
  color: var(--cw-muted);

  cursor: pointer;
}

.cw-modes button.active {
  background: #fff;
  color: var(--cw-blue);
  box-shadow: 0 1px 3px rgba(35, 62, 82, 0.08);
}

.cw-results {
  border-top: 1px solid var(--cw-line);
}

.cw-results > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;

  padding: 8px 2px;

  border-bottom: 1px solid var(--cw-line);
  font-size: 12px;
}

.cw-results span {
  color: var(--cw-muted);
}

.cw-results .total b {
  color: var(--cw-blue);
  font-size: 14px;
}

.cw-note,
.cw-source-note {
  margin: 8px 0 0;

  color: var(--cw-muted);
  font-size: 10px;
  line-height: 1.45;
}

.cw-source-note {
  color: #8795a0;
}


/* PERCENTAGE */

.cw-percent {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.cw-percent > div {
  padding: 11px;

  border: 1px solid var(--cw-line);
  border-radius: 8px;
  background: #fbfdfe;
}

.cw-percent p {
  margin: 0 0 6px;

  font-size: 12px;
  line-height: 2;
}

.cw-percent input {
  width: 62px;
  height: 27px;
  padding: 2px 5px;

  border: 1px solid var(--cw-line);
  border-radius: 5px;
}

.cw-percent b {
  color: var(--cw-blue);
  font-size: 17px;
}


/* FUTURE TABS */

.cw-coming {
  padding-top: 130px;

  text-align: center;
  color: var(--cw-muted);
}

.cw-coming p {
  font-size: 12px;
}


/* FOOTER */

.cw-footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;

  padding: 8px 2px;

  color: #7c8c98;
  font-size: 10px;
}


/* =========================================================
   MOBILE
   ========================================================= */

@media (max-width: 620px) {

  .cw-app {
    margin-top: 5px;
    padding: 0 7px;
  }

  .cw-top {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .cw-brand h1 {
    font-size: 24px;
  }

  .cw-location {
    width: 100%;
  }

  .cw-location label {
    flex: 1;
    min-width: 0;
  }

  .cw-location select {
    width: 100%;
    min-width: 0;
  }

  /* 3 buttons across, 2 rows */
  .cw-tabs {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px;
  }

  .cw-tabs button {
    width: 100%;
    height: 34px;
    padding: 0 3px;
    font-size: 11px;
  }

  .cw-workspace {
    min-height: 0;
  }

  .cw-panel {
    padding: 12px;
  }

  .cw-fields {
    grid-template-columns: 1fr;
  }

  .cw-tax-rates {
    grid-template-columns: 1fr 1fr;
  }

  .cw-combined-card {
    grid-column: 1 / -1;
  }

  .cw-percent {
    grid-template-columns: 1fr;
  }

  .cw-coming {
    padding: 70px 10px;
  }

  .cw-footer {
    flex-direction: column;
    gap: 3px;
  }
}


/* VERY NARROW PHONES */

@media (max-width: 390px) {

  /* 2 buttons across, 3 rows */
  .cw-tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .cw-calculator {
    width: 100%;
  }

  .cw-tax-rates {
    grid-template-columns: 1fr;
  }

  .cw-combined-card {
    grid-column: auto;
  }

  .cw-keypad button {
    height: 42px;
  }
}
